xunge/DecIR huggingface dataset:
/* Variables and functions */
int VideoChangeCore(int);
int VideoInit(int coreid) { return VideoChangeCore(coreid); }


x86 assembly (clang, -O0):
<VideoInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <VideoChangeCore@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<VideoInit>:
jmp    1030 <VideoChangeCore@plt>

LLVM IR (-O0):
define i32 @VideoInit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @VideoChangeCore(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @VideoInit(i32 %0) {
%2 = tail call i32 @VideoChangeCore(i32 %0)
ret i32 %2
}
void Printer_Finish(void) {}


x86 assembly (clang, -O0):
<Printer_Finish>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Printer_Finish>:
ret

LLVM IR (-O0):
define void @Printer_Finish() {
ret void
}

LLVM IR (-O2):
define void @Printer_Finish() {
ret void
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
void cvt_d_w(const int32_t *source, double *dest) { *dest = (double)*source; }


x86 assembly (clang, -O0):
<cvt_d_w>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2sdq (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvt_d_w>:
cvtsi2sdq (%rdi),%xmm0
movsd  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @cvt_d_w(i64* %0, double* %1) {
%3 = alloca i64*
%4 = alloca double*
store i64* %0, i64** %3
store double* %1, double** %4
%5 = load i64*, i64** %3
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to double
%8 = load double*, double** %4
store double %7, double* %8
ret void
}

LLVM IR (-O2):
define void @cvt_d_w(i64* nocapture %0, double* nocapture writeonly %1) {
%3 = load i64, i64* %0
%4 = sitofp i64 %3 to double
store double %4, double* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ curr;

/* Variables and functions */
int /*<<< orphan*/ getcwd(char *, int);
const char *root_path() {
  static char curr[1024];
  getcwd(curr, sizeof(curr));
  return curr;
}


x86 assembly (clang, -O0):
<root_path>:
push   %rbp
mov    %rsp,%rbp
lea    0x2f25(%rip),%rdi
mov    $0x400,%esi
call   1030 <getcwd@plt>
lea    0x2f14(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<root_path>:
push   %rbx
lea    0x2f28(%rip),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1030 <getcwd@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@root_path.curr = internal global [1024 x i8] zeroinitializer
define i8* @root_path() {
%1 = call i32 @getcwd(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @root_path.curr, i64 0, i64 0), i32 1024)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @root_path.curr, i64 0, i64 0)
}

LLVM IR (-O2):
@root_path.curr = internal global [1024 x i8] zeroinitializer
define i8* @root_path() {
%1 = tail call i32 @getcwd(i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @root_path.curr, i64 0, i64 0), i32 1024)
ret i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @root_path.curr, i64 0, i64 0)
}
__attribute__((always_)) unsigned int inl(unsigned short port) {
  unsigned int _v;
  asm volatile("in"
               "l"
               " %"
               "w"
               "1,%"
               ""
               "0"
               : "=a"(_v)
               : "Nd"(port));
  return _v;
}


x86 assembly (clang, -O0):
<inl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl>:
mov    %edi,%edx
in     (%dx),%eax
ret

LLVM IR (-O0):
define i32 @inl(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i32 asm sideeffect "inl ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @inl(i16 zeroext %0) {
%2 = tail call i32 asm sideeffect "inl ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exibeMenuAnt(int);
int /*<<< orphan*/ printf(char *);
void menuRaiz(int at) {
  exibeMenuAnt(at);
  printf("ATUAL: RAIZ\n");
}


x86 assembly (clang, -O0):
<menuRaiz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <exibeMenuAnt@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menuRaiz>:
push   %rax
call   1040 <exibeMenuAnt@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"ATUAL: RAIZ\0A\00"
define void @menuRaiz(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @exibeMenuAnt(i32 %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"ATUAL: RAIZ\00"
define void @menuRaiz(i32 %0) {
%2 = tail call i32 @exibeMenuAnt(i32 %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ XGravityEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XGravityEvent(void) {
  XGravityEvent *_p = (XGravityEvent *)malloc(sizeof(XGravityEvent));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XGravityEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XGravityEvent+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XGravityEvent>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XGravityEvent+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XGravityEvent() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XGravityEvent() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void printUsage() {
  printf("Usage: testmemdump <1|2|3|4|5>\n");
  exit(1);
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<printUsage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Usage: testmemdump <1|2|3|4|5>\0A\00"
define void @printUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [31 x i8] c"Usage: testmemdump <1|2|3|4|5>\00"
define void @printUsage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int mount_usage(int ret) {
  printf("\n"
         "Usage: moctl NAME mount {VOLUME|-} MOUNTPOINT [-o FLAGS]\n"
         "	NAME       := mosaic name (path to .mos file)\n"
         "	VOLUME     := volume to mount; \"-\" for the mosaic itself\n"
         "	MOUNTPOINT := directory to mount to\n"
         "	FLAGS      := comma-separated mount flags (such as \"ro\")\n");
  return ret;
}


x86 assembly (clang, -O0):
<mount_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mount_usage>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [259 x i8] c"\0AUsage: moctl NAME mount {VOLUME|-} MOUNTPOINT [-o FLAGS]\0A\09NAME := mosaic name (path to .mos file)\0A\09VOLUME := volume to mount; \22-\22 for the mosaic itself\0A\09MOUNTPOINT := directory to mount to\0A\09FLAGS := comma-separated mount flags (such as \22ro\22)\0A\00"
define i32 @mount_usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
ret i32 %4
}

LLVM IR (-O2):
@str = [258 x i8] c"\0AUsage: moctl NAME mount {VOLUME|-} MOUNTPOINT [-o FLAGS]\0A\09NAME := mosaic name (path to .mos file)\0A\09VOLUME := volume to mount; \22-\22 for the mosaic itself\0A\09MOUNTPOINT := directory to mount to\0A\09FLAGS := comma-separated mount flags (such as \22ro\22)\00"
define i32 @mount_usage(i32 returned %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([258 x i8], [258 x i8]* @str, i64 0, i64 0))
ret i32 %0
}
int item_category_hash(void *key, int M) {
  char *k = (char *)key;
  int h = 0;
  for (; *k != '\0'; k++)
    h = (127 * h + *k) % M;
  return h;
}


x86 assembly (clang, -O0):
<item_category_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114f <item_category_hash+0x4f>
imul   $0x7f,-0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111a <item_category_hash+0x1a>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<item_category_hash>:
mov    (%rdi),%al
test   %al,%al
je     112d <item_category_hash+0x2d>
add    $0x1,%rdi
xor    %edx,%edx
nopl   0x0(%rax)
movsbl %al,%ecx
mov    %edx,%eax
shl    $0x7,%eax
sub    %edx,%eax
add    %ecx,%eax
cltd
idiv   %esi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <item_category_hash+0x10>
mov    %edx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @item_category_hash(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i8*, i8** %3
store i8* %7, i8** %5
store i32 0, i32* %6
br label %8
8: ; preds = %22, %2
%9 = load i8*, i8** %5
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = load i32, i32* %6
%15 = mul nsw i32 127, %14
%16 = load i8*, i8** %5
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = add nsw i32 %15, %18
%20 = load i32, i32* %4
%21 = srem i32 %19, %20
store i32 %21, i32* %6
br label %22
22: ; preds = %13
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %5
br label %8
25: ; preds = %8
%26 = load i32, i32* %6
ret i32 %26
}

LLVM IR (-O2):
define i32 @item_category_hash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %14, %5 ], [ %3, %2 ]
%7 = phi i32 [ %12, %5 ], [ 0, %2 ]
%8 = phi i8* [ %13, %5 ], [ %0, %2 ]
%9 = sext i8 %6 to i32
%10 = mul nsw i32 %7, 127
%11 = add nsw i32 %10, %9
%12 = srem i32 %11, %1
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %2
%17 = phi i32 [ 0, %2 ], [ %12, %5 ]
ret i32 %17
}
int xrdp_bitmap_get_index(struct xrdp_bitmap *self, int *palette, int color) {
  int r = 0;
  int g = 0;
  int b = 0;
  r = (color & 0xff0000) >> 16;
  g = (color & 0x00ff00) >> 8;
  b = (color & 0x0000ff) >> 0;
  r = (r >> 5) << 0;
  g = (g >> 5) << 3;
  b = (b >> 6) << 6;
  return (b | g | r);
}


x86 assembly (clang, -O0):
<xrdp_bitmap_get_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
and    $0xff,%eax
sar    $0x0,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
sar    $0x5,%eax
shl    $0x0,%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
sar    $0x5,%eax
shl    $0x3,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
sar    $0x6,%eax
shl    $0x6,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
or     -0x1c(%rbp),%eax
or     -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrdp_bitmap_get_index>:
mov    %edx,%ecx
shr    $0x15,%ecx
and    $0x7,%ecx
mov    %edx,%eax
shr    $0xa,%eax
and    $0x38,%eax
and    $0xc0,%edx
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
%struct.xrdp_bitmap = type opaque
define i32 @xrdp_bitmap_get_index(%struct.xrdp_bitmap* %0, i32* %1, i32 %2) {
%4 = alloca %struct.xrdp_bitmap*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store %struct.xrdp_bitmap* %0, %struct.xrdp_bitmap** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%10 = load i32, i32* %6
%11 = and i32 %10, 16711680
%12 = ashr i32 %11, 16
store i32 %12, i32* %7
%13 = load i32, i32* %6
%14 = and i32 %13, 65280
%15 = ashr i32 %14, 8
store i32 %15, i32* %8
%16 = load i32, i32* %6
%17 = and i32 %16, 255
%18 = ashr i32 %17, 0
store i32 %18, i32* %9
%19 = load i32, i32* %7
%20 = ashr i32 %19, 5
%21 = shl i32 %20, 0
store i32 %21, i32* %7
%22 = load i32, i32* %8
%23 = ashr i32 %22, 5
%24 = shl i32 %23, 3
store i32 %24, i32* %8
%25 = load i32, i32* %9
%26 = ashr i32 %25, 6
%27 = shl i32 %26, 6
store i32 %27, i32* %9
%28 = load i32, i32* %9
%29 = load i32, i32* %8
%30 = or i32 %28, %29
%31 = load i32, i32* %7
%32 = or i32 %30, %31
ret i32 %32
}

LLVM IR (-O2):
%struct.xrdp_bitmap = type opaque
define i32 @xrdp_bitmap_get_index(%struct.xrdp_bitmap* nocapture readnone %0, i32* nocapture readnone %1, i32 %2) {
%4 = lshr i32 %2, 21
%5 = and i32 %4, 7
%6 = lshr i32 %2, 10
%7 = and i32 %6, 56
%8 = and i32 %2, 192
%9 = or i32 %7, %8
%10 = or i32 %9, %5
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strdup(char *);
void update_string(char **s, char *v) {
  if (*s)
    free(*s);
  if (v)
    *s = strdup(v);
  else
    *s = 0;
}


x86 assembly (clang, -O0):
<update_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114a <update_string+0x2a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x10(%rbp)
je     116d <update_string+0x4d>
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
jmp    1178 <update_string+0x58>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1137 <update_string+0x17>
call   1030 <free@plt>
test   %rbx,%rbx
je     1146 <update_string+0x26>
mov    %rbx,%rdi
call   1040 <strdup@plt>
jmp    1148 <update_string+0x28>
xor    %eax,%eax
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @update_string(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8**, i8*** %3
%6 = load i8*, i8** %5
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = call i32 @free(i8* %10)
br label %12
12: ; preds = %8, %2
%13 = load i8*, i8** %4
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = call i8* @strdup(i8* %16)
%18 = load i8**, i8*** %3
store i8* %17, i8** %18
br label %21
19: ; preds = %12
%20 = load i8**, i8*** %3
store i8* null, i8** %20
br label %21
21: ; preds = %19, %15
ret void
}

LLVM IR (-O2):
define void @update_string(i8** nocapture %0, i8* %1) {
%3 = load i8*, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @free(i8* %3)
br label %7
7: ; preds = %5, %2
%8 = icmp eq i8* %1, null
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i8* @strdup(i8* %1)
br label %11
11: ; preds = %7, %9
%12 = phi i8* [ %10, %9 ], [ null, %7 ]
store i8* %12, i8** %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("A = %i\n", sizeof(doit()));
  goto part2;
part2:
  goto part2;
  switch (2) {
  case 34:
    break;
  default:
    break;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
jmp    1130 <main+0x20>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1130 <main+0x20>

LLVM IR (-O0):
@.str = [8 x i8] c"A = %i\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
br label %3
3: ; preds = %3, %0
br label %3
}

LLVM IR (-O2):
@.str = [8 x i8] c"A = %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
br label %2
2: ; preds = %2, %0
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ error(char const *, char const *);
int /*<<< orphan*/ xexit(int);
void fatal(const char *format, const char *arg) {
  error(format, arg);
  xexit(1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <error@plt>
mov    $0x1,%edi
call   1040 <xexit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fatal>:
push   %rax
call   1030 <error@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <xexit@plt>

LLVM IR (-O0):
define void @fatal(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @error(i8* %5, i8* %6)
%8 = call i32 @xexit(i32 1)
ret void
}

LLVM IR (-O2):
define void @fatal(i8* %0, i8* %1) {
%3 = tail call i32 @error(i8* %0, i8* %1)
%4 = tail call i32 @xexit(i32 1)
ret void
}
void free_strings(char **strings) {
  int i;
  for (i = 0; strings[i]; i++)
    free(strings[i]);
  free(strings);
}


x86 assembly (clang, -O0):
<free_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1155 <free_strings+0x45>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <free_strings+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_strings>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <free_strings+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <free_strings+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_strings(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %17, %1
%5 = load i8**, i8*** %2
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %5, i64 %7
%9 = load i8*, i8** %8
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %20
11: ; preds = %4
%12 = load i8**, i8*** %2
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
br label %17
17: ; preds = %11
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %4
20: ; preds = %4
%21 = load i8**, i8*** %2
%22 = bitcast i8** %21 to i8*
ret void
}

LLVM IR (-O2):
define void @free_strings(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %2, %1 ]
tail call void @free(i8* %6)
%7 = add nuw nsw i64 %5, 1
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = bitcast i8** %0 to i8*
tail call void @free(i8* %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void Init_Language(void) { abort(); }


x86 assembly (clang, -O0):
<Init_Language>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<Init_Language>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @Init_Language() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @Init_Language() {
%1 = tail call i32 (...) @abort()
unreachable
}
void ft_strclr(char *s) {
  while (*s)
    *s++ = '\0';
}


x86 assembly (clang, -O0):
<ft_strclr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     112c <ft_strclr+0x2c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0x0,(%rax)
jmp    1108 <ft_strclr+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strclr>:
cmpb   $0x0,(%rdi)
je     111d <ft_strclr+0x1d>
add    $0x1,%rdi
nopl   0x0(%rax)
movb   $0x0,-0x1(%rdi)
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <ft_strclr+0x10>
ret

LLVM IR (-O0):
define void @ft_strclr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
store i8 0, i8* %8
br label %3
10: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @ft_strclr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %0, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8 0, i8* %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %1
ret void
}
/* Variables and functions */
int maj_elem(int /*<<< orphan*/ *, int /*<<< orphan*/);
int test_empty_array() { return -1 == maj_elem(NULL, 0); }


x86 assembly (clang, -O0):
<test_empty_array>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
call   1030 <maj_elem@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_empty_array>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <maj_elem@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test_empty_array() {
%1 = call i32 @maj_elem(i32* null, i32 0)
%2 = icmp eq i32 -1, %1
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @test_empty_array() {
%1 = tail call i32 @maj_elem(i32* null, i32 0)
%2 = icmp eq i32 %1, -1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
char *ft_strcpy(char *, char const *);
int ft_strlen(char const *);
scalar_t__ malloc(int);
char *ft_strdup(const char *src) {
  char *dest;
  dest = NULL;
  if ((dest = (char *)malloc(sizeof(char) * (ft_strlen(src) + 1))) == NULL)
    return (NULL);
  return (ft_strcpy(dest, src));
}


x86 assembly (clang, -O0):
<ft_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <ft_strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1178 <ft_strdup+0x48>
movq   $0x0,-0x8(%rbp)
jmp    1189 <ft_strdup+0x59>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <ft_strcpy@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <ft_strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     1152 <ft_strdup+0x22>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <ft_strcpy@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @ft_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* null, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @ft_strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = mul i64 1, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %4
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %1
store i8* null, i8** %2
br label %19
15: ; preds = %1
%16 = load i8*, i8** %4
%17 = load i8*, i8** %3
%18 = call i8* @ft_strcpy(i8* %16, i8* %17)
store i8* %18, i8** %2
br label %19
19: ; preds = %15, %14
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
define i8* @ft_strdup(i8* %0) {
%2 = tail call i32 @ft_strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = inttoptr i64 %4 to i8*
%8 = tail call i8* @ft_strcpy(i8* %7, i8* %0)
br label %9
9: ; preds = %1, %6
%10 = phi i8* [ %8, %6 ], [ null, %1 ]
ret i8* %10
}
void test45_Q_cycle__E() {}


x86 assembly (clang, -O0):
<test45_Q_cycle__E>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test45_Q_cycle__E>:
ret

LLVM IR (-O0):
define void @test45_Q_cycle__E() {
ret void
}

LLVM IR (-O2):
define void @test45_Q_cycle__E() {
ret void
}
/* Type definitions */
struct ttyent {
  int ty_status;
};

/* Variables and functions */
struct ttyent *getttynam(char const *);
int isttystat(const char *tty, int flag) {
  struct ttyent *t;
  return ((t = getttynam(tty)) == NULL) ? 0 : !!(t->ty_status & flag);
}


x86 assembly (clang, -O0):
<isttystat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getttynam@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1140 <isttystat+0x30>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <isttystat+0x4b>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isttystat>:
push   %rbx
mov    %esi,%ebx
call   1030 <getttynam@plt>
test   %rax,%rax
je     1129 <isttystat+0x19>
mov    %rax,%rcx
xor    %eax,%eax
test   %ebx,(%rcx)
setne  %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ttyent = type { i32 }
define i32 @isttystat(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.ttyent*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call %struct.ttyent* @getttynam(i8* %6)
store %struct.ttyent* %7, %struct.ttyent** %5
%8 = icmp eq %struct.ttyent* %7, null
br i1 %8, label %9, label %10
9: ; preds = %2
br label %20
10: ; preds = %2
%11 = load %struct.ttyent*, %struct.ttyent** %5
%12 = getelementptr inbounds %struct.ttyent, %struct.ttyent* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load i32, i32* %4
%15 = and i32 %13, %14
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %10, %9
%21 = phi i32 [ 0, %9 ], [ %19, %10 ]
ret i32 %21
}

LLVM IR (-O2):
%struct.ttyent = type { i32 }
define i32 @isttystat(i8* %0, i32 %1) {
%3 = tail call %struct.ttyent* @getttynam(i8* %0)
%4 = icmp eq %struct.ttyent* %3, null
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = getelementptr inbounds %struct.ttyent, %struct.ttyent* %3, i64 0, i32 0
%7 = load i32, i32* %6
%8 = and i32 %7, %1
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %2, %5
%12 = phi i32 [ %10, %5 ], [ 0, %2 ]
ret i32 %12
}
/* Variables and functions */
int pathcon_nm6_f0(double const **, double **, int *, double *, int);
int pathcon_nm6(const double **arg, double **res, int *iw, double *w, int mem) {
  return pathcon_nm6_f0(arg, res, iw, w, mem);
}


x86 assembly (clang, -O0):
<pathcon_nm6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
call   1030 <pathcon_nm6_f0@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathcon_nm6>:
jmp    1030 <pathcon_nm6_f0@plt>

LLVM IR (-O0):
define i32 @pathcon_nm6(double** %0, double** %1, i32* %2, double* %3, i32 %4) {
%6 = alloca double**
%7 = alloca double**
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i32
store double** %0, double*** %6
store double** %1, double*** %7
store i32* %2, i32** %8
store double* %3, double** %9
store i32 %4, i32* %10
%11 = load double**, double*** %6
%12 = load double**, double*** %7
%13 = load i32*, i32** %8
%14 = load double*, double** %9
%15 = load i32, i32* %10
%16 = call i32 @pathcon_nm6_f0(double** %11, double** %12, i32* %13, double* %14, i32 %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @pathcon_nm6(double** %0, double** %1, i32* %2, double* %3, i32 %4) {
%6 = tail call i32 @pathcon_nm6_f0(double** %0, double** %1, i32* %2, double* %3, i32 %4)
ret i32 %6
}
/* Type definitions */
struct tsd_pidfh {
  int dummy;
};

/* Variables and functions */
int _tsd_pidfile_remove(struct tsd_pidfh *, int);
int tsd_pidfile_remove(struct tsd_pidfh *pfh) {
  return (_tsd_pidfile_remove(pfh, 1));
}


x86 assembly (clang, -O0):
<tsd_pidfile_remove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <_tsd_pidfile_remove@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsd_pidfile_remove>:
mov    $0x1,%esi
jmp    1030 <_tsd_pidfile_remove@plt>

LLVM IR (-O0):
%struct.tsd_pidfh = type { i32 }
define i32 @tsd_pidfile_remove(%struct.tsd_pidfh* %0) {
%2 = alloca %struct.tsd_pidfh*
store %struct.tsd_pidfh* %0, %struct.tsd_pidfh** %2
%3 = load %struct.tsd_pidfh*, %struct.tsd_pidfh** %2
%4 = call i32 @_tsd_pidfile_remove(%struct.tsd_pidfh* %3, i32 1)
ret i32 %4
}

LLVM IR (-O2):
%struct.tsd_pidfh = type { i32 }
define i32 @tsd_pidfile_remove(%struct.tsd_pidfh* %0) {
%2 = tail call i32 @_tsd_pidfile_remove(%struct.tsd_pidfh* %0, i32 1)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ UDF_INIT;

/* Variables and functions */
void jfgetint_deinit(UDF_INIT *initid) { return; }


x86 assembly (clang, -O0):
<jfgetint_deinit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<jfgetint_deinit>:
ret

LLVM IR (-O0):
define void @jfgetint_deinit(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
ret void
}

LLVM IR (-O2):
define void @jfgetint_deinit(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int get_nz() {
  int nz_get;
  printf("\nProton Count?\n\n");
  scanf("%d", &nz_get);
  return (nz_get);
}


x86 assembly (clang, -O0):
<get_nz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_nz>:
push   %rax
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0AProton Count?\0A\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @get_nz() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [16 x i8] c"\0AProton Count?\0A\00"
define i32 @get_nz() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *malloc(size_t a_size) { printf("Do not come (static)\n"); }


x86 assembly (clang, -O0):
<malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Do not come (static)\0A\00"
define i8* @malloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
store i64 %0, i64* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
@str = [21 x i8] c"Do not come (static)\00"
define noalias i8* @malloc(i64 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void hello(void) {
  putchar('H');
  putchar('e');
  putchar('l');
  putchar('l');
  putchar('o');
  putchar(' ');
  putchar('w');
  putchar('o');
  putchar('r');
  putchar('l');
  putchar('d');
  putchar('.');
  putchar('\n');
}


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
mov    $0x48,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x77,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello>:
push   %rax
mov    $0x48,%edi
call   1030 <putchar@plt>
mov    $0x65,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x77,%edi
call   1030 <putchar@plt>
mov    $0x6f,%edi
call   1030 <putchar@plt>
mov    $0x72,%edi
call   1030 <putchar@plt>
mov    $0x6c,%edi
call   1030 <putchar@plt>
mov    $0x64,%edi
call   1030 <putchar@plt>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @hello() {
%1 = call i32 @putchar(i8 signext 72)
%2 = call i32 @putchar(i8 signext 101)
%3 = call i32 @putchar(i8 signext 108)
%4 = call i32 @putchar(i8 signext 108)
%5 = call i32 @putchar(i8 signext 111)
%6 = call i32 @putchar(i8 signext 32)
%7 = call i32 @putchar(i8 signext 119)
%8 = call i32 @putchar(i8 signext 111)
%9 = call i32 @putchar(i8 signext 114)
%10 = call i32 @putchar(i8 signext 108)
%11 = call i32 @putchar(i8 signext 100)
%12 = call i32 @putchar(i8 signext 46)
%13 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @hello() {
%1 = tail call i32 @putchar(i8 signext 72)
%2 = tail call i32 @putchar(i8 signext 101)
%3 = tail call i32 @putchar(i8 signext 108)
%4 = tail call i32 @putchar(i8 signext 108)
%5 = tail call i32 @putchar(i8 signext 111)
%6 = tail call i32 @putchar(i8 signext 32)
%7 = tail call i32 @putchar(i8 signext 119)
%8 = tail call i32 @putchar(i8 signext 111)
%9 = tail call i32 @putchar(i8 signext 114)
%10 = tail call i32 @putchar(i8 signext 108)
%11 = tail call i32 @putchar(i8 signext 100)
%12 = tail call i32 @putchar(i8 signext 46)
%13 = tail call i32 @putchar(i8 signext 10)
ret void
}
int lw_sock_recv_buffer_ex(int sock, char *buffer, int len) { return 0; }


x86 assembly (clang, -O0):
<lw_sock_recv_buffer_ex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lw_sock_recv_buffer_ex>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @lw_sock_recv_buffer_ex(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @lw_sock_recv_buffer_ex(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int f164(int *);
int f165(int *p) { return f164(p); }


x86 assembly (clang, -O0):
<f165>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <f164@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f165>:
jmp    1030 <f164@plt>

LLVM IR (-O0):
define i32 @f165(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @f164(i32* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @f165(i32* %0) {
%2 = tail call i32 @f164(i32* %0)
ret i32 %2
}
void INT_Excep_IRQ9(void) {}


x86 assembly (clang, -O0):
<INT_Excep_IRQ9>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<INT_Excep_IRQ9>:
ret

LLVM IR (-O0):
define void @INT_Excep_IRQ9() {
ret void
}

LLVM IR (-O2):
define void @INT_Excep_IRQ9() {
ret void
}
char my_char_num(char chr) {
  if ((chr >= 48) && (chr <= 57))
    return (chr);
  return ('R');
}


x86 assembly (clang, -O0):
<my_char_num>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jl     112f <my_char_num+0x2f>
movsbl -0x2(%rbp),%eax
cmp    $0x39,%eax
jg     112f <my_char_num+0x2f>
mov    -0x2(%rbp),%al
mov    %al,-0x1(%rbp)
jmp    1133 <my_char_num+0x33>
movb   $0x52,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_char_num>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
mov    $0x52,%eax
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @my_char_num(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = load i8, i8* %3
store i8 %12, i8* %2
br label %14
13: ; preds = %7, %1
store i8 82, i8* %2
br label %14
14: ; preds = %13, %11
%15 = load i8, i8* %2
ret i8 %15
}

LLVM IR (-O2):
define signext i8 @my_char_num(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = select i1 %3, i8 %0, i8 82
ret i8 %4
}
/* Type definitions */
typedef int dataLen;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int ILibAlignOnFourByteBoundary(char *data, int dataLen) {
  int retVal = ((dataLen) + ((4 - ((dataLen) % 4)) % 4));
  if (retVal - dataLen > 0) {
    memset(data + dataLen, 0, retVal - dataLen);
  }
  return (retVal);
}


x86 assembly (clang, -O0):
<ILibAlignOnFourByteBoundary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x4,%eax
sub    %edx,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x0,%eax
jle    116e <ILibAlignOnFourByteBoundary+0x5e>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%edx
sub    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ILibAlignOnFourByteBoundary>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %esi,%ebp
neg    %ebp
and    $0x3,%ebp
je     112d <ILibAlignOnFourByteBoundary+0x1d>
movslq %ebx,%rax
add    %rax,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
add    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ILibAlignOnFourByteBoundary(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = srem i32 %7, 4
%9 = sub nsw i32 4, %8
%10 = srem i32 %9, 4
%11 = add nsw i32 %6, %10
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = sub nsw i32 %12, %13
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i32, i32* %5
%22 = load i32, i32* %4
%23 = sub nsw i32 %21, %22
%24 = call i32 @memset(i8* %20, i32 0, i32 %23)
br label %25
25: ; preds = %16, %2
%26 = load i32, i32* %5
ret i32 %26
}

LLVM IR (-O2):
define i32 @ILibAlignOnFourByteBoundary(i8* %0, i32 %1) {
%3 = sub i32 0, %1
%4 = and i32 %3, 3
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %2
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = tail call i32 @memset(i8* %8, i32 0, i32 %4)
br label %10
10: ; preds = %6, %2
%11 = add nsw i32 %4, %1
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ _panic(char *);
void sys_iopl(void) { _panic("sys_iopl"); }


x86 assembly (clang, -O0):
<sys_iopl>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <_panic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_iopl>:
lea    0xee9(%rip),%rdi
jmp    1030 <_panic@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"sys_iopl\00"
define void @sys_iopl() {
%1 = call i32 @_panic(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"sys_iopl\00"
define void @sys_iopl() {
%1 = tail call i32 @_panic(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argv, char *argc[]) {
  printf("\n\nThank you for coming to the playground. May the bits be with "
         "you.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [69 x i8] c"\0A\0AThank you for coming to the playground. May the bits be with you.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [68 x i8] c"\0A\0AThank you for coming to the playground. May the bits be with you.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double getnow() {
  struct timeval now;
  gettimeofday(&now, NULL);
  return now.tv_sec + (now.tv_usec / 1000000.0);
}


x86 assembly (clang, -O0):
<getnow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xec9(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getnow>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
divsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @getnow() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = fdiv double %6, 1.000000e+06
%8 = fadd double %4, %7
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @getnow() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %5, %8
ret double %9
}
unsigned int IntRawStatusGet(unsigned int intrNum) {
  return ((0 == (((*((volatile unsigned int *)((0x48200000) +
                                               (0x80 + ((intrNum >> (0x05)) *
                                                        0x20))))) >>
                  (intrNum & (0x1F))) &
                 0x01))
              ? 0
              : 1);
}


x86 assembly (clang, -O0):
<IntRawStatusGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x5,%eax
shl    $0x5,%eax
add    $0x80,%eax
add    $0x48200000,%eax
mov    %eax,%eax
mov    (%rax),%edx
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
shr    %cl,%edx
and    $0x1,%edx
xor    %ecx,%ecx
mov    $0x1,%eax
cmp    %edx,%ecx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IntRawStatusGet>:
mov    %edi,%ecx
lea    0x48200080(%rcx),%eax
and    $0xffffffe0,%eax
mov    (%rax),%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @IntRawStatusGet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 5
%5 = mul i32 %4, 32
%6 = add i32 128, %5
%7 = add i32 1210056704, %6
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = load i32, i32* %2
%12 = and i32 %11, 31
%13 = lshr i32 %10, %12
%14 = and i32 %13, 1
%15 = icmp eq i32 0, %14
%16 = zext i1 %15 to i64
%17 = select i1 %15, i32 0, i32 1
ret i32 %17
}

LLVM IR (-O2):
define i32 @IntRawStatusGet(i32 %0) {
%2 = add i32 %0, 1210056832
%3 = and i32 %2, -32
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load volatile i32, i32* %5
%7 = and i32 %0, 31
%8 = lshr i32 %6, %7
%9 = and i32 %8, 1
ret i32 %9
}