xunge/DecIR huggingface dataset:
/* Type definitions */
struct snck_string {
  int dummy;
};
struct snck_ctxt {
  int dummy;
};

/* Variables and functions */
char snck_string_ref_buffer(struct snck_ctxt const *const,
                            struct snck_string *const, char const *const,
                            int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *const);
char snck_string_ref(struct snck_ctxt const *const p_ctxt,
                     struct snck_string *const p_string,
                     char const *const p_ref) {
  return snck_string_ref_buffer(p_ctxt, p_string, p_ref, strlen(p_ref));
}


x86 assembly (clang, -O0):
<snck_string_ref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
call   1040 <snck_string_ref_buffer@plt>
movsbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snck_string_ref>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <snck_string_ref_buffer@plt>

LLVM IR (-O0):
%struct.snck_ctxt = type { i32 }
%struct.snck_string = type { i32 }
define signext i8 @snck_string_ref(%struct.snck_ctxt* %0, %struct.snck_string* %1, i8* %2) {
%4 = alloca %struct.snck_ctxt*
%5 = alloca %struct.snck_string*
%6 = alloca i8*
store %struct.snck_ctxt* %0, %struct.snck_ctxt** %4
store %struct.snck_string* %1, %struct.snck_string** %5
store i8* %2, i8** %6
%7 = load %struct.snck_ctxt*, %struct.snck_ctxt** %4
%8 = load %struct.snck_string*, %struct.snck_string** %5
%9 = load i8*, i8** %6
%10 = load i8*, i8** %6
%11 = call i32 @strlen(i8* %10)
%12 = call signext i8 @snck_string_ref_buffer(%struct.snck_ctxt* %7, %struct.snck_string* %8, i8* %9, i32 %11)
ret i8 %12
}

LLVM IR (-O2):
%struct.snck_ctxt = type { i32 }
%struct.snck_string = type { i32 }
define signext i8 @snck_string_ref(%struct.snck_ctxt* %0, %struct.snck_string* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %2)
%5 = tail call signext i8 @snck_string_ref_buffer(%struct.snck_ctxt* %0, %struct.snck_string* %1, i8* %2, i32 %4)
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ write_src(char *);
void lt_handler(void) {
  write_src("{\n");
  write_src("imm_t b = POP();\n");
  write_src("imm_t a = POP();\n");
  write_src("PUSH(a<b);\n");
  write_src("}\n");
}


