xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
void pausa() {
  printf("\nPressione ENTER para continuar.\n");
  getchar();
}


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"\0APressione ENTER para continuar.\0A\00"
define void @pausa() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @getchar()
ret void
}

LLVM IR (-O2):
@str = [33 x i8] c"\0APressione ENTER para continuar.\00"
define void @pausa() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @getchar()
ret void
}
int main() {
  char out = 0x55;
  __asm__("movb $0xFF, %%al; cmpb $0xFE, %%al; seto %%al" : "=a"(out));
  return out;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movb   $0x55,-0x5(%rbp)
mov    $0xff,%al
cmp    $0xfe,%al
seto   %al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xff,%al
cmp    $0xfe,%al
seto   %al
movsbl %al,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
store i8 85, i8* %2
%3 = call i8 asm "movb $$0xFF, %al; cmpb $$0xFE, %al; seto %al", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8 asm "movb $$0xFF, %al; cmpb $$0xFE, %al; seto %al", "={ax},~{dirflag},~{fpsr},~{flags}"()
%2 = sext i8 %1 to i32
ret i32 %2
}
int ld_ge_rr1(long double a1, long double a2) { return (((a1) >= (a2))); }


x86 assembly (clang, -O0):
<ld_ge_rr1>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_ge_rr1>:
fldt   0x18(%rsp)
fldt   0x8(%rsp)
xor    %eax,%eax
fucomip %st(1),%st
fstp   %st(0)
setae  %al
ret

