xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ challenge_any_one();
int /*<<< orphan*/ challenge_initStates();
int /*<<< orphan*/ challenge_run();
int main() {
  challenge_initStates();
  challenge_run();
  challenge_run();
  challenge_any_one();
  challenge_run();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <challenge_initStates@plt>
mov    $0x0,%al
call   1030 <challenge_run@plt>
mov    $0x0,%al
call   1030 <challenge_run@plt>
mov    $0x0,%al
call   1040 <challenge_any_one@plt>
mov    $0x0,%al
call   1030 <challenge_run@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <challenge_initStates@plt>
xor    %eax,%eax
call   1030 <challenge_run@plt>
xor    %eax,%eax
call   1030 <challenge_run@plt>
xor    %eax,%eax
call   1040 <challenge_any_one@plt>
xor    %eax,%eax
call   1030 <challenge_run@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @challenge_initStates()
%3 = call i32 (...) @challenge_run()
%4 = call i32 (...) @challenge_run()
%5 = call i32 (...) @challenge_any_one()
%6 = call i32 (...) @challenge_run()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @challenge_initStates()
%2 = tail call i32 (...) @challenge_run()
%3 = tail call i32 (...) @challenge_run()
%4 = tail call i32 (...) @challenge_any_one()
%5 = tail call i32 (...) @challenge_run()
ret i32 0
}
void irqtime_account_irq(struct task_struct *tsk) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @irqtime_account_irq(%struct.task_struct* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void handler(int sig) { printf("sig = %d\n", sig); }


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

x86 assembly (clang, -O2):
<handler>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"sig = %d\0A\00"
define void @handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct bladerf {
  int dummy;
};

/* Variables and functions */
int nios_32x32_masked_write(struct bladerf *, int, int /*<<< orphan*/,
                            int /*<<< orphan*/);
int nios_expansion_gpio_dir_write(struct bladerf *dev, uint32_t mask,
                                  uint32_t val) {
  int status = nios_32x32_masked_write(dev, 0x01, mask, val);
  if (status == 0) {
    do {
      do {
      } while (0);
    } while (0);
  }
  return status;
}


x86 assembly (clang, -O0):
<nios_expansion_gpio_dir_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    $0x1,%esi
call   1030 <nios_32x32_masked_write@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    115c <nios_expansion_gpio_dir_write+0x4c>
jmp    1148 <nios_expansion_gpio_dir_write+0x38>
jmp    114d <nios_expansion_gpio_dir_write+0x3d>
jmp    1152 <nios_expansion_gpio_dir_write+0x42>
jmp    1157 <nios_expansion_gpio_dir_write+0x47>
jmp    115c <nios_expansion_gpio_dir_write+0x4c>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nios_expansion_gpio_dir_write>:
mov    %edx,%ecx
mov    %esi,%edx
mov    $0x1,%esi
jmp    1030 <nios_32x32_masked_write@plt>

LLVM IR (-O0):
%struct.bladerf = type { i32 }
define i32 @nios_expansion_gpio_dir_write(%struct.bladerf* %0, i32 %1, i32 %2) {
%4 = alloca %struct.bladerf*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store %struct.bladerf* %0, %struct.bladerf** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load %struct.bladerf*, %struct.bladerf** %4
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = call i32 @nios_32x32_masked_write(%struct.bladerf* %8, i32 1, i32 %9, i32 %10)
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %3
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
br label %17
17: ; preds = %16
br label %18
18: ; preds = %17
br label %19
19: ; preds = %18, %3
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
%struct.bladerf = type { i32 }
define i32 @nios_expansion_gpio_dir_write(%struct.bladerf* %0, i32 %1, i32 %2) {
%4 = tail call i32 @nios_32x32_masked_write(%struct.bladerf* %0, i32 1, i32 %1, i32 %2)
ret i32 %4
}
int main() {
  int x, y;
  x = 5;
  y = 10;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ IntEnable(unsigned long);
int /*<<< orphan*/ IntRegister(unsigned long, void (*)());
void PWMGenIntRegister(unsigned long ulBase, unsigned long ulGen,
                       void (*pfnIntHandler)(void)) {
  unsigned long ulInt;
  ;
  ;
  if (ulGen == 0x00000100) {
    ulInt = 61;
  } else {
    ulInt = 26 + (ulGen >> 6) - 1;
  }
  IntRegister(ulInt, pfnIntHandler);
  IntEnable(ulInt);
}


x86 assembly (clang, -O0):
<PWMGenIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x100,-0x10(%rbp)
jne    114f <PWMGenIntRegister+0x2f>
movq   $0x3d,-0x20(%rbp)
jmp    1163 <PWMGenIntRegister+0x43>
mov    -0x10(%rbp),%rax
shr    $0x6,%rax
add    $0x1a,%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <IntRegister@plt>
mov    -0x20(%rbp),%rdi
call   1030 <IntEnable@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMGenIntRegister>:
push   %rbx
mov    %rsi,%rax
shr    $0x6,%rax
add    $0x19,%rax
cmp    $0x100,%rsi
mov    $0x3d,%ebx
cmovne %rax,%rbx
mov    %rbx,%rdi
mov    %rdx,%rsi
call   1040 <IntRegister@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @PWMGenIntRegister(i64 %0, i64 %1, void ()* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca void ()*
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store void ()* %2, void ()** %6
%8 = load i64, i64* %5
%9 = icmp eq i64 %8, 256
br i1 %9, label %10, label %11
10: ; preds = %3
store i64 61, i64* %7
br label %16
11: ; preds = %3
%12 = load i64, i64* %5
%13 = lshr i64 %12, 6
%14 = add i64 26, %13
%15 = sub i64 %14, 1
store i64 %15, i64* %7
br label %16
16: ; preds = %11, %10
%17 = load i64, i64* %7
%18 = load void ()*, void ()** %6
%19 = bitcast void ()* %18 to void (...)*
%20 = call i32 @IntRegister(i64 %17, void (...)* %19)
%21 = load i64, i64* %7
%22 = call i32 @IntEnable(i64 %21)
ret void
}

LLVM IR (-O2):
define void @PWMGenIntRegister(i64 %0, i64 %1, void ()* %2) {
%4 = icmp eq i64 %1, 256
%5 = lshr i64 %1, 6
%6 = add nuw nsw i64 %5, 25
%7 = select i1 %4, i64 61, i64 %6
%8 = bitcast void ()* %2 to void (...)*
%9 = tail call i32 @IntRegister(i64 %7, void (...)* %8)
%10 = tail call i32 @IntEnable(i64 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, char *, char *);
void read_str_from_line(char *config_line, char *val) {
  char prm_name[20];
  char prm_name1[20];
  char prm_name2[20];
  char prm_name3[20];
  sscanf(config_line, " %s %s %s %s %s\n", prm_name, prm_name1, prm_name2, val);
}


x86 assembly (clang, -O0):
<read_str_from_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x50(%rbp),%rcx
lea    -0x70(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    0xec2(%rip),%rsi
call   1030 <sscanf@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_str_from_line>:
sub    $0x58,%rsp
mov    %rsi,%r9
lea    0xee2(%rip),%rsi
lea    0x40(%rsp),%rdx
lea    0x20(%rsp),%rcx
mov    %rsp,%r8
call   1030 <sscanf@plt>
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [17 x i8] c" %s %s %s %s %s\0A\00"
define void @read_str_from_line(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = alloca [20 x i8]
%8 = alloca [20 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%13 = load i8*, i8** %4
%14 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c" %s %s %s %s %s\0A\00"
define void @read_str_from_line(i8* nocapture %0, i8* %1) {
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%9 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %7, i8* %8, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
void _write_payload(char **pptr, const char *payload, int length) {
  memcpy(*pptr, payload, length);
  *pptr += length;
}


x86 assembly (clang, -O0):
<_write_payload>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
movslq %edx,%rdx
add    %rdx,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write_payload>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <memcpy@plt>
movslq %ebp,%rax
add    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @_write_payload(i8** %0, i8* %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @memcpy(i8* %8, i8* %9, i32 %10)
%12 = load i32, i32* %6
%13 = load i8**, i8*** %4
%14 = load i8*, i8** %13
%15 = sext i32 %12 to i64
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8* %16, i8** %13
ret void
}

LLVM IR (-O2):
define void @_write_payload(i8** nocapture %0, i8* %1, i32 %2) {
%4 = load i8*, i8** %0
%5 = tail call i32 @memcpy(i8* %4, i8* %1, i32 %2)
%6 = load i8*, i8** %0
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %6, i64 %7
store i8* %8, i8** %0
ret void
}
/* Variables and functions */
unsigned long TimerGetMS();
unsigned long TimerWait(unsigned long Time) { return TimerGetMS() + Time; }


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

x86 assembly (clang, -O2):
<TimerWait>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <TimerGetMS@plt>
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @TimerWait(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i64 (...) @TimerGetMS()
%4 = load i64, i64* %2
%5 = add i64 %3, %4
ret i64 %5
}

LLVM IR (-O2):
define i64 @TimerWait(i64 %0) {
%2 = tail call i64 (...) @TimerGetMS()
%3 = add i64 %2, %0
ret i64 %3
}
int color_int(int c) {
  switch (c) {
  case 'W':
    return 0;
  case 'R':
    return 1;
  case 'B':
    return 2;
  case 'O':
    return 3;
  case 'G':
    return 4;
  case 'Y':
    return 5;
  }
}


x86 assembly (clang, -O0):
<color_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffbe,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x17,%eax
ja     1173 <color_int+0x73>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    1173 <color_int+0x73>
movl   $0x1,-0x4(%rbp)
jmp    1173 <color_int+0x73>
movl   $0x2,-0x4(%rbp)
jmp    1173 <color_int+0x73>
movl   $0x3,-0x4(%rbp)
jmp    1173 <color_int+0x73>
movl   $0x4,-0x4(%rbp)
jmp    1173 <color_int+0x73>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<color_int>:
xor    %eax,%eax
add    $0xffffffbe,%edi
cmp    $0x17,%edi
ja     1137 <color_int+0x37>
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x2,%eax
ret
mov    $0x4,%eax
ret
mov    $0x3,%eax
ret
mov    $0x1,%eax
ret
mov    $0x5,%eax
ret

LLVM IR (-O0):
define i32 @color_int(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 87, label %5
i32 82, label %6
i32 66, label %7
i32 79, label %8
i32 71, label %9
i32 89, label %10
]
5: ; preds = %1
store i32 0, i32* %2
br label %11
6: ; preds = %1
store i32 1, i32* %2
br label %11
7: ; preds = %1
store i32 2, i32* %2
br label %11
8: ; preds = %1
store i32 3, i32* %2
br label %11
9: ; preds = %1
store i32 4, i32* %2
br label %11
10: ; preds = %1
store i32 5, i32* %2
br label %11
11: ; preds = %5, %6, %7, %8, %9, %10, %1
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @color_int(i32 %0) {
switch i32 %0, label %7 [
i32 89, label %6
i32 82, label %2
i32 66, label %3
i32 79, label %4
i32 71, label %5
]
2: ; preds = %1
br label %7
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %2, %3, %4, %5, %6, %1
%8 = phi i32 [ 5, %6 ], [ 4, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %2 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
int inkey();
int /*<<< orphan*/ prt(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ put_str(char *, int, int);
void pause_line(int row) {
  int i;
  prt("", row, 0);
  put_str("[Press any key to continue]", row, 23);
  i = inkey();
  prt("", row, 0);
}


x86 assembly (clang, -O0):
<pause_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xed6(%rip),%rdi
xor    %edx,%edx
call   1030 <prt@plt>
mov    -0x4(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x17,%edx
call   1050 <put_str@plt>
mov    $0x0,%al
call   1040 <inkey@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
lea    0xea7(%rip),%rdi
xor    %edx,%edx
call   1030 <prt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pause_line>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xede(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
call   1030 <prt@plt>
lea    0xeb0(%rip),%rdi
mov    %ebx,%esi
mov    $0x17,%edx
call   1050 <put_str@plt>
xor    %eax,%eax
call   1040 <inkey@plt>
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <prt@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [28 x i8] c"[Press any key to continue]\00"
define void @pause_line(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @prt(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %4, i32 0)
%6 = load i32, i32* %2
%7 = call i32 @put_str(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 23)
%8 = call i32 (...) @inkey()
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = call i32 @prt(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %9, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [28 x i8] c"[Press any key to continue]\00"
define void @pause_line(i32 %0) {
%2 = tail call i32 @prt(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %0, i32 0)
%3 = tail call i32 @put_str(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 23)
%4 = tail call i32 (...) @inkey()
%5 = tail call i32 @prt(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 %0, i32 0)
ret void
}
/* Type definitions */
struct ndarray {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct ndarray *);
void stdlib_ndarray_free(struct ndarray *arr) { free(arr); }


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

x86 assembly (clang, -O2):
<stdlib_ndarray_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.ndarray = type { i32 }
define void @stdlib_ndarray_free(%struct.ndarray* %0) {
%2 = alloca %struct.ndarray*
store %struct.ndarray* %0, %struct.ndarray** %2
%3 = load %struct.ndarray*, %struct.ndarray** %2
%4 = call i32 @free(%struct.ndarray* %3)
ret void
}

LLVM IR (-O2):
%struct.ndarray = type { i32 }
define void @stdlib_ndarray_free(%struct.ndarray* nocapture %0) {
%2 = tail call i32 @free(%struct.ndarray* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ product(int, int);
void sum(int number1, int number2) {
  int total = 0;
  total = number1 + number2;
  printf("Sum is %d\n", total);
  number1++;
  number2++;
  product(number1, number2);
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <product@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebx
lea    (%r14,%rbx,1),%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
add    $0x1,%ebx
add    $0x1,%r14d
mov    %ebx,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <product@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Sum is %d\0A\00"
define void @sum(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = call i32 @product(i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Sum is %d\0A\00"
define void @sum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = add nsw i32 %0, 1
%6 = add nsw i32 %1, 1
%7 = tail call i32 @product(i32 %5, i32 %6)
ret void
}
double berechne_zinsen(double kredit, double zinssatz) {
  double zinsen = kredit * zinssatz;
  return zinsen;
}


x86 assembly (clang, -O0):
<berechne_zinsen>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<berechne_zinsen>:
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @berechne_zinsen(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fmul double %6, %7
store double %8, double* %5
%9 = load double, double* %5
ret double %9
}

LLVM IR (-O2):
define double @berechne_zinsen(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, char const *);
int main(int argc, char const *argv[]) {
  printf("Dinners: %s\n", argv[1]);
  printf("Juice: %s\n", getenv("JUICE"));
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rsi
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rsi
lea    0xed4(%rip),%rdi
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
call   1030 <getenv@plt>
lea    0xec9(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Dinners: %s\0A\00"
@.str.1 = [11 x i8] c"Juice: %s\0A\00"
@.str.2 = [6 x i8] c"JUICE\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 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Dinners: %s\0A\00"
@.str.1 = [11 x i8] c"Juice: %s\0A\00"
@.str.2 = [6 x i8] c"JUICE\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = tail call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  fprintf(stderr, "hello world\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)
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [13 x i8] c"hello world\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 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"hello world\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void catStr(char *str1, char *str2) {
  for (; *str1 != '\0'; str1++)
    ;
  for (; *str2 != '\0'; str2++)
    *str1++ = *str2;
}


x86 assembly (clang, -O0):
<catStr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1132 <catStr+0x32>
jmp    1121 <catStr+0x21>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <catStr+0xc>
jmp    1137 <catStr+0x37>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116f <catStr+0x6f>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <catStr+0x37>
pop    %rbp
ret

x86 assembly (clang, -O2):
<catStr>:
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1100 <catStr>
mov    (%rsi),%al
test   %al,%al
je     1131 <catStr+0x31>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %al,-0x1(%rdi,%rcx,1)
movzbl 0x1(%rsi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1120 <catStr+0x20>
ret

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

LLVM IR (-O2):
define void @catStr(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i8 [ %17, %11 ], [ %9, %8 ]
%13 = phi i8* [ %16, %11 ], [ %1, %8 ]
%14 = phi i8* [ %15, %11 ], [ %4, %8 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %12, i8* %14
%16 = getelementptr inbounds i8, i8* %13, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ z_free(char *);
void zconfig_free_fn(char *v, char *ptr) { z_free(v); }


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

x86 assembly (clang, -O2):
<zconfig_free_fn>:
jmp    1030 <z_free@plt>

LLVM IR (-O0):
define void @zconfig_free_fn(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 = call i32 @z_free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @zconfig_free_fn(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @z_free(i8* %0)
ret void
}
void glBindVertexArray(unsigned int array) {}


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

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

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

LLVM IR (-O2):
define void @glBindVertexArray(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int test_sched(void) {
  printf("The Scheduler library is not included in this build\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [53 x i8] c"The Scheduler library is not included in this build\0A\00"
define i32 @test_sched() {
%1 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [52 x i8] c"The Scheduler library is not included in this build\00"
define i32 @test_sched() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
long tls1_default_timeout(void) { return (60 * 60 * 2); }


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

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

LLVM IR (-O0):
define i64 @tls1_default_timeout() {
ret i64 7200
}

LLVM IR (-O2):
define i64 @tls1_default_timeout() {
ret i64 7200
}
int string_length(char string[]) {
  int position = 0;
  int count = 0;
  while (string[position] != '\0') {
    ++count;
    ++position;
  }
  return count;
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1142 <string_length+0x42>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <string_length+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_length>:
cmpb   $0x0,(%rdi)
je     111c <string_length+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <string_length+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @string_length(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %6, %4 ], [ 0, %1 ]
%6 = add nuw nsw i64 %5, 1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %6 to i32
br label %12
12: ; preds = %10, %1
%13 = phi i32 [ 0, %1 ], [ %11, %10 ]
ret i32 %13
}
/* Type definitions */
typedef size_t uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(size_t *, size_t *, size_t);
size_t dhcp_option_set(uint8_t *options, uint8_t code, uint8_t *data,
                       size_t len) {
  options[0] = code;
  options[1] = len;
  memcpy(&options[2], data, len);
  return len + (sizeof(uint8_t) * 2);
}


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

x86 assembly (clang, -O2):
<dhcp_option_set>:
push   %rbx
mov    %rcx,%rbx
mov    %rsi,(%rdi)
mov    %rcx,0x8(%rdi)
add    $0x10,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
call   1030 <memcpy@plt>
add    $0x10,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @dhcp_option_set(i64* %0, i64 %1, i64* %2, i64 %3) {
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i64*
%8 = alloca i64
store i64* %0, i64** %5
store i64 %1, i64* %6
store i64* %2, i64** %7
store i64 %3, i64* %8
%9 = load i64, i64* %6
%10 = load i64*, i64** %5
%11 = getelementptr inbounds i64, i64* %10, i64 0
store i64 %9, i64* %11
%12 = load i64, i64* %8
%13 = load i64*, i64** %5
%14 = getelementptr inbounds i64, i64* %13, i64 1
store i64 %12, i64* %14
%15 = load i64*, i64** %5
%16 = getelementptr inbounds i64, i64* %15, i64 2
%17 = load i64*, i64** %7
%18 = load i64, i64* %8
%19 = call i32 @memcpy(i64* %16, i64* %17, i64 %18)
%20 = load i64, i64* %8
%21 = add i64 %20, 16
ret i64 %21
}

LLVM IR (-O2):
define i64 @dhcp_option_set(i64* %0, i64 %1, i64* %2, i64 %3) {
store i64 %1, i64* %0
%5 = getelementptr inbounds i64, i64* %0, i64 1
store i64 %3, i64* %5
%6 = getelementptr inbounds i64, i64* %0, i64 2
%7 = tail call i32 @memcpy(i64* %6, i64* %2, i64 %3)
%8 = add i64 %3, 16
ret i64 %8
}
void usr_sample_input(void) {}


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

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

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

LLVM IR (-O2):
define void @usr_sample_input() {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int, int);
void sprint_anl_data_to_direct(char *str, uint8_t direct, uint8_t data) {
  sprintf(str,
          "ANL   "
          "0x%02X"
          ", #"
          "0x%02X"
          "               ",
          direct, data);
}


x86 assembly (clang, -O0):
<sprint_anl_data_to_direct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xecd(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_anl_data_to_direct>:
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee5(%rip),%rsi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"ANL 0x%02X,x%02X \00"
define void @sprint_anl_data_to_direct(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"ANL 0x%02X,x%02X \00"
define void @sprint_anl_data_to_direct(i8* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret void
}
int _Locale_is_stateless(struct _Locale_ctype *__DUMMY_PAR) { return 1; }


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

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

LLVM IR (-O0):
%struct._Locale_ctype = type opaque
define i32 @_Locale_is_stateless(%struct._Locale_ctype* %0) {
%2 = alloca %struct._Locale_ctype*
store %struct._Locale_ctype* %0, %struct._Locale_ctype** %2
ret i32 1
}

LLVM IR (-O2):
%struct._Locale_ctype = type opaque
define i32 @_Locale_is_stateless(%struct._Locale_ctype* nocapture readnone %0) {
ret i32 1
}
void rop3_109_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  unsigned char stk4;
  stk4 = T | *D;
  stk3 = S & stk4;
  stk2 = *D ^ stk3;
  stk1 = T ^ stk2;
  stk1 = ~stk1;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_109_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
or     %ecx,%eax
mov    %al,-0xe(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xe(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xd(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_109_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
or     %dl,%cl
and    %sil,%cl
xor    %al,%dl
xor    %cl,%dl
or     %sil,%dl
not    %dl
and    %sil,%al
or     %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_109_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%11 = load i8, i8* %6
%12 = zext i8 %11 to i32
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = or i32 %12, %15
%17 = trunc i32 %16 to i8
store i8 %17, i8* %10
%18 = load i8, i8* %5
%19 = zext i8 %18 to i32
%20 = load i8, i8* %10
%21 = zext i8 %20 to i32
%22 = and i32 %19, %21
%23 = trunc i32 %22 to i8
store i8 %23, i8* %9
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = load i8, i8* %9
%28 = zext i8 %27 to i32
%29 = xor i32 %26, %28
%30 = trunc i32 %29 to i8
store i8 %30, i8* %8
%31 = load i8, i8* %6
%32 = zext i8 %31 to i32
%33 = load i8, i8* %8
%34 = zext i8 %33 to i32
%35 = xor i32 %32, %34
%36 = trunc i32 %35 to i8
store i8 %36, i8* %7
%37 = load i8, i8* %7
%38 = zext i8 %37 to i32
%39 = xor i32 %38, -1
%40 = trunc i32 %39 to i8
store i8 %40, i8* %7
%41 = load i8, i8* %7
%42 = zext i8 %41 to i32
%43 = load i8, i8* %5
%44 = zext i8 %43 to i32
%45 = xor i32 %44, -1
%46 = and i32 %42, %45
%47 = load i8*, i8** %4
%48 = load i8, i8* %47
%49 = zext i8 %48 to i32
%50 = load i8, i8* %5
%51 = zext i8 %50 to i32
%52 = and i32 %49, %51
%53 = or i32 %46, %52
%54 = trunc i32 %53 to i8
%55 = load i8*, i8** %4
store i8 %54, i8* %55
ret void
}

LLVM IR (-O2):
define void @rop3_109_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = or i8 %4, %2
%6 = and i8 %5, %1
%7 = xor i8 %4, %2
%8 = xor i8 %7, %6
%9 = or i8 %8, %1
%10 = xor i8 %9, -1
%11 = and i8 %4, %1
%12 = or i8 %11, %10
store i8 %12, i8* %0
ret void
}
int f(int n, int x, int stride) {
  int a, x1, x2, x3;
  a = x * stride;
  if (n > 64) {
    x1 = x + 3;
    a += x1 * stride;
    x2 = x1 + 3;
    a += x2 * stride;
  } else {
    x3 = x + 3;
    a += x3 * stride;
  }
  return a;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x40,-0x4(%rbp)
jle    1152 <f+0x52>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1168 <f+0x68>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %esi,%eax
mov    %edx,%ecx
imul   %esi,%ecx
cmp    $0x41,%edi
jl     111a <f+0x1a>
lea    (%rax,%rax,1),%esi
add    $0x9,%esi
imul   %edx,%esi
mov    %ecx,%eax
add    %esi,%eax
ret
add    $0x3,%eax
imul   %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = mul nsw i32 %11, %12
store i32 %13, i32* %7
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 64
br i1 %15, label %16, label %31
16: ; preds = %3
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 3
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = load i32, i32* %6
%21 = mul nsw i32 %19, %20
%22 = load i32, i32* %7
%23 = add nsw i32 %22, %21
store i32 %23, i32* %7
%24 = load i32, i32* %8
%25 = add nsw i32 %24, 3
store i32 %25, i32* %9
%26 = load i32, i32* %9
%27 = load i32, i32* %6
%28 = mul nsw i32 %26, %27
%29 = load i32, i32* %7
%30 = add nsw i32 %29, %28
store i32 %30, i32* %7
br label %39
31: ; preds = %3
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 3
store i32 %33, i32* %10
%34 = load i32, i32* %10
%35 = load i32, i32* %6
%36 = mul nsw i32 %34, %35
%37 = load i32, i32* %7
%38 = add nsw i32 %37, %36
store i32 %38, i32* %7
br label %39
39: ; preds = %31, %16
%40 = load i32, i32* %7
ret i32 %40
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %1
%5 = icmp sgt i32 %0, 64
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = shl i32 %1, 1
%8 = add i32 %7, 9
%9 = mul i32 %8, %2
br label %13
10: ; preds = %3
%11 = add nsw i32 %1, 3
%12 = mul nsw i32 %11, %2
br label %13
13: ; preds = %10, %6
%14 = phi i32 [ %12, %10 ], [ %4, %6 ]
%15 = phi i32 [ %4, %10 ], [ %9, %6 ]
%16 = add i32 %15, %14
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void vulnerable(void) {
  char name[256];
  printf("Hello, what is your name? - ");
  scanf("%s", name);
  printf("Welcome %s\n", name);
}


x86 assembly (clang, -O0):
<vulnerable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x100(%rbp),%rsi
lea    0xed6(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x100(%rbp),%rsi
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vulnerable>:
push   %rbx
sub    $0x100,%rsp
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
lea    0xed1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Hello, what is your name? - \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"Welcome %s\0A\00"
define void @vulnerable() {
%1 = alloca [256 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Hello, what is your name? - \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [12 x i8] c"Welcome %s\0A\00"
define void @vulnerable() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 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), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret void
}
int do_316() { return 316; }


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

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

LLVM IR (-O0):
define i32 @do_316() {
ret i32 316
}

LLVM IR (-O2):
define i32 @do_316() {
ret i32 316
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, char *, int);
int main(int argc, char *argv[]) {
  printf("%s - %d arguments\n", argv[0], argc);
  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)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%edx
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %edi,%edx
mov    (%rsi),%rsi
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb7(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%s - %d arguments\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 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = load i32, i32* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
%11 = load i32, i32* @EXIT_SUCCESS
ret i32 %11
}

LLVM IR (-O2):
@.str = [19 x i8] c"%s - %d arguments\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %0)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
imm0reg1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if (22 <= r1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<imm0reg1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movzwl -0x8(%rbp),%ecx
mov    $0x16,%eax
cmp    %ecx,%eax
jg     113c <imm0reg1+0x3c>
movl   $0x1,-0x4(%rbp)
jmp    1143 <imm0reg1+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imm0reg1>:
and    $0xfffe,%esi
xor    %eax,%eax
cmp    $0x16,%esi
setae  %al
ret

LLVM IR (-O0):
define i32 @imm0reg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16, i16* %9
%17 = zext i16 %16 to i32
%18 = icmp sle i32 22, %17
br i1 %18, label %19, label %20
19: ; preds = %6
store i32 1, i32* %7
br label %21
20: ; preds = %6
store i32 0, i32* %7
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @imm0reg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture readnone %5) {
%7 = and i32 %1, 65534
%8 = icmp ugt i32 %7, 21
%9 = zext i1 %8 to i32
ret i32 %9
}