x86 assembly (clang, -O0):
<lt_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <write_src@plt>
lea    0xedc(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee2(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lt_handler>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <write_src@plt>
lea    0xedf(%rip),%rdi
call   1030 <write_src@plt>
lea    0xee5(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeeb(%rip),%rdi
call   1030 <write_src@plt>
lea    0xeeb(%rip),%rdi
pop    %rax
jmp    1030 <write_src@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [18 x i8] c"imm_t b = POP();\0A\00"
@.str.2 = [18 x i8] c"imm_t a = POP();\0A\00"
@.str.3 = [12 x i8] c"PUSH(a<b);\0A\00"
@.str.4 = [3 x i8] c"}\0A\00"
define void @lt_handler() {
%1 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @write_src(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [18 x i8] c"imm_t b = POP();\0A\00"
@.str.2 = [18 x i8] c"imm_t a = POP();\0A\00"
@.str.3 = [12 x i8] c"PUSH(a<b);\0A\00"
@.str.4 = [3 x i8] c"}\0A\00"
define void @lt_handler() {
%1 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @write_src(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @write_src(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%5 = tail call i32 @write_src(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a, b;
  a = 8;
  b = 9;
  printf("a = %d\n", a);
  printf("b = %d\n", b);
  printf("a + b = %d\n", a + b);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x11,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"a = %d\0A\00"
@.str.1 = [8 x i8] c"b = %d\0A\00"
@.str.2 = [12 x i8] c"a + b = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %2
store i32 9, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"a = %d\0A\00"
@.str.1 = [8 x i8] c"b = %d\0A\00"
@.str.2 = [12 x i8] c"a + b = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 8)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 9)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 17)
ret i32 0
}
unsigned kol_event_check() { asm("int $0x40" ::"a"(11)); }


x86 assembly (clang, -O0):
<kol_event_check>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb,%eax
int    $0x40
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_event_check>:
mov    $0xb,%eax
int    $0x40
ret

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

LLVM IR (-O2):
define i32 @kol_event_check() {
tail call void asm sideeffect "int $$0x40", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 11)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ delchar(char *, char);
char getchar();
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char s[30], del;
  printf("...");
  gets(s);
  printf("....");
  del = getchar();
  delchar(s, del);
  printf("%s\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1060 <gets@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x31(%rbp)
lea    -0x30(%rbp),%rdi
movsbl -0x31(%rbp),%esi
call   1040 <delchar@plt>
lea    -0x30(%rbp),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <gets@plt>
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
movsbl %al,%esi
mov    %rbx,%rdi
call   1050 <delchar@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"...\00"
@.str.1 = [5 x i8] c"....\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%6 = call i32 @gets(i8* %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %3
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%10 = load i8, i8* %3
%11 = call i32 @delchar(i8* %9, i8 signext %10)
%12 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"...\00"
@.str.1 = [5 x i8] c"....\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = call signext i8 (...) @getchar()
%7 = call i32 @delchar(i8* %2, i8 signext %6)
%8 = call i32 @puts(i8* %2)
ret i32 0
}
/* Variables and functions */
int SIGINT;
void sigint(int signo) {
  if (signo == SIGINT) {
    return;
  }
}


x86 assembly (clang, -O0):
<sigint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ed7(%rip),%rcx
cmp    (%rcx),%eax
jne    111e <sigint+0x1e>
jmp    111e <sigint+0x1e>
pop    %rbp
ret

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

LLVM IR (-O0):
@SIGINT = global i32 0
define void @sigint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGINT
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %7
6: ; preds = %1
br label %7
7: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@SIGINT = global i32 0
define void @sigint(i32 %0) {
ret void
}
int escape_char(int chr) {
  switch (chr) {
  case '\t':
    return 't';
  case '\n':
    return 'n';
  case '\r':
    return 'r';
  case '\\':
  case '"':
    return chr;
  }
  return 0;
}


x86 assembly (clang, -O0):
<escape_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x9,%eax
je     115f <escape_char+0x5f>
jmp    111b <escape_char+0x1b>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     116b <escape_char+0x6b>
jmp    112c <escape_char+0x2c>
mov    -0xc(%rbp),%eax
sub    $0xd,%eax
je     1177 <escape_char+0x77>
jmp    113d <escape_char+0x3d>
mov    -0xc(%rbp),%eax
sub    $0x22,%eax
je     1183 <escape_char+0x83>
jmp    114e <escape_char+0x4e>
mov    -0xc(%rbp),%eax
sub    $0x5c,%eax
je     1183 <escape_char+0x83>
jmp    118e <escape_char+0x8e>
movl   $0x74,-0x4(%rbp)
jmp    1195 <escape_char+0x95>
movl   $0x6e,-0x4(%rbp)
jmp    1195 <escape_char+0x95>
movl   $0x72,-0x4(%rbp)
jmp    1195 <escape_char+0x95>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1195 <escape_char+0x95>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<escape_char>:
lea    -0x9(%rdi),%ecx
cmp    $0x19,%ecx
ja     1123 <escape_char+0x23>
mov    $0x74,%eax
lea    0xeec(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x6e,%eax
ret
mov    %edi,%eax
cmp    $0x5c,%edi
je     1135 <escape_char+0x35>
xor    %eax,%eax
ret
mov    $0x72,%eax
ret
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @escape_char(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 9, label %5
i32 10, label %6
i32 13, label %7
i32 92, label %8
i32 34, label %8
]
5: ; preds = %1
store i32 116, i32* %2
br label %11
6: ; preds = %1
store i32 110, i32* %2
br label %11
7: ; preds = %1
store i32 114, i32* %2
br label %11
8: ; preds = %1, %1
%9 = load i32, i32* %3
store i32 %9, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %8, %7, %6, %5
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @escape_char(i32 %0) {
switch i32 %0, label %5 [
i32 9, label %6
i32 10, label %2
i32 13, label %3
i32 92, label %4
i32 34, label %4
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1, %1
br label %6
5: ; preds = %1
br label %6
6: ; preds = %1, %5, %4, %3, %2
%7 = phi i32 [ 0, %5 ], [ %0, %4 ], [ 114, %3 ], [ 110, %2 ], [ 116, %1 ]
ret i32 %7
}
void gtk_layout_set_hadjustment() {}


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

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

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

LLVM IR (-O2):
define void @gtk_layout_set_hadjustment() {
ret void
}
unsigned int convert_unsigned_int_to_unsigned_int(unsigned int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @convert_unsigned_int_to_unsigned_int(i32 returned %0) {
ret i32 %0
}
void tv8532_setcolors(struct usb_spca50x *spca50x) {}


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

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

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

LLVM IR (-O2):
%struct.usb_spca50x = type opaque
define void @tv8532_setcolors(%struct.usb_spca50x* nocapture %0) {
ret void
}
int result_sort_cb(const void *pa, const void *pb) {
  int a = *(int *)pa;
  int b = *(int *)pb;
  if (a > b)
    return -1;
  if (a == b)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<result_sort_cb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1136 <result_sort_cb+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <result_sort_cb+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    114e <result_sort_cb+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1155 <result_sort_cb+0x55>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<result_sort_cb>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @result_sort_cb(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp ne i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int f2();
int f4(void) { return f2() + 4; }


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <f2@plt>
add    $0x4,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
push   %rax
xor    %eax,%eax
call   1030 <f2@plt>
add    $0x4,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @f4() {
%1 = call i32 (...) @f2()
%2 = add nsw i32 %1, 4
ret i32 %2
}

LLVM IR (-O2):
define i32 @f4() {
%1 = tail call i32 (...) @f2()
%2 = add nsw i32 %1, 4
ret i32 %2
}
/* Variables and functions */
void **alien_pointer();
int /*<<< orphan*/ dpop();
void *pinned_alien_offset(int /*<<< orphan*/);
void primitive_set_alien_cell(void) {
  void **ptr = alien_pointer();
  void *value = pinned_alien_offset(dpop());
  *ptr = value;
}


x86 assembly (clang, -O0):
<primitive_set_alien_cell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <alien_pointer@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <dpop@plt>
mov    %eax,%edi
call   1050 <pinned_alien_offset@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<primitive_set_alien_cell>:
push   %rbx
xor    %eax,%eax
call   1040 <alien_pointer@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1030 <dpop@plt>
mov    %eax,%edi
call   1050 <pinned_alien_offset@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @primitive_set_alien_cell() {
%1 = alloca i8**
%2 = alloca i8*
%3 = call i8** (...) @alien_pointer()
store i8** %3, i8*** %1
%4 = call i32 (...) @dpop()
%5 = call i8* @pinned_alien_offset(i32 %4)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = load i8**, i8*** %1
store i8* %6, i8** %7
ret void
}

LLVM IR (-O2):
define void @primitive_set_alien_cell() {
%1 = tail call i8** (...) @alien_pointer()
%2 = tail call i32 (...) @dpop()
%3 = tail call i8* @pinned_alien_offset(i32 %2)
store i8* %3, i8** %1
ret void
}
int aeron_net_init() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @aeron_net_init() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int sum = 0;
  int i = 0;
  while (i < 11) {
    sum += i;
    i++;
  }
  printf("%d\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xb,-0xc(%rbp)
jge    114e <main+0x3e>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 55)
ret i32 0
}
void SteamAPI_ISteamHTMLSurface_SetHorizontalScroll(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


x86 assembly (clang, -O0):
<SteamAPI_ISteamHTMLSurface_SetHorizontalScroll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <xlogf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SteamAPI_ISteamHTMLSurface_SetHorizontalScroll>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_SetHorizontalScroll = [47 x i8] c"SteamAPI_ISteamHTMLSurface_SetHorizontalScroll\00"
define void @SteamAPI_ISteamHTMLSurface_SetHorizontalScroll(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_SetHorizontalScroll, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_SetHorizontalScroll = [47 x i8] c"SteamAPI_ISteamHTMLSurface_SetHorizontalScroll\00"
define void @SteamAPI_ISteamHTMLSurface_SetHorizontalScroll(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_SetHorizontalScroll, i64 0, i64 0), i8* %0)
ret void
}
int fallback_equal(char *typ, char *val, char *s, int n) { return 1; }


x86 assembly (clang, -O0):
<fallback_equal>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fallback_equal(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
ret i32 1
}
int isOrdered(int A[], int length) {
  int i;
  for (i = 0; i <= length - 2; i++) {
    if (A[i] > A[i + 1]) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<isOrdered>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     1163 <isOrdered+0x63>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1150 <isOrdered+0x50>
movl   $0x0,-0x4(%rbp)
jmp    116a <isOrdered+0x6a>
jmp    1155 <isOrdered+0x55>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <isOrdered+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOrdered>:
add    $0xfffffffe,%esi
mov    $0xffffffff,%eax
cmovns %esi,%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    %rcx,%rax
je     1128 <isOrdered+0x28>
mov    (%rdi,%rcx,4),%edx
lea    0x1(%rcx),%rsi
cmp    0x4(%rdi,%rcx,4),%edx
mov    %rsi,%rcx
jle    1110 <isOrdered+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @isOrdered(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -2
%4 = call i32 @llvm.smax.i32(i32 %3, i32 -1)
%5 = add i32 %4, 1
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %10, %2
%8 = phi i64 [ %13, %10 ], [ 0, %2 ]
%9 = icmp eq i64 %8, %6
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = getelementptr inbounds i32, i32* %0, i64 %8
%12 = load i32, i32* %11
%13 = add nuw nsw i64 %8, 1
%14 = getelementptr inbounds i32, i32* %0, i64 %13
%15 = load i32, i32* %14
%16 = icmp sgt i32 %12, %15
br i1 %16, label %17, label %7
17: ; preds = %7, %10
%18 = phi i32 [ 0, %10 ], [ 1, %7 ]
ret i32 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int ftruncate(int, int /*<<< orphan*/);
int octave_ftruncate_wrapper(int fd, off_t sz) { return ftruncate(fd, sz); }


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

x86 assembly (clang, -O2):
<octave_ftruncate_wrapper>:
jmp    1030 <ftruncate@plt>

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

LLVM IR (-O2):
define i32 @octave_ftruncate_wrapper(i32 %0, i32 %1) {
%3 = tail call i32 @ftruncate(i32 %0, i32 %1)
ret i32 %3
}
int comprueba_numero_repetido(int num, int primitiva[]) {}


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

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

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

LLVM IR (-O2):
define i32 @comprueba_numero_repetido(i32 %0, i32* nocapture readnone %1) {
ret i32 undef
}
unsigned int w_rev_dword(unsigned int d) {
  unsigned int rev_d = 0;
  unsigned int mask = 0x000000FF;
  unsigned char temp_b;
  temp_b = d & mask;
  rev_d += temp_b;
  int i, step;
  for (i = 0, step = 8; i < 3; i++, step += 8) {
    rev_d <<= 8;
    mask <<= 8;
    temp_b = (unsigned char)((d & mask) >> step);
    rev_d += temp_b;
  }
  return rev_d;
}


x86 assembly (clang, -O0):
<w_rev_dword>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xff,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x8,-0x18(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1181 <w_rev_dword+0x81>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x18(%rbp),%ecx
shr    %cl,%eax
mov    %al,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x18(%rbp)
jmp    1136 <w_rev_dword+0x36>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @w_rev_dword(i32 %0) {
%2 = call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ RNG_DriverIRQHandler();
__attribute__((weak)) void RNG_IRQHandler(void) { RNG_DriverIRQHandler(); }


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

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

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

LLVM IR (-O2):
define weak void @RNG_IRQHandler() {
%1 = tail call i32 (...) @RNG_DriverIRQHandler()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ MYSQL_STMT;
typedef int /*<<< orphan*/ MYSQL;

/* Variables and functions */
int /*<<< orphan*/ mysql_close(int /*<<< orphan*/ *);
int /*<<< orphan*/ mysql_stmt_close(int /*<<< orphan*/ *);
void db_end(MYSQL *inst, MYSQL_STMT *stmt) {
  mysql_stmt_close(stmt);
  mysql_close(inst);
}


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

x86 assembly (clang, -O2):
<db_end>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <mysql_stmt_close@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <mysql_close@plt>

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

LLVM IR (-O2):
define void @db_end(i32* %0, i32* %1) {
%3 = tail call i32 @mysql_stmt_close(i32* %1)
%4 = tail call i32 @mysql_close(i32* %0)
ret void
}
void glPopClientAttrib(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glPopClientAttrib() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
void write_version(int version) {
  FILE *fp = fopen("/usr/local/share/intangd/"
                   "version",
                   "w");
  fprintf(fp, "%d", version);
  fclose(fp);
}


x86 assembly (clang, -O0):
<write_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec3(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_version>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xec4(%rip),%rdi
lea    0xede(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xed1(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"/usr/local/share/intangd/version\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [3 x i8] c"%d\00"
define void @write_version(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i32* @fopen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = load i32, i32* %2
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32*, i32** %3
%9 = call i32 @fclose(i32* %8)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"/usr/local/share/intangd/version\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [3 x i8] c"%d\00"
define void @write_version(i32 %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %0)
%4 = tail call i32 @fclose(i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ msg(char *);
int /*<<< orphan*/ printStackTrace();
void segv_handler(int sig) {
  msg("SEGV detected!\n");
  printStackTrace();
  _exit(10);
}


x86 assembly (clang, -O0):
<segv_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1050 <msg@plt>
mov    $0x0,%al
call   1040 <printStackTrace@plt>
mov    $0xa,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<segv_handler>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <msg@plt>
xor    %eax,%eax
call   1040 <printStackTrace@plt>
mov    $0xa,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"SEGV detected!\0A\00"
define void @segv_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @msg(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @printStackTrace()
%5 = call i32 @_exit(i32 10)
unreachable
}

LLVM IR (-O2):
@.str = [16 x i8] c"SEGV detected!\0A\00"
define void @segv_handler(i32 %0) {
%2 = tail call i32 @msg(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @printStackTrace()
%4 = tail call i32 @_exit(i32 10)
unreachable
}
int elg_pform_num_cpus() { return 8; }


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

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

LLVM IR (-O0):
define i32 @elg_pform_num_cpus() {
ret i32 8
}

LLVM IR (-O2):
define i32 @elg_pform_num_cpus() {
ret i32 8
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ mbus_remote_register_write(int, int, int);
void pmu_adc_enable() {
  mbus_remote_register_write(0x6, 0x3B,
                             ((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) |
                              (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7) |
                              (1 << 8) | (1 << 9) | (1 << 10) | (1 << 11) |
                              (0 << 12) | (1 << 13) | (1 << 14) | (1 << 15) |
                              (1 << 16) | (1 << 17) | (1 << 18) | (1 << 19)));
  delay(100);
}


x86 assembly (clang, -O0):
<pmu_adc_enable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6,%edi
mov    $0x3b,%esi
mov    $0xfefff,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
call   1030 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_adc_enable>:
push   %rax
mov    $0x6,%edi
mov    $0x3b,%esi
mov    $0xfefff,%edx
call   1040 <mbus_remote_register_write@plt>
mov    $0x64,%edi
pop    %rax
jmp    1030 <delay@plt>

LLVM IR (-O0):
define void @pmu_adc_enable() {
%1 = call i32 @mbus_remote_register_write(i32 6, i32 59, i32 1044479)
%2 = call i32 @delay(i32 100)
ret void
}

LLVM IR (-O2):
define void @pmu_adc_enable() {
%1 = tail call i32 @mbus_remote_register_write(i32 6, i32 59, i32 1044479)
%2 = tail call i32 @delay(i32 100)
ret void
}
void rop3_40_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = T ^ S;
  stk1 = *D & stk2;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_40_0_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
movzbl -0x9(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_40_0_0>:
xor    %edx,%esi
and    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_40_0_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* %6
%10 = zext i8 %9 to i32
%11 = load i8, i8* %5
%12 = zext i8 %11 to i32
%13 = xor i32 %10, %12
%14 = trunc i32 %13 to i8
store i8 %14, i8* %8
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = load i8, i8* %8
%19 = zext i8 %18 to i32
%20 = and i32 %17, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = load i8*, i8** %4
store i8 %22, i8* %23
ret void
}

LLVM IR (-O2):
define void @rop3_40_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %2, %1
%5 = load i8, i8* %0
%6 = and i8 %5, %4
store i8 %6, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char const *, ...);
void uninitvar_sscanf(void) {
  char *string;
  const char *format;
  int i;
  (void)sscanf(string, format);
  (void)sscanf(string, format, &i);
}


x86 assembly (clang, -O0):
<uninitvar_sscanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <sscanf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1030 <sscanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninitvar_sscanf>:
push   %rax
xor    %eax,%eax
call   1030 <sscanf@plt>
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1030 <sscanf@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @uninitvar_sscanf() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = load i8*, i8** %1
%5 = load i8*, i8** %2
%6 = call i32 (i8*, i8*, ...) @sscanf(i8* %4, i8* %5)
%7 = load i8*, i8** %1
%8 = load i8*, i8** %2
%9 = call i32 (i8*, i8*, ...) @sscanf(i8* %7, i8* %8, i32* %3)
ret void
}

LLVM IR (-O2):
define void @uninitvar_sscanf() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, i8*, ...) @sscanf(i8* undef, i8* undef)
%4 = call i32 (i8*, i8*, ...) @sscanf(i8* undef, i8* undef, i32* %1)
ret void
}
void aperturaPuertas() {}


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

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

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

LLVM IR (-O2):
define void @aperturaPuertas() {
ret void
}
void parseMessage(char *buff) {
  if (buff[1] == '.') {
    if (buff[0] == '1') {
    }
    if (buff[0] == '2') {
    }
  }
}


x86 assembly (clang, -O0):
<parseMessage>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2e,%eax
jne    1148 <parseMessage+0x48>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x31,%eax
jne    112e <parseMessage+0x2e>
jmp    112e <parseMessage+0x2e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x32,%eax
jne    1143 <parseMessage+0x43>
jmp    1143 <parseMessage+0x43>
jmp    1148 <parseMessage+0x48>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @parseMessage(i8* nocapture %0) {
ret void
}
/* Variables and functions */
double powf(double, unsigned int);
float midiNoteToFrequency(unsigned note) {
  return powf(2.0, ((note - 69.0) / 12.)) * 440.0;
}


x86 assembly (clang, -O0):
<midiNoteToFrequency>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cvtsi2sd %rax,%xmm0
movsd  0xee5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xee1(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,%edi
movsd  0xebe(%rip),%xmm0
call   1030 <powf@plt>
movsd  0xea9(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<midiNoteToFrequency>:
push   %rax
mov    %edi,%eax
cvtsi2sd %rax,%xmm0
addsd  0xee0(%rip),%xmm0
divsd  0xee0(%rip),%xmm0
cvttsd2si %xmm0,%rdi
movsd  0xedb(%rip),%xmm0
call   1030 <powf@plt>
mulsd  0xed6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @midiNoteToFrequency(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = uitofp i32 %3 to double
%5 = fsub double %4, 6.900000e+01
%6 = fdiv double %5, 1.200000e+01
%7 = fptoui double %6 to i32
%8 = call double @powf(double 2.000000e+00, i32 %7)
%9 = fmul double %8, 4.400000e+02
%10 = fptrunc double %9 to float
ret float %10
}

LLVM IR (-O2):
define float @midiNoteToFrequency(i32 %0) {
%2 = uitofp i32 %0 to double
%3 = fadd double %2, -6.900000e+01
%4 = fdiv double %3, 1.200000e+01
%5 = fptoui double %4 to i32
%6 = tail call double @powf(double 2.000000e+00, i32 %5)
%7 = fmul double %6, 4.400000e+02
%8 = fptrunc double %7 to float
ret float %8
}
void b_print_char_with_color(char chr, unsigned char clr) {
  asm volatile("call 0x001001D0" : : "a"(chr), "b"(clr));
}


x86 assembly (clang, -O0):
<b_print_char_with_color>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x9(%rbp),%al
mov    -0xa(%rbp),%bl
call   1001d0 <completed.0+0xfc1b0>
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_print_char_with_color>:
push   %rbx
mov    %esi,%ebx
mov    %edi,%eax
call   1001d0 <completed.0+0xfc1b0>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @b_print_char_with_color(i8 signext %0, i8 zeroext %1) {
tail call void asm sideeffect "call 0x001001D0", "{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i8 %0, i8 %1)
ret void
}
/* Type definitions */
typedef unsigned int uint32_t;
typedef scalar_t__ int32_t;

/* Variables and functions */
__attribute__((always_)) uint32_t __USAT(int32_t val, uint32_t sat) {
  if (sat <= 31U) {
    const uint32_t max = ((1U << sat) - 1U);
    if (val > (int32_t)max) {
      return max;
    } else if (val < 0) {
      return 0U;
    }
  }
  return (uint32_t)val;
}


x86 assembly (clang, -O0):
<__USAT>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x1f,-0x14(%rbp)
ja     1161 <__USAT+0x61>
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
cmp    %rcx,%rax
jle    1140 <__USAT+0x40>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <__USAT+0x68>
cmpq   $0x0,-0x10(%rbp)
jge    1157 <__USAT+0x57>
movl   $0x0,-0x4(%rbp)
jmp    1168 <__USAT+0x68>
jmp    115c <__USAT+0x5c>
jmp    1161 <__USAT+0x61>
mov    -0x10(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__USAT>:
cmp    $0x1f,%esi
ja     111a <__USAT+0x1a>
mov    $0xffffffff,%edx
mov    %esi,%ecx
shl    %cl,%edx
not    %edx
xor    %eax,%eax
cmp    %rdi,%rdx
cmovl  %edx,%eax
jb     111c <__USAT+0x1c>
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @__USAT(i64 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i64 %0, i64* %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp ule i32 %7, 31
br i1 %8, label %9, label %25
9: ; preds = %2
%10 = load i32, i32* %5
%11 = shl i32 1, %10
%12 = sub i32 %11, 1
store i32 %12, i32* %6
%13 = load i64, i64* %4
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = icmp sgt i64 %13, %15
br i1 %16, label %17, label %19
17: ; preds = %9
%18 = load i32, i32* %6
store i32 %18, i32* %3
br label %28
19: ; preds = %9
%20 = load i64, i64* %4
%21 = icmp slt i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 0, i32* %3
br label %28
23: ; preds = %19
br label %24
24: ; preds = %23
br label %25
25: ; preds = %24, %2
%26 = load i64, i64* %4
%27 = trunc i64 %26 to i32
store i32 %27, i32* %3
br label %28
28: ; preds = %25, %22, %17
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @__USAT(i64 %0, i32 %1) {
%3 = icmp ult i32 %1, 32
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = shl nsw i32 -1, %1
%6 = xor i32 %5, -1
%7 = zext i32 %6 to i64
%8 = icmp slt i64 %7, %0
%9 = select i1 %8, i32 %6, i32 0
%10 = icmp ult i64 %7, %0
br i1 %10, label %13, label %11
11: ; preds = %4, %2
%12 = trunc i64 %0 to i32
br label %13
13: ; preds = %4, %11
%14 = phi i32 [ %9, %4 ], [ %12, %11 ]
ret i32 %14
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
char MACHINE_ENDIAN_F(void) {
  uint32_t i = 0x01234567;
  if ((*((uint8_t *)(&i))) == 0x67) {
    return '<';
  } else {
    return '>';
  }
}


x86 assembly (clang, -O0):
<MACHINE_ENDIAN_F>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1234567,-0x8(%rbp)
cmpl   $0x67,-0x8(%rbp)
jne    111e <MACHINE_ENDIAN_F+0x1e>
movb   $0x3c,-0x1(%rbp)
jmp    1122 <MACHINE_ENDIAN_F+0x22>
movb   $0x3e,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MACHINE_ENDIAN_F>:
mov    $0x3e,%al
ret

LLVM IR (-O0):
define signext i8 @MACHINE_ENDIAN_F() {
%1 = alloca i8
%2 = alloca i32
store i32 19088743, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 103
br i1 %4, label %5, label %6
5: ; preds = %0
store i8 60, i8* %1
br label %7
6: ; preds = %0
store i8 62, i8* %1
br label %7
7: ; preds = %6, %5
%8 = load i8, i8* %1
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @MACHINE_ENDIAN_F() {
ret i8 62
}