#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 Patient {
  int dummy;
};
struct List {
  int dummy;
};
struct Hosp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addList(struct List *, struct Patient *);
void put_in_hosp(struct Hosp *hosp, struct Patient *patient) {
  int __cil_tmp3;
  unsigned int __cil_tmp4;
  unsigned int __cil_tmp5;
  int __cil_tmp6;
  unsigned int __cil_tmp7;
  unsigned int __cil_tmp8;
  unsigned int __cil_tmp9;
  unsigned int __cil_tmp10;
  int __cil_tmp11;
  unsigned int __cil_tmp12;
  unsigned int __cil_tmp13;
  struct List *__cil_tmp14;
  unsigned int __cil_tmp15;
  unsigned int __cil_tmp16;
  unsigned int __cil_tmp17;
  unsigned int __cil_tmp18;
  unsigned int __cil_tmp19;
  unsigned int __cil_tmp20;
  int __cil_tmp21;
  unsigned int __cil_tmp22;
  unsigned int __cil_tmp23;
  int __cil_tmp24;
  unsigned int __cil_tmp25;
  unsigned int __cil_tmp26;
  struct List *__cil_tmp27;
  int *mem_28;
  int *mem_29;
  int *mem_30;
  int *mem_31;
  int *mem_32;
  int *mem_33;
  int *mem_34;
  int *mem_35;
  int *mem_36;
  {
    mem_28 = (int *)patient;
    __cil_tmp3 = *mem_28;
    mem_29 = (int *)patient;
    *mem_29 = __cil_tmp3 + 1;
    {
      __cil_tmp4 = (unsigned int)hosp;
      __cil_tmp5 = __cil_tmp4 + 4;
      mem_30 = (int *)__cil_tmp5;
      __cil_tmp6 = *mem_30;
      if (__cil_tmp6 > 0) {
        {
          __cil_tmp7 = (unsigned int)hosp;
          __cil_tmp8 = __cil_tmp7 + 4;
          __cil_tmp9 = (unsigned int)hosp;
          __cil_tmp10 = __cil_tmp9 + 4;
          mem_31 = (int *)__cil_tmp10;
          __cil_tmp11 = *mem_31;
          mem_32 = (int *)__cil_tmp8;
          *mem_32 = __cil_tmp11 - 1;
          __cil_tmp12 = (unsigned int)hosp;
          __cil_tmp13 = __cil_tmp12 + 24;
          __cil_tmp14 = (struct List *)__cil_tmp13;
          addList(__cil_tmp14, patient);
          __cil_tmp15 = (unsigned int)patient;
          __cil_tmp16 = __cil_tmp15 + 8;
          mem_33 = (int *)__cil_tmp16;
          *mem_33 = 3;
          __cil_tmp17 = (unsigned int)patient;
          __cil_tmp18 = __cil_tmp17 + 4;
          __cil_tmp19 = (unsigned int)patient;
          __cil_tmp20 = __cil_tmp19 + 8;
          mem_34 = (int *)__cil_tmp20;
          __cil_tmp21 = *mem_34;
          __cil_tmp22 = (unsigned int)patient;
          __cil_tmp23 = __cil_tmp22 + 4;
          mem_35 = (int *)__cil_tmp23;
          __cil_tmp24 = *mem_35;
          mem_36 = (int *)__cil_tmp18;
          *mem_36 = __cil_tmp24 + __cil_tmp21;
        }
      } else {
        {
          __cil_tmp25 = (unsigned int)hosp;
          __cil_tmp26 = __cil_tmp25 + 12;
          __cil_tmp27 = (struct List *)__cil_tmp26;
          addList(__cil_tmp27, patient);
        }
      }
    }
    return;
  }
}


x86 assembly (clang, -O0):
<put_in_hosp>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    -0x90(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    1298 <put_in_hosp+0x188>
mov    -0x8(%rbp),%rax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %rax,-0xa0(%rbp)
mov    -0xa0(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%eax
mov    %rax,-0xa8(%rbp)
mov    -0x34(%rbp),%ecx
sub    $0x1,%ecx
mov    -0xa8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%eax
add    $0x18,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <addList@plt>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%eax
mov    %rax,-0xb8(%rbp)
mov    -0xb8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
mov    %rax,-0xc0(%rbp)
mov    -0xc0(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    -0x58(%rbp),%eax
mov    %rax,-0xc8(%rbp)
mov    -0x70(%rbp),%ecx
add    -0x64(%rbp),%ecx
mov    -0xc8(%rbp),%rax
mov    %ecx,(%rax)
jmp    12bc <put_in_hosp+0x1ac>
mov    -0x8(%rbp),%rax
mov    %eax,-0x74(%rbp)
mov    -0x74(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x78(%rbp)
mov    -0x78(%rbp),%eax
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <addList@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_in_hosp>:
push   %rbx
mov    %rsi,%rbx
addl   $0x1,(%rsi)
lea    0x4(%rdi),%eax
mov    (%rax),%ecx
test   %ecx,%ecx
jle    1141 <put_in_hosp+0x31>
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
add    $0x18,%edi
mov    %rbx,%rsi
call   1030 <addList@plt>
lea    0x8(%rbx),%eax
movl   $0x3,(%rax)
add    $0x4,%ebx
addl   $0x3,(%rbx)
pop    %rbx
ret
add    $0xc,%edi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <addList@plt>

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

LLVM IR (-O2):
%struct.Hosp = type { i32 }
%struct.Patient = type { i32 }
%struct.List = type { i32 }
define void @put_in_hosp(%struct.Hosp* %0, %struct.Patient* %1) {
%3 = getelementptr %struct.Patient, %struct.Patient* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
%6 = ptrtoint %struct.Hosp* %0 to i64
%7 = add i64 %6, 4
%8 = and i64 %7, 4294967295
%9 = inttoptr i64 %8 to i32*
%10 = load i32, i32* %9
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %27
12: ; preds = %2
%13 = add nsw i32 %10, -1
store i32 %13, i32* %9
%14 = add i64 %6, 24
%15 = and i64 %14, 4294967295
%16 = inttoptr i64 %15 to %struct.List*
%17 = tail call i32 @addList(%struct.List* %16, %struct.Patient* %1)
%18 = ptrtoint %struct.Patient* %1 to i64
%19 = add i64 %18, 8
%20 = and i64 %19, 4294967295
%21 = inttoptr i64 %20 to i32*
store i32 3, i32* %21
%22 = add i64 %18, 4
%23 = and i64 %22, 4294967295
%24 = inttoptr i64 %23 to i32*
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 3
store i32 %26, i32* %24
br label %32
27: ; preds = %2
%28 = add i64 %6, 12
%29 = and i64 %28, 4294967295
%30 = inttoptr i64 %29 to %struct.List*
%31 = tail call i32 @addList(%struct.List* %30, %struct.Patient* %1)
br label %32
32: ; preds = %27, %12
ret void
}