#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct Village {
  int dummy;
};
struct Patient {
  int dummy;
};
struct List {
  int dummy;
};
struct Hosp {
  int dummy;
};

/* Variables and functions */
struct List *check_patients_assess(struct Village *, struct List *);
int /*<<< orphan*/ check_patients_inside(struct Village *, struct List *);
int /*<<< orphan*/ check_patients_waiting(struct Village *, struct List *);
struct Patient *generate_patient(struct Village *);
int /*<<< orphan*/ put_in_hosp(struct Hosp *, struct Patient *);
int /*<<< orphan*/ removeList(struct List *, struct Patient *);
struct List *sim(struct Village *village) {
  int i;
  struct Patient *patient;
  struct Patient *p;
  struct List *l;
  struct List *vl;
  struct List *up;
  void *__cil_tmp8;
  unsigned int __cil_tmp9;
  unsigned int __cil_tmp10;
  void *__cil_tmp11;
  unsigned int __cil_tmp12;
  unsigned int __cil_tmp13;
  unsigned int __cil_tmp14;
  unsigned int __cil_tmp15;
  struct Village *__cil_tmp16;
  void *__cil_tmp17;
  unsigned int __cil_tmp18;
  unsigned int __cil_tmp19;
  unsigned int __cil_tmp20;
  unsigned int __cil_tmp21;
  void *__cil_tmp22;
  unsigned int __cil_tmp23;
  unsigned int __cil_tmp24;
  unsigned int __cil_tmp25;
  unsigned int __cil_tmp26;
  struct Hosp *__cil_tmp27;
  unsigned int __cil_tmp28;
  unsigned int __cil_tmp29;
  unsigned int __cil_tmp30;
  unsigned int __cil_tmp31;
  unsigned int __cil_tmp32;
  unsigned int __cil_tmp33;
  struct List *__cil_tmp34;
  unsigned int __cil_tmp35;
  unsigned int __cil_tmp36;
  unsigned int __cil_tmp37;
  unsigned int __cil_tmp38;
  struct List *__cil_tmp39;
  unsigned int __cil_tmp40;
  unsigned int __cil_tmp41;
  unsigned int __cil_tmp42;
  unsigned int __cil_tmp43;
  struct List *__cil_tmp44;
  void *__cil_tmp45;
  unsigned int __cil_tmp46;
  unsigned int __cil_tmp47;
  unsigned int __cil_tmp48;
  unsigned int __cil_tmp49;
  struct Hosp *__cil_tmp50;
  struct Village **mem_51;
  struct List **mem_52;
  struct Patient **mem_53;
  struct List **mem_54;
  struct List **mem_55;
  struct List **mem_56;
  struct List **mem_57;
  {
    {
      __cil_tmp8 = (void *)0;
      __cil_tmp9 = (unsigned int)__cil_tmp8;
      __cil_tmp10 = (unsigned int)village;
      if (__cil_tmp10 == __cil_tmp9) {
        {
          __cil_tmp11 = (void *)0;
          return ((struct List *)__cil_tmp11);
        }
      } else {
      }
    }
    i = 0;
    {
      while (1) {
      while_7_continue:;
        if (i < 4) {
        } else {
          goto while_7_break;
        }
        {
          __cil_tmp12 = i * 4U;
          __cil_tmp13 = 0 + __cil_tmp12;
          __cil_tmp14 = (unsigned int)village;
          __cil_tmp15 = __cil_tmp14 + __cil_tmp13;
          mem_51 = (struct Village **)__cil_tmp15;
          __cil_tmp16 = *mem_51;
          vl = sim(__cil_tmp16);
          l = vl;
        }
        {
          __cil_tmp17 = (void *)0;
          __cil_tmp18 = (unsigned int)__cil_tmp17;
          __cil_tmp19 = (unsigned int)l;
          if (__cil_tmp19 != __cil_tmp18) {
            __cil_tmp20 = (unsigned int)l;
            __cil_tmp21 = __cil_tmp20 + 8;
            mem_52 = (struct List **)__cil_tmp21;
            l = *mem_52;
            {
              while (1) {
              while_8_continue:;
                {
                  __cil_tmp22 = (void *)0;
                  __cil_tmp23 = (unsigned int)__cil_tmp22;
                  __cil_tmp24 = (unsigned int)l;
                  if (__cil_tmp24 != __cil_tmp23) {
                  } else {
                    goto while_8_break;
                  }
                }
                {
                  mem_53 = (struct Patient **)l;
                  p = *mem_53;
                  __cil_tmp25 = (unsigned int)village;
                  __cil_tmp26 = __cil_tmp25 + 32;
                  __cil_tmp27 = (struct Hosp *)__cil_tmp26;
                  put_in_hosp(__cil_tmp27, p);
                  removeList(vl, p);
                  __cil_tmp28 = (unsigned int)l;
                  __cil_tmp29 = __cil_tmp28 + 8;
                  mem_54 = (struct List **)__cil_tmp29;
                  l = *mem_54;
                }
              }
            while_8_break:;
            }
          } else {
          }
        }
        i = i + 1;
      }
    while_7_break:;
    }
    {
      __cil_tmp30 = 36 + 8;
      __cil_tmp31 = 32 + __cil_tmp30;
      __cil_tmp32 = (unsigned int)village;
      __cil_tmp33 = __cil_tmp32 + __cil_tmp31;
      mem_55 = (struct List **)__cil_tmp33;
      __cil_tmp34 = *mem_55;
      check_patients_inside(village, __cil_tmp34);
      __cil_tmp35 = 24 + 8;
      __cil_tmp36 = 32 + __cil_tmp35;
      __cil_tmp37 = (unsigned int)village;
      __cil_tmp38 = __cil_tmp37 + __cil_tmp36;
      mem_56 = (struct List **)__cil_tmp38;
      __cil_tmp39 = *mem_56;
      up = check_patients_assess(village, __cil_tmp39);
      __cil_tmp40 = 12 + 8;
      __cil_tmp41 = 32 + __cil_tmp40;
      __cil_tmp42 = (unsigned int)village;
      __cil_tmp43 = __cil_tmp42 + __cil_tmp41;
      mem_57 = (struct List **)__cil_tmp43;
      __cil_tmp44 = *mem_57;
      check_patients_waiting(village, __cil_tmp44);
      patient = generate_patient(village);
    }
    {
      __cil_tmp45 = (void *)0;
      __cil_tmp46 = (unsigned int)__cil_tmp45;
      __cil_tmp47 = (unsigned int)patient;
      if (__cil_tmp47 != __cil_tmp46) {
        {
          __cil_tmp48 = (unsigned int)village;
          __cil_tmp49 = __cil_tmp48 + 32;
          __cil_tmp50 = (struct Hosp *)__cil_tmp49;
          put_in_hosp(__cil_tmp50, patient);
        }
      } else {
      }
    }
    return (up);
  }
}


