xunge/DecIR huggingface dataset:
/* 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 /*<<< orphan*/ printf(char *);
void addtomissingheading(char *filename) {
  printf("\n Added the missing header\n");
  FILE *fp = fopen(filename, "a+");
  fprintf(fp, "\n\nMissing Files\n--------\n\n");
  fclose(fp);
}


x86 assembly (clang, -O0):
<addtomissingheading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea8(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addtomissingheading>:
push   %rbx
mov    %rdi,%rbx
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xe9a(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1060 <fwrite@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"\0A Added the missing header\0A\00"
@.str.1 = [3 x i8] c"a+\00"
@.str.2 = [27 x i8] c"\0A\0AMissing Files\0A--------\0A\0A\00"
define void @addtomissingheading(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32*, i32** %3
%10 = call i32 @fclose(i32* %9)
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"a+\00"
@.str.2 = [27 x i8] c"\0A\0AMissing Files\0A--------\0A\0A\00"
@str = [27 x i8] c"\0A Added the missing header\00"
define void @addtomissingheading(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 26, i64 1, i32* %3)
%5 = tail call i32 @fclose(i32* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ write_string(char *);
void error() {
  write_string("sorry, something goes wrong..\n");
  _exit(0);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <write_string@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <write_string@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"sorry, something goes wrong..\0A\00"
define void @error() {
%1 = call i32 @write_string(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [31 x i8] c"sorry, something goes wrong..\0A\00"
define void @error() {
%1 = tail call i32 @write_string(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @_exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void _print_str(const char *s) { fputs(s, stdout); }


x86 assembly (clang, -O0):
<_print_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_print_str>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @_print_str(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdout
%5 = call i32 @fputs(i8* %3, i32 %4)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @_print_str(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fputs(i8* %0, i32 %2)
ret void
}
/* Variables and functions */
scalar_t__ mp_isupper(char);
char mp_tolower(char c) { return mp_isupper(c) ? c - 'A' + 'a' : c; }


x86 assembly (clang, -O0):
<mp_tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <mp_isupper@plt>
cmp    $0x0,%rax
je     1143 <mp_tolower+0x33>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
add    $0x61,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <mp_tolower+0x3a>
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <mp_isupper@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @mp_tolower(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @mp_isupper(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %8, 65
%10 = add nsw i32 %9, 97
br label %14
11: ; preds = %1
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
br label %14
14: ; preds = %11, %6
%15 = phi i32 [ %10, %6 ], [ %13, %11 ]
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define signext i8 @mp_tolower(i8 signext %0) {
%2 = tail call i64 @mp_isupper(i8 signext %0)
%3 = icmp eq i64 %2, 0
%4 = add i8 %0, 32
%5 = select i1 %3, i8 %0, i8 %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ solo5_console_write(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void puts(const char *s) { solo5_console_write(s, strlen(s)); }


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <solo5_console_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <solo5_console_write@plt>

LLVM IR (-O0):
define void @puts(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @solo5_console_write(i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @puts(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @solo5_console_write(i8* %0, i32 %2)
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *get_ext(const char *filename) {
  const char *ext = strrchr(filename, '.');
  if (ext)
    ext++;
  return ext;
}


x86 assembly (clang, -O0):
<get_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1145 <get_ext+0x35>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ext>:
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmovne %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @get_ext(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* null, i8* %4
ret i8* %5
}
int __htclog_print_private(int a1 __attribute__((__unused__)),
                           const char *a2 __attribute__((__unused__)),
                           const char *fmt __attribute__((__unused__)), ...) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @__htclog_print_private(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, ...) {
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ auto_repeats;
};
typedef TYPE_1__ XKeyboardState;

/* Variables and functions */
void *get_XKeyboardState_auto_repeats(void *_p) {
  return (void *)(((XKeyboardState *)_p)->auto_repeats);
}


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

x86 assembly (clang, -O2):
<get_XKeyboardState_auto_repeats>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i8* @get_XKeyboardState_auto_repeats(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = inttoptr i64 %6 to i8*
ret i8* %7
}

LLVM IR (-O2):
define i8* @get_XKeyboardState_auto_repeats(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
double yn(int, double);
double c_yn(int arg0, double arg1) { return yn(arg0, arg1); }


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

x86 assembly (clang, -O2):
<c_yn>:
jmp    1030 <yn@plt>

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

LLVM IR (-O2):
define double @c_yn(i32 %0, double %1) {
%3 = tail call double @yn(i32 %0, double %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ yyy();
void xxx(void) { yyy(); }


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

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

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

LLVM IR (-O2):
define void @xxx() {
%1 = tail call i32 (...) @yyy()
ret void
}
void func0(int var1, int var2) {
  int *addr;
  addr = &var1;
  var2 = *addr;
  var1 = +var2;
  var1 = -var2;
  var1 = ~var2;
  var1 = !var2;
}


x86 assembly (clang, -O0):
<func0>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @func0(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32* %3, i32** %5
%6 = load i32*, i32** %5
%7 = load i32, i32* %6
store i32 %7, i32* %4
%8 = load i32, i32* %4
store i32 %8, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 0, %9
store i32 %10, i32* %3
%11 = load i32, i32* %4
%12 = xor i32 %11, -1
store i32 %12, i32* %3
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 0
%15 = xor i1 %14, true
%16 = zext i1 %15 to i32
store i32 %16, i32* %3
ret void
}

LLVM IR (-O2):
define void @func0(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
struct framerate {
  int dummy;
};

/* Variables and functions */
int framerate_wait(struct framerate *);
int do_callback(struct framerate *fr) { return framerate_wait(fr); }


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

x86 assembly (clang, -O2):
<do_callback>:
jmp    1030 <framerate_wait@plt>

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

LLVM IR (-O2):
%struct.framerate = type { i32 }
define i32 @do_callback(%struct.framerate* %0) {
%2 = tail call i32 @framerate_wait(%struct.framerate* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ has_colors();
int /*<<< orphan*/ start_color();
void start() {
  has_colors();
  start_color();
}


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

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

LLVM IR (-O0):
define void @start() {
%1 = call i32 (...) @has_colors()
%2 = call i32 (...) @start_color()
ret void
}

LLVM IR (-O2):
define void @start() {
%1 = tail call i32 (...) @has_colors()
%2 = tail call i32 (...) @start_color()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf_verbose(char *);
void *jack_client_open(void) {
  printf_verbose("jack_client_open(...) = BLOCKED;");
  return NULL;
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"jack_client_open(...) = BLOCKED;\00"
define i8* @jack_client_open() {
%1 = call i32 @printf_verbose(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@.str = [33 x i8] c"jack_client_open(...) = BLOCKED;\00"
define noalias i8* @jack_client_open() {
%1 = tail call i32 @printf_verbose(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i8* null
}
void __bus_fault_handler() {
  for (;;) {
    __asm__ volatile("nop");
  }
}


x86 assembly (clang, -O0):
<__bus_fault_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <__bus_fault_handler+0x9>
nop
jmp    1109 <__bus_fault_handler+0x9>

x86 assembly (clang, -O2):
<__bus_fault_handler>:
nop
jmp    1100 <__bus_fault_handler>

LLVM IR (-O0):
define void @__bus_fault_handler() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @__bus_fault_handler() {
br label %1
1: ; preds = %1, %0
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ cl_mem;

/* Variables and functions */
int /*<<< orphan*/ clReleaseMemObject(int /*<<< orphan*/);
void delete_memobjs(cl_mem *memobjs, int n) {
  int i;
  for (i = 0; i < n; i++)
    clReleaseMemObject(memobjs[i]);
}


x86 assembly (clang, -O0):
<delete_memobjs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1150 <delete_memobjs+0x40>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <clReleaseMemObject@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <delete_memobjs+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_memobjs>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1142 <delete_memobjs+0x32>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
call   1030 <clReleaseMemObject@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <delete_memobjs+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @delete_memobjs(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @clReleaseMemObject(i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
void asm_gototxtmode(void) { asm volatile("int $0x22" : : "a"(0x0005)); }


x86 assembly (clang, -O0):
<asm_gototxtmode>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%eax
int    $0x22
pop    %rbp
ret

x86 assembly (clang, -O2):
<asm_gototxtmode>:
mov    $0x5,%eax
int    $0x22
ret

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

LLVM IR (-O2):
define void @asm_gototxtmode() {
tail call void asm sideeffect "int $$0x22", "{ax},~{dirflag},~{fpsr},~{flags}"(i32 5)
ret void
}
/* Variables and functions */
void *strdup(char *);
void *str_dup_value_func(void *value) { return strdup((char *)value); }


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

x86 assembly (clang, -O2):
<str_dup_value_func>:
jmp    1030 <strdup@plt>

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

LLVM IR (-O2):
define noalias i8* @str_dup_value_func(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
int checkbit(int x, int i) { return x & (1 << i); }


x86 assembly (clang, -O0):
<checkbit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkbit>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @checkbit(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 = shl i32 1, %6
%8 = and i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @checkbit(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = and i32 %3, %0
ret i32 %4
}
unsigned int pfa_GetFirstAddrOfPage(unsigned int pageIndex) {
  return pageIndex * 4096;
}


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

x86 assembly (clang, -O2):
<pfa_GetFirstAddrOfPage>:
mov    %edi,%eax
shl    $0xc,%eax
ret

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

LLVM IR (-O2):
define i32 @pfa_GetFirstAddrOfPage(i32 %0) {
%2 = shl i32 %0, 12
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ display(int *, int);
int /*<<< orphan*/ optimized_bubblesort(int *, int);
int main(int argc, char *argv[]) {
  int a[] = {11, 9, 13, 15, 7, 5, 12, 20, 18, 16};
  optimized_bubblesort(a, 10);
  display(a, 10);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1050 <optimized_bubblesort@plt>
lea    -0x40(%rbp),%rdi
mov    $0xa,%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <optimized_bubblesort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <display@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 11, i32 9, i32 13, i32 15, i32 7, i32 5, i32 12, i32 20, i32 18, i32 16]
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast [10 x i32]* %6 to i8*
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%9 = call i32 @optimized_bubblesort(i32* %8, i32 10)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 0
%11 = call i32 @display(i32* %10, i32 10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 11, i32 9, i32 13, i32 15, i32 7, i32 5, i32 12, i32 20, i32 18, i32 16]
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = bitcast [10 x i32]* %3 to i8*
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%6 = call i32 @optimized_bubblesort(i32* %5, i32 10)
%7 = call i32 @display(i32* %5, i32 10)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int errno;
int /*<<< orphan*/ vwarn(char const *, int /*<<< orphan*/);
void vwarnc(int code, const char *format, va_list ap) {
  int tmp = errno;
  errno = code;
  vwarn(format, ap);
  errno = tmp;
}


x86 assembly (clang, -O0):
<vwarnc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    0x2ea8(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <vwarn@plt>
mov    -0x18(%rbp),%ecx
mov    0x2e90(%rip),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vwarnc>:
push   %rbp
push   %rbx
push   %rax
mov    0x2ec6(%rip),%rbx
mov    (%rbx),%ebp
mov    %edi,(%rbx)
mov    %rsi,%rdi
mov    %edx,%esi
call   1030 <vwarn@plt>
mov    %ebp,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i32 0
define void @vwarnc(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* @errno
store i32 %8, i32* %7
%9 = load i32, i32* %4
store i32 %9, i32* @errno
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @vwarn(i8* %10, i32 %11)
%13 = load i32, i32* %7
store i32 %13, i32* @errno
ret void
}

LLVM IR (-O2):
@errno = global i32 0
define void @vwarnc(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @errno
store i32 %0, i32* @errno
%5 = tail call i32 @vwarn(i8* %1, i32 %2)
store i32 %4, i32* @errno
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void announceStalemate(void) { printf("Stalemate\n"); }


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

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

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

LLVM IR (-O2):
@str = [10 x i8] c"Stalemate\00"
define void @announceStalemate() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
void XFreeGC() {}


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

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

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

LLVM IR (-O2):
define void @XFreeGC() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ delay_ms(int);
int /*<<< orphan*/ gpio_a_set(int, int /*<<< orphan*/);
int /*<<< orphan*/ led_off();
void relay_open(void) {
  gpio_a_set(2, 0);
  led_off();
  delay_ms(500);
}


x86 assembly (clang, -O0):
<relay_open>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
xor    %esi,%esi
call   1040 <gpio_a_set@plt>
mov    $0x0,%al
call   1030 <led_off@plt>
mov    $0x1f4,%edi
call   1050 <delay_ms@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<relay_open>:
push   %rax
mov    $0x2,%edi
xor    %esi,%esi
call   1040 <gpio_a_set@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
mov    $0x1f4,%edi
pop    %rax
jmp    1050 <delay_ms@plt>

LLVM IR (-O0):
define void @relay_open() {
%1 = call i32 @gpio_a_set(i32 2, i32 0)
%2 = call i32 (...) @led_off()
%3 = call i32 @delay_ms(i32 500)
ret void
}

LLVM IR (-O2):
define void @relay_open() {
%1 = tail call i32 @gpio_a_set(i32 2, i32 0)
%2 = tail call i32 (...) @led_off()
%3 = tail call i32 @delay_ms(i32 500)
ret void
}
/* Variables and functions */
bool is_equation(char input) {
  if (input == '=')
    return true;
  return false;
}


x86 assembly (clang, -O0):
<is_equation>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x3d,%eax
jne    1123 <is_equation+0x23>
movl   $0x1,-0x4(%rbp)
jmp    112a <is_equation+0x2a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_equation>:
xor    %eax,%eax
cmp    $0x3d,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_equation(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 61
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @is_equation(i8 signext %0) {
%2 = icmp eq i8 %0, 61
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct wl_subsurface {
  int dummy;
};
struct wl_proxy {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_destroy(struct wl_proxy *);
int /*<<< orphan*/ wl_proxy_marshal(struct wl_proxy *, int /*<<< orphan*/);
void wl_subsurface_destroy(struct wl_subsurface *wl_subsurface) {
  wl_proxy_marshal((struct wl_proxy *)wl_subsurface, 0);
  wl_proxy_destroy((struct wl_proxy *)wl_subsurface);
}


x86 assembly (clang, -O0):
<wl_subsurface_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1040 <wl_proxy_marshal@plt>
mov    -0x8(%rbp),%rdi
call   1030 <wl_proxy_destroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_subsurface_destroy>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1040 <wl_proxy_marshal@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <wl_proxy_destroy@plt>

LLVM IR (-O0):
%struct.wl_subsurface = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_subsurface_destroy(%struct.wl_subsurface* %0) {
%2 = alloca %struct.wl_subsurface*
store %struct.wl_subsurface* %0, %struct.wl_subsurface** %2
%3 = load %struct.wl_subsurface*, %struct.wl_subsurface** %2
%4 = bitcast %struct.wl_subsurface* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_marshal(%struct.wl_proxy* %4, i32 0)
%6 = load %struct.wl_subsurface*, %struct.wl_subsurface** %2
%7 = bitcast %struct.wl_subsurface* %6 to %struct.wl_proxy*
%8 = call i32 @wl_proxy_destroy(%struct.wl_proxy* %7)
ret void
}

LLVM IR (-O2):
%struct.wl_subsurface = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_subsurface_destroy(%struct.wl_subsurface* %0) {
%2 = bitcast %struct.wl_subsurface* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_marshal(%struct.wl_proxy* %2, i32 0)
%4 = tail call i32 @wl_proxy_destroy(%struct.wl_proxy* %2)
ret void
}
int fn1(_Bool a) { return ((int)a) | ((int)~a); }


x86 assembly (clang, -O0):
<fn1>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x1(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
xor    $0xffffffff,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fn1(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
%6 = zext i1 %5 to i32
%7 = load i8, i8* %2
%8 = trunc i8 %7 to i1
%9 = zext i1 %8 to i32
%10 = xor i32 %9, -1
%11 = or i32 %6, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @fn1(i1 zeroext %0) {
ret i32 -1
}
__attribute__((no)) int foo() {
  int a = -1;
  volatile unsigned b = 1U;
  int c = 1;
  c = (a + 972195718) / (b ? 1 : 0);
  if (c == 972195717)
    ;
  else
    __builtin_abort();
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x39f28786,%eax
mov    -0x8(%rbp),%esi
xor    %ecx,%ecx
mov    $0x1,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmpl   $0x39f28785,-0xc(%rbp)
jne    115d <foo+0x4d>
jmp    1162 <foo+0x52>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movl   $0x1,-0x4(%rsp)
mov    -0x4(%rsp),%eax
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 -1, i32* %1
store volatile i32 1, i32* %2
store i32 1, i32* %3
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 972195718
%6 = load volatile i32, i32* %2
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 1, i32 0
%10 = sdiv i32 %5, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 972195717
br i1 %12, label %13, label %14
13: ; preds = %0
br label %15
14: ; preds = %0
unreachable
15: ; preds = %13
ret i32 0
}

LLVM IR (-O2):
define i32 @foo() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 1, i32* %1
%3 = load volatile i32, i32* %1
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ be64toh(int /*<<< orphan*/);
void unaligned_write_be64(void *_u, uint64_t a) {
  struct __attribute__((packed, may_alias)) {
    uint64_t x;
  } *u = _u;
  u->x = be64toh(a);
}


x86 assembly (clang, -O0):
<unaligned_write_be64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <be64toh@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unaligned_write_be64>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <be64toh@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.anon = type { i32 }
define void @unaligned_write_be64(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.anon*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.anon*
store %struct.anon* %7, %struct.anon** %5
%8 = load i32, i32* %4
%9 = call i32 @be64toh(i32 %8)
%10 = load %struct.anon*, %struct.anon** %5
%11 = getelementptr inbounds %struct.anon, %struct.anon* %10, i32 0, i32 0
store i32 %9, i32* %11
ret void
}

LLVM IR (-O2):
define void @unaligned_write_be64(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @be64toh(i32 %1)
%4 = bitcast i8* %0 to i32*
store i32 %3, i32* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t ethernet_crc(const void *frame, size_t frame_len) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ethernet_crc(i8* nocapture readnone %0, i64 %1) {
ret i32 0
}
int do_796() { return 796; }


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

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

LLVM IR (-O0):
define i32 @do_796() {
ret i32 796
}

LLVM IR (-O2):
define i32 @do_796() {
ret i32 796
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t randomInteger(const unsigned short *globalCount) {
  uint16_t retVal = 0;
  switch (*globalCount) {
  case 0:
    retVal = 0x0FF1;
    break;
  case 1:
    retVal = 0x0FE2;
    break;
  case 2:
    retVal = 0x0FD3;
    break;
  case 3:
    retVal = 0x0FC4;
    break;
  case 4:
    retVal = 0x0FB5;
    break;
  default:
    break;
  }
  return retVal;
}


x86 assembly (clang, -O0):
<randomInteger>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
mov    %rax,-0x18(%rbp)
sub    $0x4,%rax
ja     1174 <randomInteger+0x74>
mov    -0x18(%rbp),%rax
lea    0xed1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xff1,-0xc(%rbp)
jmp    1179 <randomInteger+0x79>
movl   $0xfe2,-0xc(%rbp)
jmp    1179 <randomInteger+0x79>
movl   $0xfd3,-0xc(%rbp)
jmp    1179 <randomInteger+0x79>
movl   $0xfc4,-0xc(%rbp)
jmp    1179 <randomInteger+0x79>
movl   $0xfb5,-0xc(%rbp)
jmp    1179 <randomInteger+0x79>
jmp    1179 <randomInteger+0x79>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomInteger>:
movzwl (%rdi),%eax
mov    %eax,%ecx
shl    $0x4,%ecx
neg    %ecx
xor    %edx,%edx
cmp    $0x5,%eax
lea    0xff1(%rax,%rcx,1),%eax
cmovae %edx,%eax
ret

LLVM IR (-O0):
define i32 @randomInteger(i16* %0) {
%2 = alloca i16*
%3 = alloca i32
store i16* %0, i16** %2
store i32 0, i32* %3
%4 = load i16*, i16** %2
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
switch i32 %6, label %12 [
i32 0, label %7
i32 1, label %8
i32 2, label %9
i32 3, label %10
i32 4, label %11
]
7: ; preds = %1
store i32 4081, i32* %3
br label %13
8: ; preds = %1
store i32 4066, i32* %3
br label %13
9: ; preds = %1
store i32 4051, i32* %3
br label %13
10: ; preds = %1
store i32 4036, i32* %3
br label %13
11: ; preds = %1
store i32 4021, i32* %3
br label %13
12: ; preds = %1
br label %13
13: ; preds = %12, %11, %10, %9, %8, %7
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @randomInteger(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = icmp ult i16 %2, 5
%4 = zext i16 %2 to i32
%5 = mul nsw i32 %4, -15
%6 = add nsw i32 %5, 4081
%7 = select i1 %3, i32 %6, i32 0
ret i32 %7
}
/* Variables and functions */
unsigned int get_num_cores();
unsigned int rand_r(unsigned int *);
unsigned rand_mc(unsigned *p) {
  unsigned val;
  for (unsigned i = 0; i <= get_num_cores(); i++)
    val = rand_r(p);
  return val;
}


x86 assembly (clang, -O0):
<rand_mc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <get_num_cores@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
ja     1167 <rand_mc+0x47>
mov    -0x8(%rbp),%rdi
call   1030 <rand_r@plt>
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1133 <rand_mc+0x13>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_mc>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <get_num_cores@plt>
xor    %ebx,%ebx
mov    %r14,%rdi
call   1030 <rand_r@plt>
mov    %eax,%ebp
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <get_num_cores@plt>
cmp    %eax,%ebx
jbe    1130 <rand_mc+0x10>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @rand_mc(i32* %0) {
%2 = tail call i32 (...) @get_num_cores()
br label %4
3: ; preds = %4
ret i32 %6
4: ; preds = %1, %4
%5 = phi i32 [ 0, %1 ], [ %7, %4 ]
%6 = tail call i32 @rand_r(i32* %0)
%7 = add i32 %5, 1
%8 = tail call i32 (...) @get_num_cores()
%9 = icmp ugt i32 %7, %8
br i1 %9, label %3, label %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  if (sizeof((char)0) != 1) {
    printf("Error %d\n", (int)1);
    exit(1);
  };
  if (sizeof((short)0) != 2) {
    printf("Error %d\n", (int)2);
    exit(2);
  };
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [9 x i8] c"Success\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ _SSIBaseValid(int);
void SSIAdvFrameHoldDisable(uint32_t ui32Base) {
  ASSERT(_SSIBaseValid(ui32Base));
  (*((volatile uint32_t *)(ui32Base + 0x00000004))) &= ~(0x00000400);
}


x86 assembly (clang, -O0):
<SSIAdvFrameHoldDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffbff,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIAdvFrameHoldDisable>:
push   %rbx
mov    %edi,%ebx
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
movslq %ebx,%rax
andl   $0xfffffbff,0x4(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @SSIAdvFrameHoldDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_SSIBaseValid(i32 %3)
%5 = call i32 @ASSERT(i32 %4)
%6 = load i32, i32* %2
%7 = add nsw i32 %6, 4
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load volatile i32, i32* %9
%11 = and i32 %10, -1025
store volatile i32 %11, i32* %9
ret void
}

LLVM IR (-O2):
define void @SSIAdvFrameHoldDisable(i32 %0) {
%2 = tail call i32 @_SSIBaseValid(i32 %0)
%3 = tail call i32 @ASSERT(i32 %2)
%4 = add nsw i32 %0, 4
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, -1025
store volatile i32 %8, i32* %6
ret void
}
double fahr_to_cels(int fahr) { return (5.0 / 9.0) * (fahr - 32); }


x86 assembly (clang, -O0):
<fahr_to_cels>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
cvtsi2sd %eax,%xmm1
movsd  0xee7(%rip),%xmm0
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fahr_to_cels>:
add    $0xffffffe0,%edi
cvtsi2sd %edi,%xmm0
mulsd  0xef1(%rip),%xmm0
ret

LLVM IR (-O0):
define double @fahr_to_cels(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 %3, 32
%5 = sitofp i32 %4 to double
%6 = fmul double 0x3FE1C71C71C71C72, %5
ret double %6
}

LLVM IR (-O2):
define double @fahr_to_cels(i32 %0) {
%2 = add nsw i32 %0, -32
%3 = sitofp i32 %2 to double
%4 = fmul double %3, 0x3FE1C71C71C71C72
ret double %4
}
void gdk_window_set_keep_above() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_set_keep_above() {
ret void
}
int minmax(int lo, int hi, int x) { return x <= lo ? lo : x >= hi ? hi : x; }


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

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

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

LLVM IR (-O2):
define i32 @minmax(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, %0
%5 = icmp slt i32 %2, %1
%6 = select i1 %5, i32 %2, i32 %1
%7 = select i1 %4, i32 %6, i32 %0
ret i32 %7
}
double calc_cool_obj(temp, tempcrit)
double temp, tempcrit;
{
  double value;
  value = (temp * temp) / (tempcrit * tempcrit * 8);
  return (value);
}


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

x86 assembly (clang, -O2):
<calc_cool_obj>:
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm1
mulsd  0xef0(%rip),%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @calc_cool_obj(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fmul double %6, %7
%9 = load double, double* %4
%10 = load double, double* %4
%11 = fmul double %9, %10
%12 = fmul double %11, 8.000000e+00
%13 = fdiv double %8, %12
store double %13, double* %5
%14 = load double, double* %5
ret double %14
}

LLVM IR (-O2):
define double @calc_cool_obj(double %0, double %1) {
%3 = fmul double %0, %0
%4 = fmul double %1, %1
%5 = fmul double %4, 8.000000e+00
%6 = fdiv double %3, %5
ret double %6
}
void func6() { return; }


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

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

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

LLVM IR (-O2):
define void @func6() {
ret void
}
int foo2(b, a, c, d)
int a, b;
float c;
double d;
{ return a + b; }


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
cvtsd2ss %xmm0,%xmm0
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @foo2(i32 %0, i32 %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca double
%9 = fptrunc double %2 to float
store i32 %0, i32* %5
store i32 %1, i32* %6
store float %9, float* %7
store double %3, double* %8
%10 = load i32, i32* %6
%11 = load i32, i32* %5
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @foo2(i32 %0, i32 %1, double %2, double %3) {
%5 = add nsw i32 %1, %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int test1(int);
int test2(int);
int test3(int);
int main() {
  if (test1(1) != 1)
    abort();
  if (test2(1) != 1)
    abort();
  if (test3(2) != 1)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1050 <test1@plt>
cmp    $0x1,%eax
je     1179 <main+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x1,%edi
call   1060 <test2@plt>
cmp    $0x1,%eax
je     1193 <main+0x43>
mov    $0x0,%al
call   1030 <abort@plt>
mov    $0x2,%edi
call   1040 <test3@plt>
cmp    $0x1,%eax
je     11ad <main+0x5d>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1050 <test1@plt>
cmp    $0x1,%eax
jne    1185 <main+0x35>
mov    $0x1,%edi
call   1060 <test2@plt>
cmp    $0x1,%eax
jne    1185 <main+0x35>
mov    $0x2,%edi
call   1040 <test3@plt>
cmp    $0x1,%eax
jne    1185 <main+0x35>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test1(i32 1)
%3 = icmp ne i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @test2(i32 1)
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call i32 @test3(i32 2)
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
%17 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test1(i32 1)
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @test2(i32 1)
%7 = icmp eq i32 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call i32 @test3(i32 2)
%12 = icmp eq i32 %11, 1
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
%16 = tail call i32 @exit(i32 0)
unreachable
}