xunge/DecIR huggingface dataset:
/* Variables and functions */
int rtc_printf(const char *format, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @rtc_printf(i8* nocapture readnone %0, ...) {
ret i32 0
}
double Milli(double a_fVal) { return a_fVal / 1.0e3; }


x86 assembly (clang, -O0):
<Milli>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Milli>:
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @Milli(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 1.000000e+03
ret double %4
}

LLVM IR (-O2):
define double @Milli(double %0) {
%2 = fdiv double %0, 1.000000e+03
ret double %2
}
/* Variables and functions */
double *malloc(int);
double *vector_malloc(int n) {
  double *pv = malloc(n * sizeof(double));
  return pv;
}


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 double* @malloc(i32 %7)
store double* %8, double** %3
%9 = load double*, double** %3
ret double* %9
}

LLVM IR (-O2):
define noalias double* @vector_malloc(i32 %0) {
%2 = shl i32 %0, 3
%3 = tail call double* @malloc(i32 %2)
ret double* %3
}
/* Variables and functions */
int EOF;
int read(int /*<<< orphan*/, char *, int);
int read_char(void) {
  char c;
  if (read(0, &c, 1) != 1) {
    return EOF;
  }
  return c;
}


x86 assembly (clang, -O0):
<read_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
je     1142 <read_char+0x32>
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1149 <read_char+0x39>
movsbl -0x5(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_char>:
push   %rax
lea    0x7(%rsp),%rsi
xor    %edi,%edi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0x1,%eax
je     1132 <read_char+0x22>
mov    0x2eba(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret
movsbl 0x7(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @read_char() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 @read(i32 0, i8* %2, i32 1)
%4 = icmp ne i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = load i32, i32* @EOF
store i32 %6, i32* %1
br label %10
7: ; preds = %0
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
store i32 %9, i32* %1
br label %10
10: ; preds = %7, %5
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @read_char() {
%1 = alloca i8
%2 = call i32 @read(i32 0, i8* %1, i32 1)
%3 = icmp eq i32 %2, 1
%4 = load i32, i32* @EOF
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = select i1 %3, i32 %6, i32 %4
ret i32 %7
}
/* Variables and functions */
int max(int, int);
int /*<<< orphan*/ printf(char *, int);
void print_max(int first, int second) { printf("%d\n", max(first, second)); }


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

x86 assembly (clang, -O2):
<print_max>:
push   %rax
call   1040 <max@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @print_max(i32 %0, i32 %1) {
%3 = tail call i32 @max(i32 %0, i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ err_sys(char *);
int /*<<< orphan*/ readfd(int, int *);
void ReadFd(int fd, int *recvfd) {
  readfd(fd, recvfd);
  if (*recvfd < 0)
    err_sys("receive fd failed");
}


x86 assembly (clang, -O0):
<ReadFd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <readfd@plt>
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jge    1154 <ReadFd+0x34>
lea    0xeb1(%rip),%rdi
call   1030 <err_sys@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReadFd>:
push   %rbx
mov    %rsi,%rbx
call   1040 <readfd@plt>
cmpl   $0x0,(%rbx)
js     1130 <ReadFd+0x10>
pop    %rbx
ret
lea    0xec9(%rip),%rdi
pop    %rbx
jmp    1030 <err_sys@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"receive fd failed\00"
define void @ReadFd(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = load i32*, i32** %4
%7 = call i32 @readfd(i32 %5, i32* %6)
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @err_sys(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"receive fd failed\00"
define void @ReadFd(i32 %0, i32* %1) {
%3 = tail call i32 @readfd(i32 %0, i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @err_sys(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
void killcomment(FILE *fp) {
  int t;
  do {
    t = fgetc(fp);
    if (t == '\n' || t == '\r')
      break;
  } while (t != EOF);
}


x86 assembly (clang, -O0):
<killcomment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
je     113c <killcomment+0x2c>
cmpl   $0xd,-0xc(%rbp)
jne    1141 <killcomment+0x31>
jmp    1158 <killcomment+0x48>
jmp    1146 <killcomment+0x36>
mov    -0xc(%rbp),%eax
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%eax
jne    111c <killcomment+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<killcomment>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eca(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     1137 <killcomment+0x27>
cmp    $0xd,%eax
je     1137 <killcomment+0x27>
cmp    (%r14),%eax
jne    1120 <killcomment+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i32 0
define void @killcomment(i32* nocapture %0) {
br label %2
2: ; preds = %4, %1
%3 = tail call i32 @fgetc(i32* %0)
switch i32 %3, label %4 [
i32 13, label %7
i32 10, label %7
]
4: ; preds = %2
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %3, %5
br i1 %6, label %7, label %2
7: ; preds = %2, %2, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double volatile);
int main() {
  volatile double x;
  for (x = 0.0; x < 100.0; x += 0.2)
    ;
  printf("%.20g\n", x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xecc(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    115e <main+0x4e>
jmp    1143 <main+0x33>
movsd  -0x10(%rbp),%xmm0
movsd  0xeb8(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1127 <main+0x17>
movsd  -0x10(%rbp),%xmm0
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movq   $0x0,(%rsp)
movsd  0xedf(%rip),%xmm0
ucomisd (%rsp),%xmm0
jbe    1145 <main+0x35>
movsd  0xed8(%rip),%xmm1
movsd  (%rsp),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%rsp)
ucomisd (%rsp),%xmm0
ja     1130 <main+0x20>
movsd  (%rsp),%xmm0
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%.20g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
store volatile double 0.000000e+00, double* %2
br label %3
3: ; preds = %7, %0
%4 = load volatile double, double* %2
%5 = fcmp olt double %4, 1.000000e+02
br i1 %5, label %6, label %10
6: ; preds = %3
br label %7
7: ; preds = %6
%8 = load volatile double, double* %2
%9 = fadd double %8, 2.000000e-01
store volatile double %9, double* %2
br label %3
10: ; preds = %3
%11 = load volatile double, double* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %11)
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.20g\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
store volatile double 0.000000e+00, double* %1
%3 = load volatile double, double* %1
%4 = fcmp olt double %3, 1.000000e+02
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = load volatile double, double* %1
%7 = fadd double %6, 2.000000e-01
store volatile double %7, double* %1
%8 = load volatile double, double* %1
%9 = fcmp olt double %8, 1.000000e+02
br i1 %9, label %5, label %10
10: ; preds = %5, %0
%11 = load volatile double, double* %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %11)
ret i32 0
}
OP(dd, a2) { op_a2(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @op_a2()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void g13_cb(void *arg) { puts("GPIO_13 triggered"); }


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"GPIO_13 triggered\00"
define void @g13_cb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"GPIO_13 triggered\00"
define void @g13_cb(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}
indreg0reg1(r0, r1, x0, x1, p0, p1) unsigned short r0, r1;
unsigned short *p0, *p1;
{
  if ((*p0) <= r1)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<indreg0reg1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movzwl (%rax),%eax
movzwl -0x8(%rbp),%ecx
cmp    %ecx,%eax
jg     113e <indreg0reg1+0x3e>
movl   $0x1,-0x4(%rbp)
jmp    1145 <indreg0reg1+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<indreg0reg1>:
movzwl (%r8),%ecx
movzwl %si,%edx
xor    %eax,%eax
cmp    %ecx,%edx
setae  %al
ret

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

LLVM IR (-O2):
define i32 @indreg0reg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture readnone %5) {
%7 = load i16, i16* %4
%8 = zext i16 %7 to i32
%9 = and i32 %1, 65535
%10 = icmp uge i32 %9, %8
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ processMessageQueue();
void loop() { processMessageQueue(); }


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

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

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

LLVM IR (-O2):
define void @loop() {
%1 = tail call i32 (...) @processMessageQueue()
ret void
}
int test_imm_84uint16_reg(unsigned short val) {
  return ((val) & (0x84 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_84uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x84,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_84uint16_reg>:
test   $0x84,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_84uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 132
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void set(char **var, char *val) {
  if (val)
    *var = val;
}


x86 assembly (clang, -O0):
<set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1122 <set+0x22>
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set>:
test   %rsi,%rsi
je     1108 <set+0x8>
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
define void @set(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = load i8**, i8*** %3
store i8* %8, i8** %9
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @set(i8** nocapture writeonly %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %5, label %4
4: ; preds = %2
store i8* %1, i8** %0
br label %5
5: ; preds = %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ my_fgetc(char *);
int /*<<< orphan*/ my_fputc(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int main(void) {
  my_fputc("02.txt");
  my_fgetc("02.txt");
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1060 <my_fputc@plt>
lea    0xe9e(%rip),%rdi
call   1050 <my_fgetc@plt>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
call   1060 <my_fputc@plt>
mov    %rbx,%rdi
call   1050 <my_fgetc@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe9e(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"02.txt\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @my_fputc(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @my_fgetc(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"02.txt\00"
@.str.2 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = tail call i32 @my_fputc(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @my_fgetc(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @putchar(i32 10)
%4 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRCORE_N16_swap(char *, int, int);
void U_WMRARC_swap(char *record, int torev) {
  U_WMRCORE_N16_swap(record, 8, torev);
}


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

x86 assembly (clang, -O2):
<U_WMRARC_swap>:
mov    %esi,%edx
mov    $0x8,%esi
jmp    1030 <U_WMRCORE_N16_swap@plt>

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

LLVM IR (-O2):
define void @U_WMRARC_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRCORE_N16_swap(i8* %0, i32 8, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execv(char *, char **);
int /*<<< orphan*/ perror(char *);
int main(int argc, char *argv[]) {
  argv[0] = "@ntfs-3g";
  execv("/usr/bin/ntfs-3g", argv);
  perror("ntfs-3g-wrapper");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xebf(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rsi
lea    0xeba(%rip),%rdi
call   1040 <execv@plt>
lea    0xebf(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rax
mov    %rax,(%rsi)
lea    0xed7(%rip),%rdi
call   1040 <execv@plt>
lea    0xedc(%rip),%rdi
call   1030 <perror@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"@ntfs-3g\00"
@.str.1 = [17 x i8] c"/usr/bin/ntfs-3g\00"
@.str.2 = [16 x i8] c"ntfs-3g-wrapper\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = load i8**, i8*** %5
%9 = call i32 @execv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %8)
%10 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [9 x i8] c"@ntfs-3g\00"
@.str.1 = [17 x i8] c"/usr/bin/ntfs-3g\00"
@.str.2 = [16 x i8] c"ntfs-3g-wrapper\00"
define i32 @main(i32 %0, i8** %1) {
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = tail call i32 @execv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %1)
%4 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
ret i32 1
}
double dbl_flt_max3(float a, double b) { return (a > b) ? a : b; }


x86 assembly (clang, -O0):
<dbl_flt_max3>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movsd  %xmm1,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1135 <dbl_flt_max3+0x35>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113f <dbl_flt_max3+0x3f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbl_flt_max3>:
cvtss2sd %xmm0,%xmm0
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dbl_flt_max3(float %0, double %1) {
%3 = alloca float
%4 = alloca double
store float %0, float* %3
store double %1, double* %4
%5 = load float, float* %3
%6 = fpext float %5 to double
%7 = load double, double* %4
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load float, float* %3
%11 = fpext float %10 to double
br label %14
12: ; preds = %2
%13 = load double, double* %4
br label %14
14: ; preds = %12, %9
%15 = phi double [ %11, %9 ], [ %13, %12 ]
ret double %15
}

LLVM IR (-O2):
define double @dbl_flt_max3(float %0, double %1) {
%3 = fpext float %0 to double
%4 = fcmp ogt double %3, %1
%5 = select i1 %4, double %3, double %1
ret double %5
}
int getkey() { return 'a'; }


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

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

LLVM IR (-O0):
define i32 @getkey() {
ret i32 97
}

LLVM IR (-O2):
define i32 @getkey() {
ret i32 97
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("\nBe careful!!\a");
  printf("1\n2\r3\b4\f5\t6\v7\a8\?9\"0\'1\\");
  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>
lea    0xedd(%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 <printf@plt>
lea    0xeeb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0ABe careful!!\07\00"
@.str.1 = [23 x i8] c"1\0A2\0D3\084\0C5\096\0B7\078?9\220'1\\\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0ABe careful!!\07\00"
@.str.1 = [23 x i8] c"1\0A2\0D3\084\0C5\096\0B7\078?9\220'1\\\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
double max(double x, double y) { return x >= y ? x : y; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     112d <max+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <max+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
movapd %xmm1,%xmm2
cmplesd %xmm0,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @max(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp oge double %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @max(double %0, double %1) {
%3 = fcmp oge double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ __vm_lock(int);
int /*<<< orphan*/ __vm_unlock();
int syscall(int, void *, size_t);
int __munmap(void *start, size_t len) {
  int ret;
  __vm_lock(-1);
  ret = syscall(11, start, len);
  __vm_unlock();
  return ret;
}


x86 assembly (clang, -O0):
<__munmap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%edi
call   1050 <__vm_lock@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0xb,%edi
call   1030 <syscall@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <__vm_unlock@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__munmap>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0xffffffff,%edi
call   1050 <__vm_lock@plt>
mov    $0xb,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <syscall@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <__vm_unlock@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @__munmap(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = call i32 @__vm_lock(i32 -1)
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i32 @syscall(i32 11, i8* %7, i64 %8)
store i32 %9, i32* %5
%10 = call i32 (...) @__vm_unlock()
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @__munmap(i8* %0, i64 %1) {
%3 = tail call i32 @__vm_lock(i32 -1)
%4 = tail call i32 @syscall(i32 11, i8* %0, i64 %1)
%5 = tail call i32 (...) @__vm_unlock()
ret i32 %4
}
void glmCopyVector4d(const double source[4], double target[4]) {
  target[0] = source[0];
  target[1] = source[1];
  target[2] = source[2];
  target[3] = source[3];
}


x86 assembly (clang, -O0):
<glmCopyVector4d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<glmCopyVector4d>:
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x8(%rsi)
movsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x10(%rsi)
movsd  0x18(%rdi),%xmm0
movsd  %xmm0,0x18(%rsi)
ret

LLVM IR (-O0):
define void @glmCopyVector4d(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 2
%17 = load double, double* %16
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 2
store double %17, double* %19
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 3
%22 = load double, double* %21
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 3
store double %22, double* %24
ret void
}

LLVM IR (-O2):
define void @glmCopyVector4d(double* nocapture %0, double* nocapture writeonly %1) {
%3 = load double, double* %0
store double %3, double* %1
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %1, i64 1
store double %5, double* %6
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %1, i64 2
store double %8, double* %9
%10 = getelementptr inbounds double, double* %0, i64 3
%11 = load double, double* %10
%12 = getelementptr inbounds double, double* %1, i64 3
store double %11, double* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setBazInitialized();
void myInit() { setBazInitialized(); }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ *SHA1(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/ *);
u_char *hash_sha1(u_char *msg, u_int m_len, u_char *hash) {
  return SHA1(msg, m_len, hash);
}


x86 assembly (clang, -O0):
<hash_sha1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <SHA1@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_sha1>:
jmp    1030 <SHA1@plt>

LLVM IR (-O0):
define i32* @hash_sha1(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** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32* @SHA1(i32* %7, i32 %8, i32* %9)
ret i32* %10
}

LLVM IR (-O2):
define i32* @hash_sha1(i32* %0, i32 %1, i32* %2) {
%4 = tail call i32* @SHA1(i32* %0, i32 %1, i32* %2)
ret i32* %4
}
void worker_process_init(int worker) {}


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

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

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

LLVM IR (-O2):
define void @worker_process_init(i32 %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t letohs(uint16_t value) {
  return (((uint16_t)((uint8_t *)&value)[1]) << 8) |
         (((uint16_t)((uint8_t *)&value)[0]) << 0);
}


x86 assembly (clang, -O0):
<letohs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x4(%rbp),%rax
shl    $0x8,%eax
mov    -0x4(%rbp),%rcx
shl    $0x0,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @letohs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = bitcast i32* %2 to i64*
%4 = getelementptr inbounds i64, i64* %3, i64 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = bitcast i32* %2 to i64*
%9 = getelementptr inbounds i64, i64* %8, i64 0
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = shl i32 %11, 0
%13 = or i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @letohs(i32 %0) {
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help(const char *progname) { printf("help\n"); }


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

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

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

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

/* Variables and functions */
int floor(int /*<<< orphan*/);
int /*<<< orphan*/ log10(int);
int pow(int, int);
uint32_t circulate(uint32_t i) {
  if (i < 10)
    return i;
  uint32_t len = floor(log10(i));
  uint32_t first = i % 10;
  i /= 10;
  return pow(10, len) * first + i;
}


x86 assembly (clang, -O0):
<circulate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1150 <circulate+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1195 <circulate+0x65>
mov    -0x8(%rbp),%edi
call   1040 <log10@plt>
mov    %eax,%edi
call   1050 <floor@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
imul   -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<circulate>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0xa,%edi
jl     1176 <circulate+0x46>
mov    %ebx,%edi
call   1040 <log10@plt>
mov    %eax,%edi
call   1050 <floor@plt>
mov    %ebx,%ecx
mov    $0xcccccccd,%r14d
imul   %rcx,%r14
shr    $0x23,%r14
lea    (%r14,%r14,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%ebx
mov    $0xa,%edi
mov    %eax,%esi
call   1030 <pow@plt>
imul   %ebx,%eax
add    %r14d,%eax
mov    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @circulate(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 @log10(i32 %0)
%5 = tail call i32 @floor(i32 %4)
%6 = urem i32 %0, 10
%7 = udiv i32 %0, 10
%8 = tail call i32 @pow(i32 10, i32 %5)
%9 = mul nsw i32 %8, %6
%10 = add nsw i32 %9, %7
br label %11
11: ; preds = %1, %3
%12 = phi i32 [ %10, %3 ], [ %0, %1 ]
ret i32 %12
}
void rec_check() {}


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

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

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

LLVM IR (-O2):
define void @rec_check() {
ret void
}
/* Variables and functions */
int doerror(char *, int);
int DivisionByZero(char *fnName) { return doerror(fnName, -21); }


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

x86 assembly (clang, -O2):
<DivisionByZero>:
mov    $0xffffffeb,%esi
jmp    1030 <doerror@plt>

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

LLVM IR (-O2):
define i32 @DivisionByZero(i8* %0) {
%2 = tail call i32 @doerror(i8* %0, i32 -21)
ret i32 %2
}
int is_sorted(long int *tab, int n) {
  int i;
  for (i = 0; i < n - 1; i++)
    if (tab[i] > tab[i + 1])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<is_sorted>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1165 <is_sorted+0x65>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,8),%rax
jle    1152 <is_sorted+0x52>
movl   $0x0,-0x4(%rbp)
jmp    116c <is_sorted+0x6c>
jmp    1157 <is_sorted+0x57>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <is_sorted+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_sorted>:
add    $0xffffffff,%esi
xor    %eax,%eax
test   %esi,%esi
cmovle %eax,%esi
nopw   0x0(%rax,%rax,1)
cmp    %rax,%rsi
je     112a <is_sorted+0x2a>
mov    (%rdi,%rax,8),%rcx
lea    0x1(%rax),%rdx
cmp    0x8(%rdi,%rax,8),%rcx
mov    %rdx,%rax
jle    1110 <is_sorted+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

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


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

x86 assembly (clang, -O2):
<j_seticon>:
jmp    1030 <japi_seticon@plt>

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

LLVM IR (-O2):
define void @j_seticon(i32 %0, i32 %1) {
%3 = tail call i32 @japi_seticon(i32 %0, i32 %1)
ret void
}
void kinetis_continue() {}


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

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

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

LLVM IR (-O2):
define void @kinetis_continue() {
ret void
}
int test_imm_7Aint64_lowword_mem(long long *val) {
  return ((*val) & (0x7A << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_7Aint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 122
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int fun1217() { return 1217; }


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

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

LLVM IR (-O0):
define i32 @fun1217() {
ret i32 1217
}

LLVM IR (-O2):
define i32 @fun1217() {
ret i32 1217
}
long int factorial(int n) {
  if (n == 0)
    return 1;
  if (n != 1) {
    return n * factorial(n - 1);
  } else
    return 1;
}


x86 assembly (clang, -O0):
<factorial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1132 <factorial+0x22>
movq   $0x1,-0x8(%rbp)
jmp    116b <factorial+0x5b>
cmpl   $0x1,-0xc(%rbp)
je     1163 <factorial+0x53>
movslq -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <factorial@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
imul   %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    116b <factorial+0x5b>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factorial>:
mov    $0x1,%eax
cmp    $0x2,%edi
jb     1130 <factorial+0x30>
movslq %edi,%rcx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
imul   %rcx,%rax
add    $0xffffffffffffffff,%rcx
test   $0xfffffffe,%ecx
jne    1120 <factorial+0x20>
ret

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

LLVM IR (-O2):
define i64 @factorial(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = sext i32 %0 to i64
br label %5
5: ; preds = %3, %5
%6 = phi i64 [ %4, %3 ], [ %8, %5 ]
%7 = phi i64 [ 1, %3 ], [ %9, %5 ]
%8 = add nsw i64 %6, -1
%9 = mul nsw i64 %7, %6
%10 = and i64 %8, 4294967294
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %1
%13 = phi i64 [ 1, %1 ], [ %9, %5 ]
ret i64 %13
}
/* Variables and functions */
int strlen(char *);
char *next_string(char *s) { return s + strlen(s) + 1; }


x86 assembly (clang, -O0):
<next_string>:
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    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x1,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
add    %rbx,%rax
add    $0x1,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @next_string(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 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %3, i64 %6
%8 = getelementptr inbounds i8, i8* %7, i64 1
ret i8* %8
}

LLVM IR (-O2):
define i8* @next_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = getelementptr inbounds i8, i8* %4, i64 1
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ abort();
_xflsbuf() { abort(); }


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

x86 assembly (clang, -O2):
<_xflsbuf>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @_xflsbuf() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define i32 @_xflsbuf() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ expressao();
void lista_de_expressoes(void) { expressao(); }


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

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

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

LLVM IR (-O2):
define void @lista_de_expressoes() {
%1 = tail call i32 (...) @expressao()
ret void
}
/* Type definitions */
struct list_head {
  int dummy;
};
struct list_element {
  int dummy;
};

/* Variables and functions */
struct list_element *list_insert(struct list_head *, int /*<<< orphan*/ *);
struct list_element *list_push(struct list_head *head) {
  return list_insert(head, NULL);
}


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

x86 assembly (clang, -O2):
<list_push>:
xor    %esi,%esi
jmp    1030 <list_insert@plt>

LLVM IR (-O0):
%struct.list_element = type { i32 }
%struct.list_head = type { i32 }
define %struct.list_element* @list_push(%struct.list_head* %0) {
%2 = alloca %struct.list_head*
store %struct.list_head* %0, %struct.list_head** %2
%3 = load %struct.list_head*, %struct.list_head** %2
%4 = call %struct.list_element* @list_insert(%struct.list_head* %3, i32* null)
ret %struct.list_element* %4
}

LLVM IR (-O2):
%struct.list_element = type { i32 }
%struct.list_head = type { i32 }
define %struct.list_element* @list_push(%struct.list_head* %0) {
%2 = tail call %struct.list_element* @list_insert(%struct.list_head* %0, i32* null)
ret %struct.list_element* %2
}
/* Variables and functions */
int syscall(int, int *, int /*<<< orphan*/);
int mutex_lock(int *m) { return syscall(16, m, 0); }


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

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

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

LLVM IR (-O2):
define i32 @mutex_lock(i32* %0) {
%2 = tail call i32 @syscall(i32 16, i32* %0, i32 0)
ret i32 %2
}