import angr


class GetProcessHeap(angr.SimProcedure):
    def run(self):
        return 1  # fake heap handle


class HeapCreate(angr.SimProcedure):
    def run(self, flOptions, dwInitialSize, dwMaximumSize): #pylint:disable=arguments-differ, unused-argument
        return 1  # still a fake heap handle


class HeapAlloc(angr.SimProcedure):
    def run(self, HeapHandle, Flags, Size): #pylint:disable=arguments-differ, unused-argument
        addr = self.state.heap.malloc(Size)

        # conditionally zero the allocated memory
        if self.state.solver.solution(Flags & 8, 8):
            # allocated size might be greater than requested
            data_size = self.state.solver.eval_one(
                self.state.heap.chunk_from_mem(addr).get_data_size()
            )
            data = self.state.solver.BVV(0, data_size * 8)
            condition = self.state.solver.If(
                Flags & 8 == 8,
                self.state.solver.true,
                self.state.solver.false
            )
            self.state.memory.store(addr, data, size=data_size, condition=condition)
        return addr


class HeapReAlloc(angr.SimProcedure):
    def run(self, hHeap, dwFlags, lpMem, dwBytes): #pylint:disable=arguments-differ, unused-argument
        return self.state.heap.realloc(lpMem, dwBytes)


class GlobalAlloc(HeapAlloc):
    def run(self, Flags, Size):
        return super(GlobalAlloc, self).run(1, Flags, Size)


class HeapFree(angr.SimProcedure):
    def run(self, HeapHandle, Flags, lpMem): #pylint:disable=arguments-differ, unused-argument
        return 1

@@ -837,180 +837,8 @@
  8)%0A
-            condition = self.state.solver.If(%0A                Flags & 8 == 8,%0A                self.state.solver.true,%0A                self.state.solver.false%0A            )%0A
     
@@ -907,25 +907,30 @@
 ndition=
-condition
+Flags & 8 == 8
 )%0A      

Make less ugly