LLVM IR (-O0):
define i32 @ld_ge_rr1(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = fcmp oge x86_fp80 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @ld_ge_rr1(x86_fp80 %0, x86_fp80 %1) {
%3 = fcmp oge x86_fp80 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hey \n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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

/* Variables and functions */
void displayNothing(uint8_t *buf) {
  buf[0] = 0x00;
  buf[1] = 0x00;
  buf[2] = 0x00;
  buf[3] = 0x00;
}


x86 assembly (clang, -O0):
<displayNothing>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<displayNothing>:
xorps  %xmm0,%xmm0
movups %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @displayNothing(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
store i32 0, i32* %4
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 1
store i32 0, i32* %6
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 2
store i32 0, i32* %8
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 3
store i32 0, i32* %10
ret void
}

LLVM IR (-O2):
define void @displayNothing(i32* nocapture writeonly %0) {
%2 = bitcast i32* %0 to i8*
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __SLIC_fun_local_irq_enable_call();
int /*<<< orphan*/ __SLIC_fun_local_irq_enable_entry();
int /*<<< orphan*/ __SLIC_fun_local_irq_enable_exit();
int /*<<< orphan*/ __SLIC_fun_local_irq_enable_return();
void __SLIC_local_irq_enable(void) {
  {
    __SLIC_fun_local_irq_enable_call();
    __SLIC_fun_local_irq_enable_entry();
    ;
    __SLIC_fun_local_irq_enable_exit();
    __SLIC_fun_local_irq_enable_return();
    return;
  }
}


x86 assembly (clang, -O0):
<__SLIC_local_irq_enable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <__SLIC_fun_local_irq_enable_call@plt>
mov    $0x0,%al
call   1060 <__SLIC_fun_local_irq_enable_entry@plt>
mov    $0x0,%al
call   1040 <__SLIC_fun_local_irq_enable_exit@plt>
mov    $0x0,%al
call   1030 <__SLIC_fun_local_irq_enable_return@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__SLIC_local_irq_enable>:
push   %rax
xor    %eax,%eax
call   1050 <__SLIC_fun_local_irq_enable_call@plt>
xor    %eax,%eax
call   1060 <__SLIC_fun_local_irq_enable_entry@plt>
xor    %eax,%eax
call   1040 <__SLIC_fun_local_irq_enable_exit@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <__SLIC_fun_local_irq_enable_return@plt>

LLVM IR (-O0):
define void @__SLIC_local_irq_enable() {
%1 = call i32 (...) @__SLIC_fun_local_irq_enable_call()
%2 = call i32 (...) @__SLIC_fun_local_irq_enable_entry()
%3 = call i32 (...) @__SLIC_fun_local_irq_enable_exit()
%4 = call i32 (...) @__SLIC_fun_local_irq_enable_return()
ret void
}

LLVM IR (-O2):
define void @__SLIC_local_irq_enable() {
%1 = tail call i32 (...) @__SLIC_fun_local_irq_enable_call()
%2 = tail call i32 (...) @__SLIC_fun_local_irq_enable_entry()
%3 = tail call i32 (...) @__SLIC_fun_local_irq_enable_exit()
%4 = tail call i32 (...) @__SLIC_fun_local_irq_enable_return()
ret void
}
void _native_LED_RED_TOGGLE(void) {}


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

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

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

LLVM IR (-O2):
define void @_native_LED_RED_TOGGLE() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LOG_DAEMON;
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
void LogInit(void) { openlog("ripright", 0, LOG_DAEMON); }


x86 assembly (clang, -O0):
<LogInit>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edx
lea    0xedc(%rip),%rdi
xor    %esi,%esi
call   1030 <openlog@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LogInit>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edx
lea    0xee0(%rip),%rdi
xor    %esi,%esi
jmp    1030 <openlog@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"ripright\00"
@LOG_DAEMON = global i32 0
define void @LogInit() {
%1 = load i32, i32* @LOG_DAEMON
%2 = call i32 @openlog(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0, i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"ripright\00"
@LOG_DAEMON = global i32 0
define void @LogInit() {
%1 = load i32, i32* @LOG_DAEMON
%2 = tail call i32 @openlog(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 0, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
struct passwd {
  char *pw_name;
};

/* Variables and functions */
struct passwd *getpwuid(int /*<<< orphan*/);
char *username_from_id(uid_t uid) {
  struct passwd *pwd;
  pwd = getpwuid(uid);
  return (pwd == NULL) ? NULL : pwd->pw_name;
}


x86 assembly (clang, -O0):
<username_from_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <getpwuid@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113d <username_from_id+0x2d>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1148 <username_from_id+0x38>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<username_from_id>:
push   %rax
call   1030 <getpwuid@plt>
test   %rax,%rax
je     1120 <username_from_id+0x10>
mov    (%rax),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.passwd = type { i8* }
define i8* @username_from_id(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.passwd*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call %struct.passwd* @getpwuid(i32 %4)
store %struct.passwd* %5, %struct.passwd** %3
%6 = load %struct.passwd*, %struct.passwd** %3
%7 = icmp eq %struct.passwd* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
br label %13
9: ; preds = %1
%10 = load %struct.passwd*, %struct.passwd** %3
%11 = getelementptr inbounds %struct.passwd, %struct.passwd* %10, i32 0, i32 0
%12 = load i8*, i8** %11
br label %13
13: ; preds = %9, %8
%14 = phi i8* [ null, %8 ], [ %12, %9 ]
ret i8* %14
}

LLVM IR (-O2):
%struct.passwd = type { i8* }
define i8* @username_from_id(i32 %0) {
%2 = tail call %struct.passwd* @getpwuid(i32 %0)
%3 = icmp eq %struct.passwd* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = getelementptr inbounds %struct.passwd, %struct.passwd* %2, i64 0, i32 0
%6 = load i8*, i8** %5
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %6, %4 ], [ null, %1 ]
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ F2(int);
F1() {
  int v1, v2;
  F2(v1);
  F2(v2);
}


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

x86 assembly (clang, -O2):
<F1>:
push   %rax
call   1030 <F2@plt>
pop    %rax
jmp    1030 <F2@plt>

LLVM IR (-O0):
define i32 @F1() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %2
%5 = call i32 @F2(i32 %4)
%6 = load i32, i32* %3
%7 = call i32 @F2(i32 %6)
%8 = load i32, i32* %1
ret i32 %8
}

LLVM IR (-O2):
define i32 @F1() {
%1 = tail call i32 @F2(i32 undef)
%2 = tail call i32 @F2(i32 undef)
ret i32 undef
}
/* Variables and functions */
double convertFromDegToRad(double);
double sin(double);
double computeChordDist(double radius, double deg) {
  double rad = convertFromDegToRad(deg);
  return 2.0 * radius * sin(rad / 2);
}


x86 assembly (clang, -O0):
<computeChordDist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <convertFromDegToRad@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xea0(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeChordDist>:
push   %rax
movsd  %xmm0,(%rsp)
movapd %xmm1,%xmm0
call   1040 <convertFromDegToRad@plt>
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,(%rsp)
mulsd  0xebb(%rip),%xmm0
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @computeChordDist(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* %4
%7 = call double @convertFromDegToRad(double %6)
store double %7, double* %5
%8 = load double, double* %3
%9 = fmul double 2.000000e+00, %8
%10 = load double, double* %5
%11 = fdiv double %10, 2.000000e+00
%12 = call double @sin(double %11)
%13 = fmul double %9, %12
ret double %13
}

LLVM IR (-O2):
define double @computeChordDist(double %0, double %1) {
%3 = tail call double @convertFromDegToRad(double %1)
%4 = fmul double %0, 2.000000e+00
%5 = fmul double %3, 5.000000e-01
%6 = tail call double @sin(double %5)
%7 = fmul double %4, %6
ret double %7
}
void dec_to_bin(int binary[8], int dec) {
  int counter = 7;
  for (; dec != 0; counter--) {
    binary[counter] = dec % 2;
    dec = dec / 2;
  }
}


x86 assembly (clang, -O0):
<dec_to_bin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x7,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114e <dec_to_bin+0x4e>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <dec_to_bin+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec_to_bin>:
test   %esi,%esi
je     1130 <dec_to_bin+0x30>
add    $0x1c,%rdi
mov    %esi,%eax
nopw   0x0(%rax,%rax,1)
shr    $0x1f,%eax
add    %esi,%eax
mov    %eax,%ecx
and    $0xfffffffe,%ecx
mov    %esi,%edx
sub    %ecx,%edx
mov    %edx,(%rdi)
sar    %eax
add    $0x1,%esi
add    $0xfffffffffffffffc,%rdi
cmp    $0x2,%esi
mov    %eax,%esi
ja     1110 <dec_to_bin+0x10>
ret

LLVM IR (-O0):
define void @dec_to_bin(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 7, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %4
%11 = srem i32 %10, 2
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
store i32 %11, i32* %15
%16 = load i32, i32* %4
%17 = sdiv i32 %16, 2
store i32 %17, i32* %4
br label %18
18: ; preds = %9
%19 = load i32, i32* %5
%20 = add nsw i32 %19, -1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @dec_to_bin(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %10, %4 ], [ 7, %2 ]
%6 = phi i32 [ %9, %4 ], [ %1, %2 ]
%7 = srem i32 %6, 2
%8 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 %7, i32* %8
%9 = sdiv i32 %6, 2
%10 = add i64 %5, -1
%11 = add i32 %6, 1
%12 = icmp ult i32 %11, 3
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
void print_backtrace(void) {}


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

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

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

LLVM IR (-O2):
define void @print_backtrace() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char str[50];
  strcpy(str, "This is string.h library function");
  puts(str);
  memset(str, '$', 7);
  puts(str);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x40(%rbp),%rdi
call   1040 <puts@plt>
lea    -0x40(%rbp),%rdi
mov    $0x24,%esi
mov    $0x7,%edx
call   1050 <memset@plt>
lea    -0x40(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xec4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x24,%esi
mov    $0x7,%edx
call   1050 <memset@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"This is string.h library function\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [50 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = call i32 @puts(i8* %5)
%7 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%8 = call i32 @memset(i8* %7, i8 signext 36, i32 7)
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%10 = call i32 @puts(i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"This is string.h library function\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* %2)
%5 = call i32 @memset(i8* %2, i8 signext 36, i32 7)
%6 = call i32 @puts(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ myfree(void *);
void *mymalloc(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < argc; i++) {
    void *p = mymalloc(atoi(argv[i]));
    myfree(p);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118c <main+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <atoi@plt>
mov    %eax,%edi
call   1030 <mymalloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <myfree@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     1171 <main+0x41>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1040 <atoi@plt>
mov    %eax,%edi
call   1030 <mymalloc@plt>
mov    %rax,%rdi
call   1050 <myfree@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1150 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %15
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %13, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = tail call i8* @mymalloc(i32 %10)
%12 = tail call i32 @myfree(i8* %11)
%13 = add nuw nsw i64 %7, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %15, label %6
15: ; preds = %6, %2
ret i32 0
}
/* Type definitions */
struct _rtext {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rtext_senditup(struct _rtext *, int, int *, int *, int *);
void rtext_draw(struct _rtext *x) {
  int w = 0, h = 0, indx;
  rtext_senditup(x, 1, &w, &h, &indx);
}


x86 assembly (clang, -O0):
<rtext_draw>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <rtext_senditup@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rtext_draw>:
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x14(%rsp),%r8
mov    $0x1,%esi
call   1030 <rtext_senditup@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct._rtext = type { i32 }
define void @rtext_draw(%struct._rtext* %0) {
%2 = alloca %struct._rtext*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store %struct._rtext* %0, %struct._rtext** %2
store i32 0, i32* %3
store i32 0, i32* %4
%6 = load %struct._rtext*, %struct._rtext** %2
%7 = call i32 @rtext_senditup(%struct._rtext* %6, i32 1, i32* %3, i32* %4, i32* %5)
ret void
}

LLVM IR (-O2):
%struct._rtext = type { i32 }
define void @rtext_draw(%struct._rtext* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = bitcast i32* %4 to i8*
%8 = call i32 @rtext_senditup(%struct._rtext* %0, i32 1, i32* %2, i32* %3, i32* %4)
ret void
}
void create_iface_stat(const struct in_device *in_dev) {}


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

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

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

LLVM IR (-O2):
%struct.in_device = type opaque
define void @create_iface_stat(%struct.in_device* nocapture %0) {
ret void
}
int circ(int a) { return a % 2; }


x86 assembly (clang, -O0):
<circ>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<circ>:
mov    %edi,%eax
mov    %edi,%ecx
shr    $0x1f,%ecx
add    %edi,%ecx
and    $0xfffffffe,%ecx
sub    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @circ(i32 %0) {
%2 = srem i32 %0, 2
ret i32 %2
}
int rho_ruby_is_integer(unsigned long val) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @rho_ruby_is_integer(i64 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int);
void testTortureExecute(void) {
  f(-5, 5);
  return;
}


x86 assembly (clang, -O0):
<testTortureExecute>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffb,%edi
mov    $0x5,%esi
call   1030 <f@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testTortureExecute>:
mov    $0xfffffffb,%edi
mov    $0x5,%esi
jmp    1030 <f@plt>

LLVM IR (-O0):
define void @testTortureExecute() {
%1 = call i32 @f(i32 -5, i32 5)
ret void
}

LLVM IR (-O2):
define void @testTortureExecute() {
%1 = tail call i32 @f(i32 -5, i32 5)
ret void
}
__attribute__((always_)) unsigned long pte_index(unsigned long address) {
  return (address >> 12) & (1024 - 1);
}


x86 assembly (clang, -O0):
<pte_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0xc,%rax
and    $0x3ff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pte_index>:
mov    %rdi,%rax
shr    $0xc,%eax
and    $0x3ff,%eax
ret

LLVM IR (-O0):
define i64 @pte_index(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 12
%5 = and i64 %4, 1023
ret i64 %5
}

LLVM IR (-O2):
define i64 @pte_index(i64 %0) {
%2 = lshr i64 %0, 12
%3 = and i64 %2, 1023
ret i64 %3
}
int main(void) {
  static __thread int local_scope;
  foo();
  return 0;
}


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

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

LLVM IR (-O0):
@main.local_scope = internal thread_local global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @foo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @foo()
ret i32 0
}
char *strerror(register int errnum) {
  extern const char *_sys_errlist[];
  extern const int _sys_nerr;
  if (errnum < 0 || errnum >= _sys_nerr)
    return "unknown error";
  return (char *)_sys_errlist[errnum];
}


x86 assembly (clang, -O0):
<strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1123 <strerror+0x23>
mov    -0xc(%rbp),%eax
mov    0x2ebd(%rip),%rcx
cmp    (%rcx),%eax
jl     1133 <strerror+0x33>
lea    0xed6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1146 <strerror+0x46>
movslq -0xc(%rbp),%rcx
mov    0x2eaa(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror>:
lea    0xef9(%rip),%rax
test   %edi,%edi
js     1123 <strerror+0x23>
mov    0x2ec6(%rip),%rcx
cmp    %edi,(%rcx)
jle    1123 <strerror+0x23>
mov    %edi,%eax
mov    0x2ec9(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret

LLVM IR (-O0):
@_sys_nerr = external constant i32
@.str = [14 x i8] c"unknown error\00"
@_sys_errlist = external global [0 x i8*]
define i8* @strerror(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = load i32, i32* @_sys_nerr
%9 = icmp sge i32 %7, %8
br i1 %9, label %10, label %11
10: ; preds = %6, %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %6
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [0 x i8*], [0 x i8*]* @_sys_errlist, i64 0, i64 %13
%15 = load i8*, i8** %14
store i8* %15, i8** %2
br label %16
16: ; preds = %11, %10
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@_sys_nerr = external constant i32
@.str = [14 x i8] c"unknown error\00"
@_sys_errlist = external global [0 x i8*]
define i8* @strerror(i32 %0) {
%2 = icmp sgt i32 %0, -1
%3 = load i32, i32* @_sys_nerr
%4 = icmp sgt i32 %3, %0
%5 = select i1 %2, i1 %4, i1 false
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = zext i32 %0 to i64
%8 = getelementptr inbounds [0 x i8*], [0 x i8*]* @_sys_errlist, i64 0, i64 %7
%9 = load i8*, i8** %8
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int myentry(int argc, char *argv[]) {
  printf("Start from myentry\n");
  exit(0);
}


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"Start from myentry\0A\00"
define i32 @myentry(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [19 x i8] c"Start from myentry\00"
define i32 @myentry(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ EMLINK;
int /*<<< orphan*/ errno;
int _link(char *old __attribute__((unused)),
          char *new __attribute__((unused))) {
  errno = EMLINK;
  return -1;
}


x86 assembly (clang, -O0):
<_link>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2edd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_link>:
mov    0x2ee9(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EMLINK = global i32 0
@errno = global i32 0
define i32 @_link(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @EMLINK
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EMLINK = global i32 0
@errno = global i32 0
define i32 @_link(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EMLINK
store i32 %3, i32* @errno
ret i32 -1
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int /*<<< orphan*/);
int read_quaddobl_start_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(243, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<read_quaddobl_start_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0xf3,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_quaddobl_start_system>:
mov    $0xf3,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @read_quaddobl_start_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 243, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @read_quaddobl_start_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 243, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ gen_pop();
int /*<<< orphan*/ output_line(char *);
void gen_or(void) {
  output_line("orab ,s");
  output_line("oraa 1,s");
  gen_pop();
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"orab ,s\00"
@.str.1 = [9 x i8] c"oraa 1,s\00"
define void @gen_or() {
%1 = call i32 @output_line(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @output_line(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @gen_pop()
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"orab ,s\00"
@.str.1 = [9 x i8] c"oraa 1,s\00"
define void @gen_or() {
%1 = tail call i32 @output_line(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @output_line(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (...) @gen_pop()
ret void
}
/* Variables and functions */
int partition(int *, int, int);
void _quick_sort(int nums[], int l, int r) {
  if (l < r) {
    int pi = partition(nums, l, r);
    _quick_sort(nums, l, pi - 1);
    _quick_sort(nums, pi + 1, r);
  }
}


x86 assembly (clang, -O0):
<_quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <_quick_sort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <_quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <_quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <_quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <_quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <_quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @_quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @_quick_sort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
double trocaAB(double raizA, double raizB, double resultC,
               char verificacaoSinal) {
  return verificacaoSinal == '+' ? resultC : raizA;
}


x86 assembly (clang, -O0):
<trocaAB>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x2b,%eax
jne    1135 <trocaAB+0x35>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    113f <trocaAB+0x3f>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<trocaAB>:
cmp    $0x2b,%dil
je     1109 <trocaAB+0x9>
movaps %xmm0,%xmm2
movaps %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @trocaAB(double %0, double %1, double %2, i8 signext %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i8
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store i8 %3, i8* %8
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 43
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load double, double* %7
br label %16
14: ; preds = %4
%15 = load double, double* %5
br label %16
16: ; preds = %14, %12
%17 = phi double [ %13, %12 ], [ %15, %14 ]
ret double %17
}

LLVM IR (-O2):
define double @trocaAB(double %0, double %1, double %2, i8 signext %3) {
%5 = icmp eq i8 %3, 43
%6 = select i1 %5, double %2, double %0
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
scalar_t__ ftell(int /*<<< orphan*/ *);
int get_file_size(FILE *fd) {
  int total_bytes;
  if (fd == NULL)
    return 0;
  fseek(fd, 0L, SEEK_END);
  total_bytes = (int)ftell(fd);
  fseek(fd, 0, SEEK_SET);
  return total_bytes;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <get_file_size+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1181 <get_file_size+0x61>
mov    -0x10(%rbp),%rdi
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1040 <fseek@plt>
mov    -0x10(%rbp),%rdi
call   1030 <ftell@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e68(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1040 <fseek@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     115c <get_file_size+0x3c>
mov    %rdi,%rbx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
mov    %rbx,%rdi
call   1030 <ftell@plt>
mov    %rax,%r14
mov    0x2e8a(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <fseek@plt>
jmp    115f <get_file_size+0x3f>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @get_file_size(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %19
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = load i32, i32* @SEEK_END
%11 = call i32 @fseek(i32* %9, i64 0, i32 %10)
%12 = load i32*, i32** %3
%13 = call i64 @ftell(i32* %12)
%14 = trunc i64 %13 to i32
store i32 %14, i32* %4
%15 = load i32*, i32** %3
%16 = load i32, i32* @SEEK_SET
%17 = call i32 @fseek(i32* %15, i64 0, i32 %16)
%18 = load i32, i32* %4
store i32 %18, i32* %2
br label %19
19: ; preds = %8, %7
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @get_file_size(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = load i32, i32* @SEEK_END
%5 = tail call i32 @fseek(i32* %0, i64 0, i32 %4)
%6 = tail call i64 @ftell(i32* %0)
%7 = trunc i64 %6 to i32
%8 = load i32, i32* @SEEK_SET
%9 = tail call i32 @fseek(i32* %0, i64 0, i32 %8)
br label %10
10: ; preds = %1, %3
%11 = phi i32 [ %7, %3 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
unsigned int strlen(char *);
int /*<<< orphan*/ uart_putchar(char);
void uart_puts(char *string) {
  unsigned int len = strlen(string);
  unsigned int i;
  for (i = 0; i < len; i++) {
    uart_putchar(string[i]);
  }
  uart_putchar('\r');
  uart_putchar('\n');
}


x86 assembly (clang, -O0):
<uart_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1169 <uart_puts+0x49>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1040 <uart_putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <uart_puts+0x1f>
mov    $0xd,%edi
call   1040 <uart_putchar@plt>
mov    $0xa,%edi
call   1040 <uart_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_puts>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %eax,%eax
je     1153 <uart_puts+0x33>
mov    %eax,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1040 <uart_putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <uart_puts+0x20>
mov    $0xd,%edi
call   1040 <uart_putchar@plt>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <uart_putchar@plt>

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

LLVM IR (-O2):
define void @uart_puts(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @uart_putchar(i8 signext %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %1
%14 = tail call i32 @uart_putchar(i8 signext 13)
%15 = tail call i32 @uart_putchar(i8 signext 10)
ret void
}
void ps_print_text_line() {}


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

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

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

LLVM IR (-O2):
define void @ps_print_text_line() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
double *vector_malloc(int n) {
  double *v;
  v = (double *)malloc(n * sizeof(double));
  return v;
}


x86 assembly (clang, -O0):
<vector_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vector_malloc>:
shl    $0x3,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define double* @vector_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca double*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 8
%7 = trunc i64 %6 to i32
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to double*
store double* %9, double** %3
%10 = load double*, double** %3
ret double* %10
}

LLVM IR (-O2):
define double* @vector_malloc(i32 %0) {
%2 = shl i32 %0, 3
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to double*
ret double* %4
}
/* Variables and functions */
int /*<<< orphan*/ sincos_x86_fpu(double, double *, double *);
double stupid_sincos_x86_fpu(double x) {
  double s, c;
  sincos_x86_fpu(x, &s, &c);
  return (s + c);
}


x86 assembly (clang, -O0):
<stupid_sincos_x86_fpu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <sincos_x86_fpu@plt>
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stupid_sincos_x86_fpu>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1030 <sincos_x86_fpu@plt>
movsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @stupid_sincos_x86_fpu(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = call i32 @sincos_x86_fpu(double %5, double* %3, double* %4)
%7 = load double, double* %3
%8 = load double, double* %4
%9 = fadd double %7, %8
ret double %9
}

LLVM IR (-O2):
define double @stupid_sincos_x86_fpu(double %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
%5 = bitcast double* %3 to i8*
%6 = call i32 @sincos_x86_fpu(double %0, double* %2, double* %3)
%7 = load double, double* %2
%8 = load double, double* %3
%9 = fadd double %7, %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ func1(int);
int func2(int i) {
  int a = 3;
  int j;
  for (j = 0; j < i; ++j) {
    int a = j;
    int j = a + 1;
    func1(j);
  }
  return a;
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115a <func2+0x4a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <func1@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <func2+0x19>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    114a <func2+0x3a>
mov    %edi,%r14d
neg    %r14d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <func1@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1130 <func2+0x20>
mov    $0x3,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @func2(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ 0, %1 ]
%5 = add nuw nsw i32 %4, 1
%6 = tail call i32 @func1(i32 %5)
%7 = icmp eq i32 %5, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret i32 3
}
void gameboy4x_generic_output(void *data, unsigned *out_width,
                              unsigned *out_height, unsigned width,
                              unsigned height) {
  *out_width = width << 2;
  *out_height = height << 2;
}


x86 assembly (clang, -O0):
<gameboy4x_generic_output>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%ecx
shl    $0x2,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<gameboy4x_generic_output>:
shl    $0x2,%ecx
mov    %ecx,(%rsi)
shl    $0x2,%r8d
mov    %r8d,(%rdx)
ret

LLVM IR (-O0):
define void @gameboy4x_generic_output(i8* %0, i32* %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %9
%12 = shl i32 %11, 2
%13 = load i32*, i32** %7
store i32 %12, i32* %13
%14 = load i32, i32* %10
%15 = shl i32 %14, 2
%16 = load i32*, i32** %8
store i32 %15, i32* %16
ret void
}

LLVM IR (-O2):
define void @gameboy4x_generic_output(i8* nocapture readnone %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32 %3, i32 %4) {
%6 = shl i32 %3, 2
store i32 %6, i32* %1
%7 = shl i32 %4, 2
store i32 %7, i32* %2
ret void
}
int integer_compare(void *s1, void *s2) {
  return ((*(int *)s1 - *(int *)s2)) % 1;
}


x86 assembly (clang, -O0):
<integer_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @integer_compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
%12 = srem i32 %11, 1
ret i32 %12
}

LLVM IR (-O2):
define i32 @integer_compare(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}