xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t bytes_to_ui32(const uint8_t *buf) {
  return (((buf[0]) << 24) & 0xff000000) | (((buf[1]) << 16) & 0xff0000) |
         (((buf[2]) << 8) & 0xff00) | (((buf[3])) & 0xff);
}


x86 assembly (clang, -O0):
<bytes_to_ui32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x10,%ecx
and    $0xff0000,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%ecx
shl    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
mov    0xc(%rcx),%ecx
and    $0xff,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytes_to_ui32>:
mov    (%rdi),%eax
mov    0x4(%rdi),%ecx
shl    $0x18,%eax
movzbl %cl,%ecx
shl    $0x10,%ecx
or     %eax,%ecx
mov    0x8(%rdi),%eax
shl    $0x8,%eax
movzwl %ax,%edx
or     %ecx,%edx
movzbl 0xc(%rdi),%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @bytes_to_ui32(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = shl i32 %5, 24
%7 = and i32 %6, -16777216
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = shl i32 %10, 16
%12 = and i32 %11, 16711680
%13 = or i32 %7, %12
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 2
%16 = load i32, i32* %15
%17 = shl i32 %16, 8
%18 = and i32 %17, 65280
%19 = or i32 %13, %18
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 3
%22 = load i32, i32* %21
%23 = and i32 %22, 255
%24 = or i32 %19, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @bytes_to_ui32(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 24
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = shl i32 %5, 16
%7 = and i32 %6, 16711680
%8 = or i32 %7, %3
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = shl i32 %10, 8
%12 = and i32 %11, 65280
%13 = or i32 %8, %12
%14 = getelementptr inbounds i32, i32* %0, i64 3
%15 = load i32, i32* %14
%16 = and i32 %15, 255
%17 = or i32 %13, %16
ret i32 %17
}
void delay_ms(unsigned int b) {
  unsigned int a;
  while (--b)
    for (a = 500; a; --a)
      ;
}


x86 assembly (clang, -O0):
<delay_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     1142 <delay_ms+0x42>
movl   $0x1f4,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113d <delay_ms+0x3d>
jmp    112f <delay_ms+0x2f>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1120 <delay_ms+0x20>
jmp    1107 <delay_ms+0x7>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @delay_ms(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %16, %1
%5 = load i32, i32* %2
%6 = add i32 %5, -1
store i32 %6, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %17
8: ; preds = %4
store i32 500, i32* %3
br label %9
9: ; preds = %13, %8
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
br label %13
13: ; preds = %12
%14 = load i32, i32* %3
%15 = add i32 %14, -1
store i32 %15, i32* %3
br label %9
16: ; preds = %9
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @delay_ms(i32 %0) {
ret void
}
int has_feat_enable_cti(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @has_feat_enable_cti() {
ret i32 0
}

LLVM IR (-O2):
define i32 @has_feat_enable_cti() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ crash();
int /*<<< orphan*/ printf(char *);
__attribute__((visibility("default"))) __attribute__((no)) void func2() {
  printf("func2\n");
  crash();
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <crash@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <crash@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"func2\0A\00"
define void @func2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @crash()
ret void
}

LLVM IR (-O2):
@str = [6 x i8] c"func2\00"
define void @func2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @crash()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  printf("Zeta=%s\n", "zeta");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"Zeta=%s\0A\00"
@.str.1 = [5 x i8] c"zeta\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Zeta=%s\0A\00"
@.str.1 = [5 x i8] c"zeta\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int test_imm_F0uint16_mem(unsigned short *val) {
  return ((*val) & (0xF0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F0uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xf0,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F0uint16_mem>:
testb  $0xf0,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_F0uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, 240
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_F0uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 240
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void caller_1_2_2_1_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_2_2_1_1_2_1() {
ret void
}
/* Variables and functions */
int max(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 100;
  int b = 200;
  int ret;
  ret = max(a, b);
  printf("max value is : %d \n ", ret);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x64,%edi
mov    $0xc8,%esi
call   1040 <max@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"max value is : %d \0A \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 100, i32* %2
store i32 200, i32* %3
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @max(i32 %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"max value is : %d \0A \00"
define i32 @main() {
%1 = tail call i32 @max(i32 100, i32 200)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, int);
int /*<<< orphan*/ stderr;
void pbcAssertHandler(const char *failedAssertion, const char *filename,
                      int line) {
  fprintf(stderr, "Assert failed (%s): %s line %d\n", failedAssertion, filename,
          line);
  abort();
}


x86 assembly (clang, -O0):
<pbcAssertHandler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<pbcAssertHandler>:
push   %rax
mov    %edx,%r8d
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Assert failed (%s): %s line %d\0A\00"
define void @pbcAssertHandler(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 i32, i32* @stderr
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9, i32 %10)
%12 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Assert failed (%s): %s line %d\0A\00"
define void @pbcAssertHandler(i8* %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %2)
%6 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ uprintf(char *);
void ReportMaxPoolUsages(void) {
  uprintf("\n----- Max usage not available--------\n");
}


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

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

LLVM IR (-O0):
@.str = [40 x i8] c"\0A----- Max usage not available--------\0A\00"
define void @ReportMaxPoolUsages() {
%1 = call i32 @uprintf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"\0A----- Max usage not available--------\0A\00"
define void @ReportMaxPoolUsages() {
%1 = tail call i32 @uprintf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SCSI_Out_Ctl_RestoreConfig();
void SCSI_Out_Ctl_Wakeup(void) { SCSI_Out_Ctl_RestoreConfig(); }


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

x86 assembly (clang, -O2):
<SCSI_Out_Ctl_Wakeup>:
xor    %eax,%eax
jmp    1030 <SCSI_Out_Ctl_RestoreConfig@plt>

LLVM IR (-O0):
define void @SCSI_Out_Ctl_Wakeup() {
%1 = call i32 (...) @SCSI_Out_Ctl_RestoreConfig()
ret void
}

LLVM IR (-O2):
define void @SCSI_Out_Ctl_Wakeup() {
%1 = tail call i32 (...) @SCSI_Out_Ctl_RestoreConfig()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ be32toh(int /*<<< orphan*/);
uint32_t swap(uint32_t in) { return be32toh(in); }


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

x86 assembly (clang, -O2):
<swap>:
jmp    1030 <be32toh@plt>

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

LLVM IR (-O2):
define i32 @swap(i32 %0) {
%2 = tail call i32 @be32toh(i32 %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ array1;

/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, int, char);
int /*<<< orphan*/ sleep(int);
int stack_overflow_test() {
  int i;
  char array[1], array1[1];
  gets(array);
  for (i = 0; i < sizeof(array1); i++) {
    printf("array1[%d] = %c\n", i, array1[i]);
  }
  sleep(1);
  return 0;
}


x86 assembly (clang, -O0):
<stack_overflow_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x5(%rbp),%rdi
call   1040 <gets@plt>
movl   $0x0,-0x4(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x1,%rax
jae    117c <stack_overflow_test+0x4c>
mov    -0x4(%rbp),%esi
movslq -0x4(%rbp),%rax
lea    0xe9c(%rip),%rdi
movsbl -0x6(%rbp,%rax,1),%edx
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <stack_overflow_test+0x18>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stack_overflow_test>:
push   %rax
lea    0x7(%rsp),%rdi
call   1040 <gets@plt>
lea    0xebe(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"array1[%d] = %c\0A\00"
define i32 @stack_overflow_test() {
%1 = alloca [1 x i8]
%2 = getelementptr inbounds [1 x i8], [1 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 0, i8 signext undef)
%5 = call i32 @sleep(i32 1)
ret i32 0
}
FNIEMOP_DEF(iemOp_Grp7_vmxoff) {
  AssertFailed();
  return IEMOP_RAISE_INVALID_OPCODE();
}


x86 assembly (clang, -O0):
<FNIEMOP_DEF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <AssertFailed@plt>
mov    $0x0,%al
call   1030 <IEMOP_RAISE_INVALID_OPCODE@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FNIEMOP_DEF>:
push   %rax
xor    %eax,%eax
call   1040 <AssertFailed@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <IEMOP_RAISE_INVALID_OPCODE@plt>

LLVM IR (-O0):
define i32 @FNIEMOP_DEF(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @AssertFailed()
%4 = call i32 (...) @IEMOP_RAISE_INVALID_OPCODE()
ret i32 %4
}

LLVM IR (-O2):
define i32 @FNIEMOP_DEF(i32 %0) {
%2 = tail call i32 (...) @AssertFailed()
%3 = tail call i32 (...) @IEMOP_RAISE_INVALID_OPCODE()
ret i32 %3
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
int strlen(char *);
char *xstrdup(char *s) {
  int sl = strlen(s) + 1;
  char *m = malloc(sl);
  memcpy(m, s, sl);
  return m;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = load i32, i32* %3
%13 = call i32 @memcpy(i8* %10, i8* %11, i32 %12)
%14 = load i8*, i8** %4
ret i8* %14
}

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %3)
ret i8* %4
}
int hash_table_hash(const int key) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @hash_table_hash(i32 %0) {
ret i32 1
}
void main(void) {
  int x[10];
  int y;
  y = (x[5] + 2) * y;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
imul   -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 2
%6 = load i32, i32* %2
%7 = mul nsw i32 %5, %6
store i32 %7, i32* %2
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
unsigned xrop3_26_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = S & T;
  stk2 = D | stk3;
  stk1 = T ^ stk2;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_26_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_26_0_0>:
shl    $0x8,%edi
mov    %esi,%eax
shl    $0x8,%eax
lea    (%rsi,%rax,1),%ecx
and    %edi,%eax
or     $0xff,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_26_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = and i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %5
%27 = load i32, i32* %10
%28 = or i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %7
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
ret i32 %32
}

LLVM IR (-O2):
define i32 @xrop3_26_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = zext i8 %1 to i32
%6 = shl nuw nsw i32 %5, 8
%7 = or i32 %6, %5
%8 = and i32 %6, %4
%9 = or i32 %8, 255
%10 = xor i32 %9, %7
ret i32 %10
}
int am_setconfig_float(const char *path, float value) { return -1; }


x86 assembly (clang, -O0):
<am_setconfig_float>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @am_setconfig_float(i8* %0, float %1) {
%3 = alloca i8*
%4 = alloca float
store i8* %0, i8** %3
store float %1, float* %4
ret i32 -1
}

LLVM IR (-O2):
define i32 @am_setconfig_float(i8* nocapture readnone %0, float %1) {
ret i32 -1
}
int list_max_size(void) { return 32; }


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

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

LLVM IR (-O0):
define i32 @list_max_size() {
ret i32 32
}

LLVM IR (-O2):
define i32 @list_max_size() {
ret i32 32
}
char f(int i) {
  char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
  return ram_split[i][0];
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2d22(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2d1f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2d1c(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2d19(%rip),%rax
mov    %rax,-0x18(%rbp)
movslq -0x4(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
movsbl (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movslq %edi,%rax
lea    0xf06(%rip),%rcx
movslq (%rcx,%rax,4),%rax
mov    (%rax,%rcx,1),%al
ret

LLVM IR (-O0):
@.str = [4 x i8] c"5:3\00"
@.str.1 = [4 x i8] c"3:1\00"
@.str.2 = [4 x i8] c"1:1\00"
@.str.3 = [4 x i8] c"3:5\00"
@__const.f.ram_split = [4 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0)]
define signext i8 @f(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i8*]
store i32 %0, i32* %2
%4 = bitcast [4 x i8*]* %3 to i8*
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 %6
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
ret i8 %10
}

LLVM IR (-O2):
@.str = [4 x i8] c"5:3\00"
@.str.1 = [4 x i8] c"3:1\00"
@.str.2 = [4 x i8] c"1:1\00"
@.str.3 = [4 x i8] c"3:5\00"
@reltable.f = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.f to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.f to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.f to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.f to i64)) to i32)]
define signext i8 @f(i32 %0) {
%2 = sext i32 %0 to i64
%3 = shl i64 %2, 2
%4 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.f to i8*), i64 %3)
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ s_str_test_char();
int /*<<< orphan*/ s_str_test_readNum();
int /*<<< orphan*/ s_string_replace();
int /*<<< orphan*/ s_string_test();
int /*<<< orphan*/ s_stringlist_test();
void s_str_test() {
  s_str_test_char();
  s_str_test_readNum();
  s_string_test();
  s_string_replace();
  s_stringlist_test();
}


x86 assembly (clang, -O0):
<s_str_test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <s_str_test_char@plt>
mov    $0x0,%al
call   1040 <s_str_test_readNum@plt>
mov    $0x0,%al
call   1060 <s_string_test@plt>
mov    $0x0,%al
call   1030 <s_string_replace@plt>
mov    $0x0,%al
call   1070 <s_stringlist_test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_str_test>:
push   %rax
xor    %eax,%eax
call   1050 <s_str_test_char@plt>
xor    %eax,%eax
call   1040 <s_str_test_readNum@plt>
xor    %eax,%eax
call   1060 <s_string_test@plt>
xor    %eax,%eax
call   1030 <s_string_replace@plt>
xor    %eax,%eax
pop    %rcx
jmp    1070 <s_stringlist_test@plt>

LLVM IR (-O0):
define void @s_str_test() {
%1 = call i32 (...) @s_str_test_char()
%2 = call i32 (...) @s_str_test_readNum()
%3 = call i32 (...) @s_string_test()
%4 = call i32 (...) @s_string_replace()
%5 = call i32 (...) @s_stringlist_test()
ret void
}

LLVM IR (-O2):
define void @s_str_test() {
%1 = tail call i32 (...) @s_str_test_char()
%2 = tail call i32 (...) @s_str_test_readNum()
%3 = tail call i32 (...) @s_string_test()
%4 = tail call i32 (...) @s_string_replace()
%5 = tail call i32 (...) @s_stringlist_test()
ret void
}
void gdk_set_locale() {}


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

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

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

LLVM IR (-O2):
define void @gdk_set_locale() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ HplMsp430GeneralIOP__12__IO__makeOutput();
void Msp430GpioC__11__HplGeneralIO__makeOutput(void) {
  HplMsp430GeneralIOP__12__IO__makeOutput();
}


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

x86 assembly (clang, -O2):
<Msp430GpioC__11__HplGeneralIO__makeOutput>:
xor    %eax,%eax
jmp    1030 <HplMsp430GeneralIOP__12__IO__makeOutput@plt>

LLVM IR (-O0):
define void @Msp430GpioC__11__HplGeneralIO__makeOutput() {
%1 = call i32 (...) @HplMsp430GeneralIOP__12__IO__makeOutput()
ret void
}

LLVM IR (-O2):
define void @Msp430GpioC__11__HplGeneralIO__makeOutput() {
%1 = tail call i32 (...) @HplMsp430GeneralIOP__12__IO__makeOutput()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ debug_ol(char *);
int /*<<< orphan*/ ol(char *);
swap() {
  debug_ol("; swap");
  ol("xgdx");
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <debug_ol@plt>
lea    0xecc(%rip),%rdi
call   1030 <ol@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <debug_ol@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <ol@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"; swap\00"
@.str.1 = [5 x i8] c"xgdx\00"
define i32 @swap() {
%1 = alloca i32
%2 = call i32 @debug_ol(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @ol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [7 x i8] c"; swap\00"
@.str.1 = [5 x i8] c"xgdx\00"
define i32 @swap() {
%1 = tail call i32 @debug_ol(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @ol(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 undef
}
int local_endian() {
  union {
    unsigned char byte;
    short word;
  } test;
  test.word = 01;
  return !test.byte;
}


x86 assembly (clang, -O0):
<local_endian>:
push   %rbp
mov    %rsp,%rbp
movw   $0x1,-0x8(%rbp)
cmpb   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i16 }
define i32 @local_endian() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i16*
store i16 1, i16* %2
%3 = bitcast %union.anon* %1 to i8*
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @local_endian() {
ret i32 0
}
void mpp_sum_int(int count, int *data) {}


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

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

LLVM IR (-O0):
define void @mpp_sum_int(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
ret void
}

LLVM IR (-O2):
define void @mpp_sum_int(i32 %0, i32* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ stderr;
void pqueue_allocation_error() {
  fprintf(stderr, "Memory allocation failed.\n %s: %d\n",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/mbabic/OptimizationProblems/refs/heads/"
          "master/knapsack/src/pqueue.c",
          19);
  exit(1);
}


x86 assembly (clang, -O0):
<pqueue_allocation_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xee8(%rip),%rdx
mov    $0x13,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<pqueue_allocation_error>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xeeb(%rip),%rdx
mov    $0x13,%ecx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Memory allocation failed.\0A %s: %d\0A\00"
@.str.1 = [158 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mbabic/OptimizationProblems/refs/heads/master/knapsack/src/pqueue.c\00"
define void @pqueue_allocation_error() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0), i32 19)
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Memory allocation failed.\0A %s: %d\0A\00"
@.str.1 = [158 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/mbabic/OptimizationProblems/refs/heads/master/knapsack/src/pqueue.c\00"
define void @pqueue_allocation_error() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str.1, i64 0, i64 0), i32 19)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void sound_flush(void) {}


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

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

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

LLVM IR (-O2):
define void @sound_flush() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void HelloWorld(void) { printf("Hello world!"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world!\00"
define void @HelloWorld() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world!\00"
define void @HelloWorld() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int GLUT_UP;
int /*<<< orphan*/ printf(char *, int, char *, int, int);
void mouse(int button, int state, int x, int y) {
  printf("button: %d %s %d,%d\n", button, state == GLUT_UP ? "UP" : "down", x,
         y);
}


x86 assembly (clang, -O0):
<mouse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%ecx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rdx
lea    0xed4(%rip),%rax
cmp    %edi,%ecx
cmove  %rax,%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mouse>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %edi,%eax
mov    0x2ec2(%rip),%rdx
cmp    %esi,(%rdx)
lea    0xeee(%rip),%rsi
lea    0xeea(%rip),%rdx
cmove  %rsi,%rdx
lea    0xec7(%rip),%rdi
mov    %eax,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"button: %d %s %d,%d\0A\00"
@GLUT_UP = global i32 0
@.str.1 = [3 x i8] c"UP\00"
@.str.2 = [5 x i8] c"down\00"
define void @mouse(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* @GLUT_UP
%12 = icmp eq i32 %10, %11
%13 = zext i1 %12 to i64
%14 = select i1 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %14, i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"button: %d %s %d,%d\0A\00"
@GLUT_UP = global i32 0
@.str.1 = [3 x i8] c"UP\00"
@.str.2 = [5 x i8] c"down\00"
define void @mouse(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @GLUT_UP
%6 = icmp eq i32 %5, %1
%7 = select i1 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %7, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void badfunction() { puts("maliciously delicious!"); }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"maliciously delicious!\00"
define void @badfunction() {
%1 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"maliciously delicious!\00"
define void @badfunction() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}
int btic2f_clamp(int v, int m, int n) {
  if (v < m)
    return (m);
  if (v > n)
    return (n);
  return (v);
}


x86 assembly (clang, -O0):
<btic2f_clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1124 <btic2f_clamp+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <btic2f_clamp+0x41>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    113b <btic2f_clamp+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <btic2f_clamp+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<btic2f_clamp>:
mov    %edx,%eax
cmp    %edx,%edi
cmovle %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @btic2f_clamp(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ swap64(int /*<<< orphan*/);
uint64_t be64(uint64_t val) { return swap64(val); }


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

x86 assembly (clang, -O2):
<be64>:
jmp    1030 <swap64@plt>

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

LLVM IR (-O2):
define i32 @be64(i32 %0) {
%2 = tail call i32 @swap64(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ LPUART3_DriverIRQHandler();
__attribute__((weak)) void LPUART3_IRQHandler(void) {
  LPUART3_DriverIRQHandler();
}


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

x86 assembly (clang, -O2):
<LPUART3_IRQHandler>:
xor    %eax,%eax
jmp    1030 <LPUART3_DriverIRQHandler@plt>

LLVM IR (-O0):
define weak void @LPUART3_IRQHandler() {
%1 = call i32 (...) @LPUART3_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @LPUART3_IRQHandler() {
%1 = tail call i32 (...) @LPUART3_DriverIRQHandler()
ret void
}
const char *opj_version(void) { return "2.0.0"; }


x86 assembly (clang, -O0):
<opj_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<opj_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"2.0.0\00"
define i8* @opj_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"2.0.0\00"
define i8* @opj_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
int is_whitespace(char c) { return c == ' ' || c == '\t'; }


x86 assembly (clang, -O0):
<is_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     1129 <is_whitespace+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_whitespace>:
cmp    $0x20,%dil
sete   %al
cmp    $0x9,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @is_whitespace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 9
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_whitespace(i8 signext %0) {
%2 = icmp eq i8 %0, 32
%3 = icmp eq i8 %0, 9
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
void rop3_48_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~S;
  stk1 = T & stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_48_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 -0x9(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%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_48_1_0>:
mov    (%rdi),%al
xor    %dl,%al
and    %sil,%al
xor    %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_48_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
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8, i8* %6
%14 = zext i8 %13 to i32
%15 = load i8, i8* %8
%16 = zext i8 %15 to i32
%17 = and i32 %14, %16
%18 = trunc i32 %17 to i8
store i8 %18, i8* %7
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = xor i32 %22, -1
%24 = and i32 %20, %23
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = load i8, i8* %5
%29 = zext i8 %28 to i32
%30 = and i32 %27, %29
%31 = or i32 %24, %30
%32 = trunc i32 %31 to i8
%33 = load i8*, i8** %4
store i8 %32, i8* %33
ret void
}

LLVM IR (-O2):
define void @rop3_48_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, -1
%5 = and i8 %4, %2
%6 = load i8, i8* %0
%7 = and i8 %6, %1
%8 = or i8 %7, %5
store i8 %8, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ redecl5();
void use132() { redecl5(); }


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

x86 assembly (clang, -O2):
<use132>:
xor    %eax,%eax
jmp    1030 <redecl5@plt>

LLVM IR (-O0):
define void @use132() {
%1 = call i32 (...) @redecl5()
ret void
}

LLVM IR (-O2):
define void @use132() {
%1 = tail call i32 (...) @redecl5()
ret void
}
/* Variables and functions */
int tuner_set_freq(void *, unsigned short, unsigned int, unsigned char);
int bbm_com_tuner_set_freq(void *handle, unsigned short devid,
                           unsigned int freq, unsigned char subch) {
  int res;
  res = tuner_set_freq(handle, devid, freq, subch);
  return res;
}


x86 assembly (clang, -O0):
<bbm_com_tuner_set_freq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cl,%al
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
mov    -0x10(%rbp),%edx
movzwl %ax,%esi
movzbl -0x11(%rbp),%ecx
call   1030 <tuner_set_freq@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bbm_com_tuner_set_freq>:
jmp    1030 <tuner_set_freq@plt>

LLVM IR (-O0):
define i32 @bbm_com_tuner_set_freq(i8* %0, i16 zeroext %1, i32 %2, i8 zeroext %3) {
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
store i8* %0, i8** %5
store i16 %1, i16* %6
store i32 %2, i32* %7
store i8 %3, i8* %8
%10 = load i8*, i8** %5
%11 = load i16, i16* %6
%12 = load i32, i32* %7
%13 = load i8, i8* %8
%14 = call i32 @tuner_set_freq(i8* %10, i16 zeroext %11, i32 %12, i8 zeroext %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
ret i32 %15
}

LLVM IR (-O2):
define i32 @bbm_com_tuner_set_freq(i8* %0, i16 zeroext %1, i32 %2, i8 zeroext %3) {
%5 = tail call i32 @tuner_set_freq(i8* %0, i16 zeroext %1, i32 %2, i8 zeroext %3)
ret i32 %5
}
void i_commercial(struct city *the_city, char *l) {}


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

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

LLVM IR (-O0):
%struct.city = type opaque
define void @i_commercial(%struct.city* %0, i8* %1) {
%3 = alloca %struct.city*
%4 = alloca i8*
store %struct.city* %0, %struct.city** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
%struct.city = type opaque
define void @i_commercial(%struct.city* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void fail(char *reason) {
  perror(reason);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rax
call   1030 <perror@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @fail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @fail(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
float km_to_nm(float km) { return km / 1.852; }


x86 assembly (clang, -O0):
<km_to_nm>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<km_to_nm>:
cvtss2sd %xmm0,%xmm0
divsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @km_to_nm(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fdiv double %4, 1.852000e+00
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @km_to_nm(float %0) {
%2 = fpext float %0 to double
%3 = fdiv double %2, 1.852000e+00
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
int syscall(int, char const *, int /*<<< orphan*/);
int umount(const char *special) { return syscall(52, special, 0); }


x86 assembly (clang, -O0):
<umount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0x34,%edi
xor    %edx,%edx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umount>:
mov    %rdi,%rsi
mov    $0x34,%edi
xor    %edx,%edx
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @umount(i8* %0) {
%2 = tail call i32 @syscall(i32 52, i8* %0, i32 0)
ret i32 %2
}
void gtk_window_set_default_icon() {}


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

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

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

LLVM IR (-O2):
define void @gtk_window_set_default_icon() {
ret void
}