x86 assembly (clang, -O0):
<sim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x150,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jne    11b6 <sim+0x46>
movq   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1526 <sim+0x3b6>
jmp    11bb <sim+0x4b>
movl   $0x0,-0x14(%rbp)
jmp    11c7 <sim+0x57>
cmpl   $0x4,-0x14(%rbp)
jge    11d6 <sim+0x66>
jmp    11db <sim+0x6b>
jmp    1370 <sim+0x200>
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x0,%eax
mov    %eax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
add    -0x60(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rdi
call   1090 <sim@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %eax,-0x7c(%rbp)
mov    -0x30(%rbp),%rax
mov    %eax,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x7c(%rbp),%eax
je     135d <sim+0x1ed>
mov    -0x30(%rbp),%rax
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%eax
mov    %rax,-0x128(%rbp)
mov    -0x128(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1285 <sim+0x115>
movq   $0x0,-0x90(%rbp)
mov    -0x90(%rbp),%rax
mov    %eax,-0x94(%rbp)
mov    -0x30(%rbp),%rax
mov    %eax,-0x98(%rbp)
mov    -0x98(%rbp),%eax
cmp    -0x94(%rbp),%eax
je     12be <sim+0x14e>
jmp    12c3 <sim+0x153>
jmp    1358 <sim+0x1e8>
mov    -0x30(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x130(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x9c(%rbp)
mov    -0x9c(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0xa0(%rbp)
mov    -0xa0(%rbp),%eax
mov    %rax,-0xa8(%rbp)
mov    -0xa8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <put_in_hosp@plt>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <removeList@plt>
mov    -0x30(%rbp),%rax
mov    %eax,-0xac(%rbp)
mov    -0xac(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0xb0(%rbp)
mov    -0xb0(%rbp),%eax
mov    %rax,-0x138(%rbp)
mov    -0x138(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
jmp    1280 <sim+0x110>
jmp    1362 <sim+0x1f2>
jmp    1362 <sim+0x1f2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c2 <sim+0x52>
movl   $0x2c,-0xb4(%rbp)
mov    -0xb4(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0xb8(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0xbc(%rbp)
mov    -0xbc(%rbp),%eax
add    -0xb8(%rbp),%eax
mov    %eax,-0xc0(%rbp)
mov    -0xc0(%rbp),%eax
mov    %rax,-0x140(%rbp)
mov    -0x140(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xc8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0xc8(%rbp),%rsi
call   1030 <check_patients_inside@plt>
movl   $0x20,-0xcc(%rbp)
mov    -0xcc(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0xd0(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0xd4(%rbp)
mov    -0xd4(%rbp),%eax
add    -0xd0(%rbp),%eax
mov    %eax,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
mov    %rax,-0x148(%rbp)
mov    -0x148(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
call   1050 <check_patients_assess@plt>
mov    %rax,-0x40(%rbp)
movl   $0x14,-0xe4(%rbp)
mov    -0xe4(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0xe8(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0xec(%rbp)
mov    -0xec(%rbp),%eax
add    -0xe8(%rbp),%eax
mov    %eax,-0xf0(%rbp)
mov    -0xf0(%rbp),%eax
mov    %rax,-0x150(%rbp)
mov    -0x150(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xf8(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
call   1040 <check_patients_waiting@plt>
mov    -0x10(%rbp),%rdi
call   1070 <generate_patient@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x100(%rbp)
mov    -0x100(%rbp),%rax
mov    %eax,-0x104(%rbp)
mov    -0x20(%rbp),%rax
mov    %eax,-0x108(%rbp)
mov    -0x108(%rbp),%eax
cmp    -0x104(%rbp),%eax
je     1519 <sim+0x3a9>
mov    -0x10(%rbp),%rax
mov    %eax,-0x10c(%rbp)
mov    -0x10c(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x110(%rbp)
mov    -0x110(%rbp),%eax
mov    %rax,-0x118(%rbp)
mov    -0x118(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <put_in_hosp@plt>
jmp    151e <sim+0x3ae>
jmp    151e <sim+0x3ae>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x150,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sim>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r14
test   %r14d,%r14d
je     130c <sim+0x19c>
lea    0x20(%r14),%r15d
mov    %r14d,%eax
mov    (%rax),%rdi
call   1090 <sim@plt>
mov    %rax,%r12
test   %r12d,%r12d
je     11d3 <sim+0x63>
lea    0x8(%r12),%eax
mov    (%rax),%rbx
test   %ebx,%ebx
je     11d3 <sim+0x63>
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%r13
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <put_in_hosp@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <removeList@plt>
add    $0x8,%ebx
mov    (%rbx),%rbx
test   %ebx,%ebx
jne    11b0 <sim+0x40>
lea    0x4(%r14),%eax
mov    (%rax),%rdi
call   1090 <sim@plt>
mov    %rax,%r12
test   %r12d,%r12d
je     1223 <sim+0xb3>
lea    0x8(%r12),%eax
mov    (%rax),%rbx
test   %ebx,%ebx
je     1223 <sim+0xb3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx),%r13
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <put_in_hosp@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <removeList@plt>
add    $0x8,%ebx
mov    (%rbx),%rbx
test   %ebx,%ebx
jne    1200 <sim+0x90>
lea    0x8(%r14),%eax
mov    (%rax),%rdi
call   1090 <sim@plt>
mov    %rax,%r12
test   %r12d,%r12d
je     1273 <sim+0x103>
lea    0x8(%r12),%eax
mov    (%rax),%rbx
test   %ebx,%ebx
je     1273 <sim+0x103>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx),%r13
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <put_in_hosp@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <removeList@plt>
add    $0x8,%ebx
mov    (%rbx),%rbx
test   %ebx,%ebx
jne    1250 <sim+0xe0>
lea    0xc(%r14),%eax
mov    (%rax),%rdi
call   1090 <sim@plt>
mov    %rax,%r12
test   %r12d,%r12d
je     12c3 <sim+0x153>
lea    0x8(%r12),%eax
mov    (%rax),%rbx
test   %ebx,%ebx
je     12c3 <sim+0x153>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    (%rbx),%r13
mov    %r15,%rdi
mov    %r13,%rsi
call   1080 <put_in_hosp@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1060 <removeList@plt>
add    $0x8,%ebx
mov    (%rbx),%rbx
test   %ebx,%ebx
jne    12a0 <sim+0x130>
lea    0x4c(%r14),%eax
mov    (%rax),%rsi
mov    %r14,%rdi
call   1030 <check_patients_inside@plt>
lea    0x40(%r14),%eax
mov    (%rax),%rsi
mov    %r14,%rdi
call   1050 <check_patients_assess@plt>
mov    %rax,%rbx
lea    0x34(%r14),%eax
mov    (%rax),%rsi
mov    %r14,%rdi
call   1040 <check_patients_waiting@plt>
mov    %r14,%rdi
call   1070 <generate_patient@plt>
test   %eax,%eax
je     130e <sim+0x19e>
mov    %r15,%rdi
mov    %rax,%rsi
call   1080 <put_in_hosp@plt>
jmp    130e <sim+0x19e>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.List = type { i32 }
%struct.Village = type { i32 }
%struct.Patient = type { i32 }
%struct.Hosp = type { i32 }
define %struct.List* @sim(%struct.Village* %0) {
%2 = alloca %struct.List*
%3 = alloca %struct.Village*
%4 = alloca i32
%5 = alloca %struct.Patient*
%6 = alloca %struct.Patient*
%7 = alloca %struct.List*
%8 = alloca %struct.List*
%9 = alloca %struct.List*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.Village*
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i8*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca %struct.Hosp*
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca %struct.List*
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca i32
%41 = alloca %struct.List*
%42 = alloca i32
%43 = alloca i32
%44 = alloca i32
%45 = alloca i32
%46 = alloca %struct.List*
%47 = alloca i8*
%48 = alloca i32
%49 = alloca i32
%50 = alloca i32
%51 = alloca i32
%52 = alloca %struct.Hosp*
%53 = alloca %struct.Village**
%54 = alloca %struct.List**
%55 = alloca %struct.Patient**
%56 = alloca %struct.List**
%57 = alloca %struct.List**
%58 = alloca %struct.List**
%59 = alloca %struct.List**
store %struct.Village* %0, %struct.Village** %3
store i8* null, i8** %10
%60 = load i8*, i8** %10
%61 = ptrtoint i8* %60 to i32
store i32 %61, i32* %11
%62 = load %struct.Village*, %struct.Village** %3
%63 = ptrtoint %struct.Village* %62 to i32
store i32 %63, i32* %12
%64 = load i32, i32* %12
%65 = load i32, i32* %11
%66 = icmp eq i32 %64, %65
br i1 %66, label %67, label %70
67: ; preds = %1
store i8* null, i8** %13
%68 = load i8*, i8** %13
%69 = bitcast i8* %68 to %struct.List*
store %struct.List* %69, %struct.List** %2
br label %225
70: ; preds = %1
br label %71
71: ; preds = %70
store i32 0, i32* %4
br label %72
72: ; preds = %71, %153
br label %73
73: ; preds = %72
%74 = load i32, i32* %4
%75 = icmp slt i32 %74, 4
br i1 %75, label %76, label %77
76: ; preds = %73
br label %78
77: ; preds = %73
br label %156
78: ; preds = %76
%79 = load i32, i32* %4
%80 = mul i32 %79, 4
store i32 %80, i32* %14
%81 = load i32, i32* %14
%82 = add i32 0, %81
store i32 %82, i32* %15
%83 = load %struct.Village*, %struct.Village** %3
%84 = ptrtoint %struct.Village* %83 to i32
store i32 %84, i32* %16
%85 = load i32, i32* %16
%86 = load i32, i32* %15
%87 = add i32 %85, %86
store i32 %87, i32* %17
%88 = load i32, i32* %17
%89 = zext i32 %88 to i64
%90 = inttoptr i64 %89 to %struct.Village**
store %struct.Village** %90, %struct.Village*** %53
%91 = load %struct.Village**, %struct.Village*** %53
%92 = load %struct.Village*, %struct.Village** %91
store %struct.Village* %92, %struct.Village** %18
%93 = load %struct.Village*, %struct.Village** %18
%94 = call %struct.List* @sim(%struct.Village* %93)
store %struct.List* %94, %struct.List** %8
%95 = load %struct.List*, %struct.List** %8
store %struct.List* %95, %struct.List** %7
store i8* null, i8** %19
%96 = load i8*, i8** %19
%97 = ptrtoint i8* %96 to i32
store i32 %97, i32* %20
%98 = load %struct.List*, %struct.List** %7
%99 = ptrtoint %struct.List* %98 to i32
store i32 %99, i32* %21
%100 = load i32, i32* %21
%101 = load i32, i32* %20
%102 = icmp ne i32 %100, %101
br i1 %102, label %103, label %152
103: ; preds = %78
%104 = load %struct.List*, %struct.List** %7
%105 = ptrtoint %struct.List* %104 to i32
store i32 %105, i32* %22
%106 = load i32, i32* %22
%107 = add i32 %106, 8
store i32 %107, i32* %23
%108 = load i32, i32* %23
%109 = zext i32 %108 to i64
%110 = inttoptr i64 %109 to %struct.List**
store %struct.List** %110, %struct.List*** %54
%111 = load %struct.List**, %struct.List*** %54
%112 = load %struct.List*, %struct.List** %111
store %struct.List* %112, %struct.List** %7
br label %113
113: ; preds = %103, %124
br label %114
114: ; preds = %113
store i8* null, i8** %24
%115 = load i8*, i8** %24
%116 = ptrtoint i8* %115 to i32
store i32 %116, i32* %25
%117 = load %struct.List*, %struct.List** %7
%118 = ptrtoint %struct.List* %117 to i32
store i32 %118, i32* %26
%119 = load i32, i32* %26
%120 = load i32, i32* %25
%121 = icmp ne i32 %119, %120
br i1 %121, label %122, label %123
122: ; preds = %114
br label %124
123: ; preds = %114
br label %151
124: ; preds = %122
%125 = load %struct.List*, %struct.List** %7
%126 = bitcast %struct.List* %125 to %struct.Patient**
store %struct.Patient** %126, %struct.Patient*** %55
%127 = load %struct.Patient**, %struct.Patient*** %55
%128 = load %struct.Patient*, %struct.Patient** %127
store %struct.Patient* %128, %struct.Patient** %6
%129 = load %struct.Village*, %struct.Village** %3
%130 = ptrtoint %struct.Village* %129 to i32
store i32 %130, i32* %27
%131 = load i32, i32* %27
%132 = add i32 %131, 32
store i32 %132, i32* %28
%133 = load i32, i32* %28
%134 = zext i32 %133 to i64
%135 = inttoptr i64 %134 to %struct.Hosp*
store %struct.Hosp* %135, %struct.Hosp** %29
%136 = load %struct.Hosp*, %struct.Hosp** %29
%137 = load %struct.Patient*, %struct.Patient** %6
%138 = call i32 @put_in_hosp(%struct.Hosp* %136, %struct.Patient* %137)
%139 = load %struct.List*, %struct.List** %8
%140 = load %struct.Patient*, %struct.Patient** %6
%141 = call i32 @removeList(%struct.List* %139, %struct.Patient* %140)
%142 = load %struct.List*, %struct.List** %7
%143 = ptrtoint %struct.List* %142 to i32
store i32 %143, i32* %30
%144 = load i32, i32* %30
%145 = add i32 %144, 8
store i32 %145, i32* %31
%146 = load i32, i32* %31
%147 = zext i32 %146 to i64
%148 = inttoptr i64 %147 to %struct.List**
store %struct.List** %148, %struct.List*** %56
%149 = load %struct.List**, %struct.List*** %56
%150 = load %struct.List*, %struct.List** %149
store %struct.List* %150, %struct.List** %7
br label %113
151: ; preds = %123
br label %153
152: ; preds = %78
br label %153
153: ; preds = %152, %151
%154 = load i32, i32* %4
%155 = add nsw i32 %154, 1
store i32 %155, i32* %4
br label %72
156: ; preds = %77
store i32 44, i32* %32
%157 = load i32, i32* %32
%158 = add i32 32, %157
store i32 %158, i32* %33
%159 = load %struct.Village*, %struct.Village** %3
%160 = ptrtoint %struct.Village* %159 to i32
store i32 %160, i32* %34
%161 = load i32, i32* %34
%162 = load i32, i32* %33
%163 = add i32 %161, %162
store i32 %163, i32* %35
%164 = load i32, i32* %35
%165 = zext i32 %164 to i64
%166 = inttoptr i64 %165 to %struct.List**
store %struct.List** %166, %struct.List*** %57
%167 = load %struct.List**, %struct.List*** %57
%168 = load %struct.List*, %struct.List** %167
store %struct.List* %168, %struct.List** %36
%169 = load %struct.Village*, %struct.Village** %3
%170 = load %struct.List*, %struct.List** %36
%171 = call i32 @check_patients_inside(%struct.Village* %169, %struct.List* %170)
store i32 32, i32* %37
%172 = load i32, i32* %37
%173 = add i32 32, %172
store i32 %173, i32* %38
%174 = load %struct.Village*, %struct.Village** %3
%175 = ptrtoint %struct.Village* %174 to i32
store i32 %175, i32* %39
%176 = load i32, i32* %39
%177 = load i32, i32* %38
%178 = add i32 %176, %177
store i32 %178, i32* %40
%179 = load i32, i32* %40
%180 = zext i32 %179 to i64
%181 = inttoptr i64 %180 to %struct.List**
store %struct.List** %181, %struct.List*** %58
%182 = load %struct.List**, %struct.List*** %58
%183 = load %struct.List*, %struct.List** %182
store %struct.List* %183, %struct.List** %41
%184 = load %struct.Village*, %struct.Village** %3
%185 = load %struct.List*, %struct.List** %41
%186 = call %struct.List* @check_patients_assess(%struct.Village* %184, %struct.List* %185)
store %struct.List* %186, %struct.List** %9
store i32 20, i32* %42
%187 = load i32, i32* %42
%188 = add i32 32, %187
store i32 %188, i32* %43
%189 = load %struct.Village*, %struct.Village** %3
%190 = ptrtoint %struct.Village* %189 to i32
store i32 %190, i32* %44
%191 = load i32, i32* %44
%192 = load i32, i32* %43
%193 = add i32 %191, %192
store i32 %193, i32* %45
%194 = load i32, i32* %45
%195 = zext i32 %194 to i64
%196 = inttoptr i64 %195 to %struct.List**
store %struct.List** %196, %struct.List*** %59
%197 = load %struct.List**, %struct.List*** %59
%198 = load %struct.List*, %struct.List** %197
store %struct.List* %198, %struct.List** %46
%199 = load %struct.Village*, %struct.Village** %3
%200 = load %struct.List*, %struct.List** %46
%201 = call i32 @check_patients_waiting(%struct.Village* %199, %struct.List* %200)
%202 = load %struct.Village*, %struct.Village** %3
%203 = call %struct.Patient* @generate_patient(%struct.Village* %202)
store %struct.Patient* %203, %struct.Patient** %5
store i8* null, i8** %47
%204 = load i8*, i8** %47
%205 = ptrtoint i8* %204 to i32
store i32 %205, i32* %48
%206 = load %struct.Patient*, %struct.Patient** %5
%207 = ptrtoint %struct.Patient* %206 to i32
store i32 %207, i32* %49
%208 = load i32, i32* %49
%209 = load i32, i32* %48
%210 = icmp ne i32 %208, %209
br i1 %210, label %211, label %222
211: ; preds = %156
%212 = load %struct.Village*, %struct.Village** %3
%213 = ptrtoint %struct.Village* %212 to i32
store i32 %213, i32* %50
%214 = load i32, i32* %50
%215 = add i32 %214, 32
store i32 %215, i32* %51
%216 = load i32, i32* %51
%217 = zext i32 %216 to i64
%218 = inttoptr i64 %217 to %struct.Hosp*
store %struct.Hosp* %218, %struct.Hosp** %52
%219 = load %struct.Hosp*, %struct.Hosp** %52
%220 = load %struct.Patient*, %struct.Patient** %5
%221 = call i32 @put_in_hosp(%struct.Hosp* %219, %struct.Patient* %220)
br label %223
222: ; preds = %156
br label %223
223: ; preds = %222, %211
%224 = load %struct.List*, %struct.List** %9
store %struct.List* %224, %struct.List** %2
br label %225
225: ; preds = %223, %67
%226 = load %struct.List*, %struct.List** %2
ret %struct.List* %226
}

LLVM IR (-O2):
%struct.List = type { i32 }
%struct.Village = type { i32 }
%struct.Hosp = type { i32 }
%struct.Patient = type { i32 }
define %struct.List* @sim(%struct.Village* %0) {
%2 = ptrtoint %struct.Village* %0 to i64
%3 = trunc i64 %2 to i32
%4 = icmp eq i32 %3, 0
br i1 %4, label %153, label %5
5: ; preds = %1
%6 = add i64 %2, 32
%7 = and i64 %6, 4294967295
%8 = inttoptr i64 %7 to %struct.Hosp*
%9 = and i64 %2, 4294967295
%10 = inttoptr i64 %9 to %struct.Village**
%11 = load %struct.Village*, %struct.Village** %10
%12 = tail call %struct.List* @sim(%struct.Village* %11)
%13 = ptrtoint %struct.List* %12 to i64
%14 = trunc i64 %13 to i32
%15 = icmp eq i32 %14, 0
br i1 %15, label %38, label %16
16: ; preds = %5
%17 = add i64 %13, 8
%18 = and i64 %17, 4294967295
%19 = inttoptr i64 %18 to %struct.List**
%20 = load %struct.List*, %struct.List** %19
%21 = ptrtoint %struct.List* %20 to i64
%22 = trunc i64 %21 to i32
%23 = icmp eq i32 %22, 0
br i1 %23, label %38, label %24
24: ; preds = %16, %24
%25 = phi i64 [ %35, %24 ], [ %21, %16 ]
%26 = phi %struct.List* [ %34, %24 ], [ %20, %16 ]
%27 = bitcast %struct.List* %26 to %struct.Patient**
%28 = load %struct.Patient*, %struct.Patient** %27
%29 = tail call i32 @put_in_hosp(%struct.Hosp* %8, %struct.Patient* %28)
%30 = tail call i32 @removeList(%struct.List* %12, %struct.Patient* %28)
%31 = add i64 %25, 8
%32 = and i64 %31, 4294967295
%33 = inttoptr i64 %32 to %struct.List**
%34 = load %struct.List*, %struct.List** %33
%35 = ptrtoint %struct.List* %34 to i64
%36 = trunc i64 %35 to i32
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %24
38: ; preds = %24, %16, %5
%39 = add i64 %2, 4
%40 = and i64 %39, 4294967295
%41 = inttoptr i64 %40 to %struct.Village**
%42 = load %struct.Village*, %struct.Village** %41
%43 = tail call %struct.List* @sim(%struct.Village* %42)
%44 = ptrtoint %struct.List* %43 to i64
%45 = trunc i64 %44 to i32
%46 = icmp eq i32 %45, 0
br i1 %46, label %69, label %47
47: ; preds = %38
%48 = add i64 %44, 8
%49 = and i64 %48, 4294967295
%50 = inttoptr i64 %49 to %struct.List**
%51 = load %struct.List*, %struct.List** %50
%52 = ptrtoint %struct.List* %51 to i64
%53 = trunc i64 %52 to i32
%54 = icmp eq i32 %53, 0
br i1 %54, label %69, label %55
55: ; preds = %47, %55
%56 = phi i64 [ %66, %55 ], [ %52, %47 ]
%57 = phi %struct.List* [ %65, %55 ], [ %51, %47 ]
%58 = bitcast %struct.List* %57 to %struct.Patient**
%59 = load %struct.Patient*, %struct.Patient** %58
%60 = tail call i32 @put_in_hosp(%struct.Hosp* %8, %struct.Patient* %59)
%61 = tail call i32 @removeList(%struct.List* %43, %struct.Patient* %59)
%62 = add i64 %56, 8
%63 = and i64 %62, 4294967295
%64 = inttoptr i64 %63 to %struct.List**
%65 = load %struct.List*, %struct.List** %64
%66 = ptrtoint %struct.List* %65 to i64
%67 = trunc i64 %66 to i32
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %55
69: ; preds = %55, %47, %38
%70 = add i64 %2, 8
%71 = and i64 %70, 4294967295
%72 = inttoptr i64 %71 to %struct.Village**
%73 = load %struct.Village*, %struct.Village** %72
%74 = tail call %struct.List* @sim(%struct.Village* %73)
%75 = ptrtoint %struct.List* %74 to i64
%76 = trunc i64 %75 to i32
%77 = icmp eq i32 %76, 0
br i1 %77, label %100, label %78
78: ; preds = %69
%79 = add i64 %75, 8
%80 = and i64 %79, 4294967295
%81 = inttoptr i64 %80 to %struct.List**
%82 = load %struct.List*, %struct.List** %81
%83 = ptrtoint %struct.List* %82 to i64
%84 = trunc i64 %83 to i32
%85 = icmp eq i32 %84, 0
br i1 %85, label %100, label %86
86: ; preds = %78, %86
%87 = phi i64 [ %97, %86 ], [ %83, %78 ]
%88 = phi %struct.List* [ %96, %86 ], [ %82, %78 ]
%89 = bitcast %struct.List* %88 to %struct.Patient**
%90 = load %struct.Patient*, %struct.Patient** %89
%91 = tail call i32 @put_in_hosp(%struct.Hosp* %8, %struct.Patient* %90)
%92 = tail call i32 @removeList(%struct.List* %74, %struct.Patient* %90)
%93 = add i64 %87, 8
%94 = and i64 %93, 4294967295
%95 = inttoptr i64 %94 to %struct.List**
%96 = load %struct.List*, %struct.List** %95
%97 = ptrtoint %struct.List* %96 to i64
%98 = trunc i64 %97 to i32
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %86
100: ; preds = %86, %78, %69
%101 = add i64 %2, 12
%102 = and i64 %101, 4294967295
%103 = inttoptr i64 %102 to %struct.Village**
%104 = load %struct.Village*, %struct.Village** %103
%105 = tail call %struct.List* @sim(%struct.Village* %104)
%106 = ptrtoint %struct.List* %105 to i64
%107 = trunc i64 %106 to i32
%108 = icmp eq i32 %107, 0
br i1 %108, label %131, label %109
109: ; preds = %100
%110 = add i64 %106, 8
%111 = and i64 %110, 4294967295
%112 = inttoptr i64 %111 to %struct.List**
%113 = load %struct.List*, %struct.List** %112
%114 = ptrtoint %struct.List* %113 to i64
%115 = trunc i64 %114 to i32
%116 = icmp eq i32 %115, 0
br i1 %116, label %131, label %117
117: ; preds = %109, %117
%118 = phi i64 [ %128, %117 ], [ %114, %109 ]
%119 = phi %struct.List* [ %127, %117 ], [ %113, %109 ]
%120 = bitcast %struct.List* %119 to %struct.Patient**
%121 = load %struct.Patient*, %struct.Patient** %120
%122 = tail call i32 @put_in_hosp(%struct.Hosp* %8, %struct.Patient* %121)
%123 = tail call i32 @removeList(%struct.List* %105, %struct.Patient* %121)
%124 = add i64 %118, 8
%125 = and i64 %124, 4294967295
%126 = inttoptr i64 %125 to %struct.List**
%127 = load %struct.List*, %struct.List** %126
%128 = ptrtoint %struct.List* %127 to i64
%129 = trunc i64 %128 to i32
%130 = icmp eq i32 %129, 0
br i1 %130, label %131, label %117
131: ; preds = %117, %109, %100
%132 = add i64 %2, 76
%133 = and i64 %132, 4294967295
%134 = inttoptr i64 %133 to %struct.List**
%135 = load %struct.List*, %struct.List** %134
%136 = tail call i32 @check_patients_inside(%struct.Village* %0, %struct.List* %135)
%137 = add i64 %2, 64
%138 = and i64 %137, 4294967295
%139 = inttoptr i64 %138 to %struct.List**
%140 = load %struct.List*, %struct.List** %139
%141 = tail call %struct.List* @check_patients_assess(%struct.Village* %0, %struct.List* %140)
%142 = add i64 %2, 52
%143 = and i64 %142, 4294967295
%144 = inttoptr i64 %143 to %struct.List**
%145 = load %struct.List*, %struct.List** %144
%146 = tail call i32 @check_patients_waiting(%struct.Village* %0, %struct.List* %145)
%147 = tail call %struct.Patient* @generate_patient(%struct.Village* %0)
%148 = ptrtoint %struct.Patient* %147 to i64
%149 = trunc i64 %148 to i32
%150 = icmp eq i32 %149, 0
br i1 %150, label %153, label %151
151: ; preds = %131
%152 = tail call i32 @put_in_hosp(%struct.Hosp* %8, %struct.Patient* %147)
br label %153
153: ; preds = %151, %131, %1
%154 = phi %struct.List* [ null, %1 ], [ %141, %131 ], [ %141, %151 ]
ret %struct.List* %154
}