xunge/DecIR huggingface dataset:
void cprop_test12(int *data) {
  int j = data[0];
  if (j == 5)
    j = j * 21 + 25 / j;
  data[1] = j;
}


x86 assembly (clang, -O0):
<cprop_test12>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jne    1135 <cprop_test12+0x35>
imul   $0x15,-0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x19,%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cprop_test12>:
mov    (%rdi),%eax
cmp    $0x5,%eax
mov    $0x6e,%ecx
cmovne %eax,%ecx
mov    %ecx,0x4(%rdi)
ret

LLVM IR (-O0):
define void @cprop_test12(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 5
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load i32, i32* %3
%11 = mul nsw i32 %10, 21
%12 = load i32, i32* %3
%13 = sdiv i32 25, %12
%14 = add nsw i32 %11, %13
store i32 %14, i32* %3
br label %15
15: ; preds = %9, %1
%16 = load i32, i32* %3
%17 = load i32*, i32** %2
%18 = getelementptr inbounds i32, i32* %17, i64 1
store i32 %16, i32* %18
ret void
}

LLVM IR (-O2):
define void @cprop_test12(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 5
%4 = select i1 %3, i32 110, i32 %2
%5 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %4, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: %s [-v specification] variable_name [pathname]\n",
          "foo");
  fprintf(stderr, "       %s -a [pathname]\n", "foo");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xefc(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeeb(%rip),%rsi
lea    0xee0(%rip),%rdx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
lea    0xefc(%rip),%r14
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeef(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [55 x i8] c"Usage: %s [-v specification] variable_name [pathname]\0A\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [25 x i8] c" %s -a [pathname]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [55 x i8] c"Usage: %s [-v specification] variable_name [pathname]\0A\00"
@.str.1 = [4 x i8] c"foo\00"
@.str.2 = [25 x i8] c" %s -a [pathname]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 2)
unreachable
}
/* Variables and functions */
scalar_t__ Emmc_doDataCommand(char *, int /*<<< orphan*/, unsigned int,
                              unsigned int);
scalar_t__ Emmc_ensureDataMode();
int Emmc_ReadBlock(char *buf, unsigned int buflen, unsigned int block_number) {
  if (Emmc_ensureDataMode() != 0)
    return -1;
  if (Emmc_doDataCommand(buf, 0, buflen, block_number) < 0)
    return -1;
  return buflen;
}


x86 assembly (clang, -O0):
<Emmc_ReadBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <Emmc_ensureDataMode@plt>
cmp    $0x0,%rax
je     114f <Emmc_ReadBlock+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <Emmc_ReadBlock+0x5c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
xor    %esi,%esi
call   1040 <Emmc_doDataCommand@plt>
cmp    $0x0,%rax
jge    1176 <Emmc_ReadBlock+0x56>
movl   $0xffffffff,-0x4(%rbp)
jmp    117c <Emmc_ReadBlock+0x5c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Emmc_ReadBlock>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebx
mov    %rdi,%rbp
xor    %eax,%eax
call   1030 <Emmc_ensureDataMode@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    115a <Emmc_ReadBlock+0x3a>
mov    %rbp,%rdi
xor    %esi,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
call   1040 <Emmc_doDataCommand@plt>
test   %rax,%rax
mov    $0xffffffff,%eax
cmovns %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @Emmc_ReadBlock(i8* %0, i32 %1, i32 %2) {
%4 = tail call i64 (...) @Emmc_ensureDataMode()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 @Emmc_doDataCommand(i8* %0, i32 0, i32 %1, i32 %2)
%8 = icmp slt i64 %7, 0
%9 = select i1 %8, i32 -1, i32 %1
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ -1, %3 ], [ %9, %6 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void md_par_end(FILE *fw, int term) {
  switch (term) {
  case 0:
    fprintf(fw, "\n");
    break;
  case 1:
    fprintf(fw, "</p>\n");
    break;
  case 2:
    fprintf(fw, "\n");
    break;
  }
}


x86 assembly (clang, -O0):
<md_par_end>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1154 <md_par_end+0x44>
jmp    1132 <md_par_end+0x22>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1169 <md_par_end+0x59>
jmp    1143 <md_par_end+0x33>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     117e <md_par_end+0x6e>
jmp    118e <md_par_end+0x7e>
mov    -0x8(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1030 <fprintf@plt>
jmp    118e <md_par_end+0x7e>
mov    -0x8(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1030 <fprintf@plt>
jmp    118e <md_par_end+0x7e>
mov    -0x8(%rbp),%rdi
lea    0xe7b(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<md_par_end>:
mov    %rdi,%rcx
cmp    $0x2,%esi
je     1131 <md_par_end+0x11>
cmp    $0x1,%esi
je     113e <md_par_end+0x1e>
test   %esi,%esi
jne    1154 <md_par_end+0x34>
mov    $0xa,%edi
mov    %rcx,%rsi
jmp    1030 <fputc@plt>
lea    0xebb(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
jmp    1040 <fwrite@plt>
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [6 x i8] c"</p>\0A\00"
define void @md_par_end(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %15 [
i32 0, label %6
i32 1, label %9
i32 2, label %12
]
6: ; preds = %2
%7 = load i32*, i32** %3
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %15
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %15
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %2, %12, %9, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"</p>\0A\00"
define void @md_par_end(i32* nocapture %0, i32 %1) {
switch i32 %1, label %9 [
i32 0, label %3
i32 1, label %5
i32 2, label %7
]
3: ; preds = %2
%4 = tail call i32 @fputc(i32 10, i32* %0)
br label %9
5: ; preds = %2
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 5, i64 1, i32* %0)
br label %9
7: ; preds = %2
%8 = tail call i32 @fputc(i32 10, i32* %0)
br label %9
9: ; preds = %2, %7, %5, %3
ret void
}
/* Variables and functions */
int echo(int);
int nonzerotest(int a) {
  int retval;
  if (a != 0)
    retval = echo(0);
  else
    retval = echo(1);
  return retval;
}


x86 assembly (clang, -O0):
<nonzerotest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1134 <nonzerotest+0x24>
xor    %edi,%edi
call   1030 <echo@plt>
mov    %eax,-0x8(%rbp)
jmp    1141 <nonzerotest+0x31>
mov    $0x1,%edi
call   1030 <echo@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nonzerotest>:
xor    %eax,%eax
test   %edi,%edi
sete   %al
mov    %eax,%edi
jmp    1030 <echo@plt>

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

LLVM IR (-O2):
define i32 @nonzerotest(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @echo(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ rst(int);
void op0xC7(void) { rst(0x00); }


x86 assembly (clang, -O0):
<op0xC7>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <rst@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op0xC7>:
xor    %edi,%edi
jmp    1030 <rst@plt>

LLVM IR (-O0):
define void @op0xC7() {
%1 = call i32 @rst(i32 0)
ret void
}

LLVM IR (-O2):
define void @op0xC7() {
%1 = tail call i32 @rst(i32 0)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ int_disable();
int /*<<< orphan*/ int_enable_hlt_disable();
int read_byte(int, int);
uint8_t floppy_wait_for_interrupt(void) {
  int_disable();
  for (;;) {
    uint8_t val8 = read_byte(0x0040, 0x003e);
    if (val8 & 0x80)
      return val8 & ~0x7f;
    int_enable_hlt_disable();
  }
}


x86 assembly (clang, -O0):
<floppy_wait_for_interrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <int_disable@plt>
mov    $0x40,%edi
mov    $0x3e,%esi
call   1030 <read_byte@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     116e <floppy_wait_for_interrupt+0x3e>
mov    -0x4(%rbp),%eax
and    $0xffffff80,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    $0x0,%al
call   1040 <int_enable_hlt_disable@plt>
jmp    113f <floppy_wait_for_interrupt+0xf>

x86 assembly (clang, -O2):
<floppy_wait_for_interrupt>:
push   %rax
xor    %eax,%eax
call   1050 <int_disable@plt>
nopl   0x0(%rax,%rax,1)
mov    $0x40,%edi
mov    $0x3e,%esi
call   1030 <read_byte@plt>
test   $0x80,%al
jne    115c <floppy_wait_for_interrupt+0x2c>
xor    %eax,%eax
call   1040 <int_enable_hlt_disable@plt>
jmp    1140 <floppy_wait_for_interrupt+0x10>
and    $0xffffff80,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @floppy_wait_for_interrupt() {
%1 = alloca i32
%2 = call i32 (...) @int_disable()
br label %3
3: ; preds = %11, %0
%4 = call i32 @read_byte(i32 64, i32 62)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = and i32 %5, 128
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i32, i32* %1
%10 = and i32 %9, -128
ret i32 %10
11: ; preds = %3
%12 = call i32 (...) @int_enable_hlt_disable()
br label %3
}

LLVM IR (-O2):
define i32 @floppy_wait_for_interrupt() {
%1 = tail call i32 (...) @int_disable()
%2 = tail call i32 @read_byte(i32 64, i32 62)
%3 = and i32 %2, 128
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = tail call i32 (...) @int_enable_hlt_disable()
%7 = tail call i32 @read_byte(i32 64, i32 62)
%8 = and i32 %7, 128
%9 = icmp eq i32 %8, 0
br i1 %9, label %5, label %10
10: ; preds = %5, %0
%11 = phi i32 [ %2, %0 ], [ %7, %5 ]
%12 = and i32 %11, -128
ret i32 %12
}
void RTAvlUIntPtrDestroy(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlUIntPtrDestroy() {
ret void
}
int getYFromQueue(int index) { return ((index / 6) * (700 / 6)) + 150; }


x86 assembly (clang, -O0):
<getYFromQueue>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
imul   $0x74,%eax,%eax
add    $0x96,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getYFromQueue>:
movslq %edi,%rax
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
imul   $0x74,%eax,%eax
add    $0x96,%eax
ret

LLVM IR (-O0):
define i32 @getYFromQueue(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 6
%5 = mul nsw i32 %4, 116
%6 = add nsw i32 %5, 150
ret i32 %6
}

LLVM IR (-O2):
define i32 @getYFromQueue(i32 %0) {
%2 = sdiv i32 %0, 6
%3 = mul nsw i32 %2, 116
%4 = add nsw i32 %3, 150
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ buffer_pipemsg_send(unsigned int, int /*<<< orphan*/,
                                       int /*<<< orphan*/ *);
void buffer_response_cmd(unsigned int msgId) {
  buffer_pipemsg_send(msgId, 0, NULL);
}


x86 assembly (clang, -O0):
<buffer_response_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <buffer_pipemsg_send@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_response_cmd>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <buffer_pipemsg_send@plt>

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

LLVM IR (-O2):
define void @buffer_response_cmd(i32 %0) {
%2 = tail call i32 @buffer_pipemsg_send(i32 %0, i32 0, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void welcome() {
  printf("****************************");
  printf("*  Guess the magic number  *");
  printf("*  Hint: 0-1000            *");
  printf("****************************");
}


x86 assembly (clang, -O0):
<welcome>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<welcome>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"****************************\00"
@.str.1 = [29 x i8] c"* Guess the magic number *\00"
@.str.2 = [29 x i8] c"* Hint: 0-1000 *\00"
define void @welcome() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"****************************\00"
@.str.1 = [29 x i8] c"* Guess the magic number *\00"
@.str.2 = [29 x i8] c"* Hint: 0-1000 *\00"
define void @welcome() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ iswordpart(char const);
char *ustrdup2(char const *, char const *);
char *word_dup(const char *s) {
  const char *start = s;
  while (iswordpart(*s))
    s++;
  return ustrdup2(start, s);
}


x86 assembly (clang, -O0):
<word_dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <iswordpart@plt>
cmp    $0x0,%rax
je     115b <word_dup+0x3b>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1134 <word_dup+0x14>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <ustrdup2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<word_dup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    -0x1(%rdi),%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <iswordpart@plt>
test   %rax,%rax
jne    1130 <word_dup+0x10>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <ustrdup2@plt>

LLVM IR (-O0):
define i8* @word_dup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %10, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = call i64 @iswordpart(i8 signext %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
br label %5
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = call i8* @ustrdup2(i8* %14, i8* %15)
ret i8* %16
}

LLVM IR (-O2):
define i8* @word_dup(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @iswordpart(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = tail call i8* @ustrdup2(i8* %0, i8* %3)
ret i8* %9
}
int ucwidth_(int c) { return 1; }


x86 assembly (clang, -O0):
<ucwidth_>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ucwidth_>:
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @ucwidth_(i32 %0) {
ret i32 1
}
void outw(unsigned short _port, unsigned short _data) {
  asm volatile("outw %0, %1" : : "a"(_data), "Nd"(_port));
}


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x4(%rbp),%ax
mov    -0x2(%rbp),%dx
out    %ax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outw>:
mov    %esi,%eax
mov    %edi,%edx
out    %ax,(%dx)
ret

LLVM IR (-O0):
define void @outw(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load i16, i16* %3
ret void
}

LLVM IR (-O2):
define void @outw(i16 zeroext %0, i16 zeroext %1) {
tail call void asm sideeffect "outw $0, $1", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %1, i16 %0)
ret void
}
void D_Patch(void) {}


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

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

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

LLVM IR (-O2):
define void @D_Patch() {
ret void
}
int not_a_zlib_function(void) { return 42; }


x86 assembly (clang, -O0):
<not_a_zlib_function>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2a,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<not_a_zlib_function>:
mov    $0x2a,%eax
ret

LLVM IR (-O0):
define i32 @not_a_zlib_function() {
ret i32 42
}

LLVM IR (-O2):
define i32 @not_a_zlib_function() {
ret i32 42
}
/* Variables and functions */
int /*<<< orphan*/ SortInts2(int *, int *, int /*<<< orphan*/, int, int);
void SortInts(int *item, int *assoc, int count, int descendingOrder) {
  SortInts2(item, assoc, 0, count - 1, descendingOrder);
}


x86 assembly (clang, -O0):
<SortInts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%r8d
xor    %edx,%edx
call   1030 <SortInts2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SortInts>:
mov    %ecx,%r8d
lea    -0x1(%rdx),%ecx
xor    %edx,%edx
jmp    1030 <SortInts2@plt>

LLVM IR (-O0):
define void @SortInts(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32*, i32** %6
%11 = load i32, i32* %7
%12 = sub nsw i32 %11, 1
%13 = load i32, i32* %8
%14 = call i32 @SortInts2(i32* %9, i32* %10, i32 0, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
define void @SortInts(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = add nsw i32 %2, -1
%6 = tail call i32 @SortInts2(i32* %0, i32* %1, i32 0, i32 %5, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ output_string(char *);
gen_def_word() { output_string("\t.word\t"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"\09.word\09\00"
define i32 @gen_def_word() {
%1 = alloca i32
%2 = call i32 @output_string(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [8 x i8] c"\09.word\09\00"
define i32 @gen_def_word() {
%1 = tail call i32 @output_string(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int Calc_OperatorWeigh(char);
int Calc_GetOperatorPriority(char operator1, char operator2) {
  return Calc_OperatorWeigh(operator1) - Calc_OperatorWeigh(operator2);
}


x86 assembly (clang, -O0):
<Calc_GetOperatorPriority>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <Calc_OperatorWeigh@plt>
mov    %eax,-0x8(%rbp)
movsbl -0x2(%rbp),%edi
call   1030 <Calc_OperatorWeigh@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Calc_GetOperatorPriority>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1030 <Calc_OperatorWeigh@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <Calc_OperatorWeigh@plt>
sub    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @Calc_GetOperatorPriority(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = call i32 @Calc_OperatorWeigh(i8 signext %5)
%7 = load i8, i8* %4
%8 = call i32 @Calc_OperatorWeigh(i8 signext %7)
%9 = sub nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @Calc_GetOperatorPriority(i8 signext %0, i8 signext %1) {
%3 = tail call i32 @Calc_OperatorWeigh(i8 signext %0)
%4 = tail call i32 @Calc_OperatorWeigh(i8 signext %1)
%5 = sub nsw i32 %3, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int /*<<< orphan*/ waddch(int /*<<< orphan*/ *, char);
int /*<<< orphan*/ wmove(int /*<<< orphan*/ *, int, int);
void display_N_spaces(WINDOW *w, int row, int col, int N) {
  int i;
  wmove(w, row, col);
  for (i = 0; i < N; i++)
    waddch(w, ' ');
}


x86 assembly (clang, -O0):
<display_N_spaces>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <wmove@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1173 <display_N_spaces+0x53>
mov    -0x8(%rbp),%rdi
mov    $0x20,%esi
call   1030 <waddch@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114b <display_N_spaces+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_N_spaces>:
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %rdi,%r14
call   1040 <wmove@plt>
test   %ebx,%ebx
jle    1152 <display_N_spaces+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    $0x20,%esi
call   1030 <waddch@plt>
add    $0xffffffff,%ebx
jne    1140 <display_N_spaces+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @display_N_spaces(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = call i32 @wmove(i32* %10, i32 %11, i32 %12)
store i32 0, i32* %9
br label %14
14: ; preds = %21, %4
%15 = load i32, i32* %9
%16 = load i32, i32* %8
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i32*, i32** %5
%20 = call i32 @waddch(i32* %19, i8 signext 32)
br label %21
21: ; preds = %18
%22 = load i32, i32* %9
%23 = add nsw i32 %22, 1
store i32 %23, i32* %9
br label %14
24: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @display_N_spaces(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @wmove(i32* %0, i32 %1, i32 %2)
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %12
7: ; preds = %4, %7
%8 = phi i32 [ %10, %7 ], [ 0, %4 ]
%9 = tail call i32 @waddch(i32* %0, i8 signext 32)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, %3
br i1 %11, label %12, label %7
12: ; preds = %7, %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void cpy8(void *a, const void *b) { *(uint64_t *)a = *(uint64_t *)b; }


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

x86 assembly (clang, -O2):
<cpy8>:
mov    (%rsi),%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @cpy8(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
store i32 %7, i32* %9
ret void
}

LLVM IR (-O2):
define void @cpy8(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %0 to i32*
store i32 %4, i32* %5
ret void
}
double GridMap(double x, int nx) {
  double xi;
  return x;
}


x86 assembly (clang, -O0):
<GridMap>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @GridMap(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @GridMap(double returned %0, i32 %1) {
ret double %0
}
void wpa_supplicant_dbus_ctrl_iface_deinit(struct ctrl_iface_dbus_priv *iface) {
}


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

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

LLVM IR (-O0):
%struct.ctrl_iface_dbus_priv = type opaque
define void @wpa_supplicant_dbus_ctrl_iface_deinit(%struct.ctrl_iface_dbus_priv* %0) {
%2 = alloca %struct.ctrl_iface_dbus_priv*
store %struct.ctrl_iface_dbus_priv* %0, %struct.ctrl_iface_dbus_priv** %2
ret void
}

LLVM IR (-O2):
%struct.ctrl_iface_dbus_priv = type opaque
define void @wpa_supplicant_dbus_ctrl_iface_deinit(%struct.ctrl_iface_dbus_priv* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void irmo_alloc_fail(size_t bytes) {
  if (bytes > 0) {
    fprintf(stderr, "irmo_alloc_fail: Failed on allocation of %u bytes\n",
            bytes);
  } else {
    fprintf(stderr, "irmo_alloc_fail: Out of memory error\n");
  }
  abort();
}


x86 assembly (clang, -O0):
<irmo_alloc_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jbe    1157 <irmo_alloc_fail+0x37>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb5(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    116e <irmo_alloc_fail+0x4e>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<irmo_alloc_fail>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
test   %rdx,%rdx
jne    1147 <irmo_alloc_fail+0x27>
lea    0xefa(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>
lea    0xeb2(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"irmo_alloc_fail: Failed on allocation of %u bytes\0A\00"
@.str.1 = [38 x i8] c"irmo_alloc_fail: Out of memory error\0A\00"
define void @irmo_alloc_fail(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp ugt i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i64, i64* %2
%8 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i64 %7)
br label %12
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %9, %5
%13 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"irmo_alloc_fail: Failed on allocation of %u bytes\0A\00"
@.str.1 = [38 x i8] c"irmo_alloc_fail: Out of memory error\0A\00"
define void @irmo_alloc_fail(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = load i32, i32* @stderr
br i1 %2, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i64 %0)
br label %8
6: ; preds = %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
struct wbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void *wbuf_alloc(struct wbuf *, size_t);
void *wbuf_write(struct wbuf *buf, void const *data, size_t size) {
  assert(buf != NULL);
  void *result = wbuf_alloc(buf, size);
  if (result) {
    (void)memcpy(result, data, size);
  }
  return result;
}


x86 assembly (clang, -O0):
<wbuf_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <wbuf_alloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1183 <wbuf_write+0x53>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wbuf_write>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <wbuf_alloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     116d <wbuf_write+0x3d>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.wbuf = type { i32 }
define i8* @wbuf_write(%struct.wbuf* %0, i8* %1, i64 %2) {
%4 = alloca %struct.wbuf*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
store %struct.wbuf* %0, %struct.wbuf** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load %struct.wbuf*, %struct.wbuf** %4
%9 = icmp ne %struct.wbuf* %8, null
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load %struct.wbuf*, %struct.wbuf** %4
%13 = load i64, i64* %6
%14 = call i8* @wbuf_alloc(%struct.wbuf* %12, i64 %13)
store i8* %14, i8** %7
%15 = load i8*, i8** %7
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %22
17: ; preds = %3
%18 = load i8*, i8** %7
%19 = load i8*, i8** %5
%20 = load i64, i64* %6
%21 = call i32 @memcpy(i8* %18, i8* %19, i64 %20)
br label %22
22: ; preds = %17, %3
%23 = load i8*, i8** %7
ret i8* %23
}

LLVM IR (-O2):
%struct.wbuf = type { i32 }
define i8* @wbuf_write(%struct.wbuf* %0, i8* %1, i64 %2) {
%4 = icmp ne %struct.wbuf* %0, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i8* @wbuf_alloc(%struct.wbuf* %0, i64 %2)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call i32 @memcpy(i8* %7, i8* %1, i64 %2)
br label %11
11: ; preds = %9, %3
ret i8* %7
}
/* Type definitions */
struct timeval {
  long tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long cur_secs() {
  struct timeval tv;
  if (gettimeofday(&tv, NULL) != 0)
    assert(0);
  return tv.tv_sec;
}


x86 assembly (clang, -O0):
<cur_secs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
je     1146 <cur_secs+0x26>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cur_secs>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rax,%rax
je     1137 <cur_secs+0x17>
xor    %edi,%edi
call   1040 <assert@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
define i64 @cur_secs() {
%1 = alloca %struct.timeval
%2 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @assert(i32 0)
br label %6
6: ; preds = %4, %0
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i64, i64* %7
ret i64 %8
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
define i64 @cur_secs() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @assert(i32 0)
br label %7
7: ; preds = %5, %0
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i64, i64* %8
ret i64 %9
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ sequence;
};
struct TYPE_4__ {
  TYPE_1__ echo;
};
struct icmphdr {
  TYPE_2__ un;
};
typedef int /*<<< orphan*/ __u8;

/* Variables and functions */
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void pr_echo_reply(__u8 *_icp, int len) {
  struct icmphdr *icp = (struct icmphdr *)_icp;
  printf(" icmp_req=%u", ntohs(icp->un.echo.sequence));
}


x86 assembly (clang, -O0):
<pr_echo_reply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1040 <ntohs@plt>
mov    %eax,%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_echo_reply>:
push   %rax
mov    (%rdi),%edi
call   1040 <ntohs@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.icmphdr = type { %struct.TYPE_4__ }
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
@.str = [13 x i8] c" icmp_req=%u\00"
define void @pr_echo_reply(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca %struct.icmphdr*
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = bitcast i32* %6 to %struct.icmphdr*
store %struct.icmphdr* %7, %struct.icmphdr** %5
%8 = load %struct.icmphdr*, %struct.icmphdr** %5
%9 = getelementptr inbounds %struct.icmphdr, %struct.icmphdr* %8, i32 0, i32 0
%10 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %9, i32 0, i32 0
%11 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @ntohs(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c" icmp_req=%u\00"
define void @pr_echo_reply(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @ntohs(i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void main() {
  while (1) {
    double d[100000000];
    sleep(2);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2faf0800,%rsp
mov    $0x2,%edi
call   1030 <sleep@plt>
jmp    111b <main+0xb>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2,%edi
call   1030 <sleep@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define void @main() {
%1 = alloca [100000000 x double]
br label %2
2: ; preds = %0, %2
%3 = call i32 @sleep(i32 2)
br label %2
}

LLVM IR (-O2):
define void @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 @sleep(i32 2)
br label %1
}
int roi_set_power(char *buff) {
  buff[0] = (133);
  return 1;
}


x86 assembly (clang, -O0):
<roi_set_power>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x85,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roi_set_power>:
movb   $0x85,(%rdi)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @roi_set_power(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
store i8 -123, i8* %4
ret i32 1
}

LLVM IR (-O2):
define i32 @roi_set_power(i8* nocapture writeonly %0) {
store i8 -123, i8* %0
ret i32 1
}
/* Variables and functions */
float scalblnf(float, int);
float scalbnf(float x, int n) { return scalblnf(x, n); }


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

x86 assembly (clang, -O2):
<scalbnf>:
jmp    1030 <scalblnf@plt>

LLVM IR (-O0):
define float @scalbnf(float %0, i32 %1) {
%3 = alloca float
%4 = alloca i32
store float %0, float* %3
store i32 %1, i32* %4
%5 = load float, float* %3
%6 = load i32, i32* %4
%7 = call float @scalblnf(float %5, i32 %6)
ret float %7
}

LLVM IR (-O2):
define float @scalbnf(float %0, i32 %1) {
%3 = tail call float @scalblnf(float %0, i32 %1)
ret float %3
}
short int cast_char_short_fast(char x) { return (short int)x; }


x86 assembly (clang, -O0):
<cast_char_short_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<cast_char_short_fast>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i16 @cast_char_short_fast(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i16
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @cast_char_short_fast(i8 signext %0) {
%2 = sext i8 %0 to i16
ret i16 %2
}
int compare_ints(const void *a, const void *b) { return *(int *)a - *(int *)b; }


x86 assembly (clang, -O0):
<compare_ints>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_ints>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @compare_ints(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare_ints(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *);
int main(int argc, char *argv[]) {
  for (int i = 0; i < argc; i++)
    printf("arg[%i]: %s\n", i, argv[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1162 <main+0x52>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    1147 <main+0x37>
mov    %rsi,%r14
mov    %edi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"arg[%i]: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i32, i32* %6
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %12, i8* %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %7
22: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"arg[%i]: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %7
6: ; preds = %7, %2
ret i32 0
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %13, %7 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = trunc i64 %8 to i32
%12 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %10)
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %7
}
int magik(chance)
int chance;
{
  if (randint(100) <= chance)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<magik>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x64,%edi
mov    $0x0,%al
call   1030 <randint@plt>
cmp    -0x8(%rbp),%eax
jg     113c <magik+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <magik+0x33>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<magik>:
push   %rbx
mov    %edi,%ebx
mov    $0x64,%edi
xor    %eax,%eax
call   1030 <randint@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setle  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @magik(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (i32, ...) bitcast (i32 (...)* @randint to i32 (i32, ...)*)(i32 100)
%5 = load i32, i32* %3
%6 = icmp sle i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @magik(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @randint to i32 (i32, ...)*)(i32 100)
%3 = icmp sle i32 %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
void finalizer_scrub8(void *ptr) {
  uint64_t *sz_ptr = (uint64_t *)ptr;
  sz_ptr[0] = 0xa5a5a5a5a5a5a5a5ULL;
}


x86 assembly (clang, -O0):
<finalizer_scrub8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xa5a5a5a5,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<finalizer_scrub8>:
movl   $0xa5a5a5a5,(%rdi)
ret

LLVM IR (-O0):
define void @finalizer_scrub8(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
store i32 -1515870811, i32* %7
ret void
}

LLVM IR (-O2):
define void @finalizer_scrub8(i8* nocapture writeonly %0) {
%2 = bitcast i8* %0 to i32*
store i32 -1515870811, i32* %2
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("Hello World!\n");
  return (EXIT_SUCCESS);
}


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>
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World!\0A\00"
@EXIT_SUCCESS = global i32 0
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 ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [13 x i8] c"Hello World!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}