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

/* Variables and functions */
int /*<<< orphan*/ pkt_free(struct pkt *);
void pkt_complete_default(struct pkt *pkt, void *priv) {
  (void)priv;
  pkt_free(pkt);
}


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

x86 assembly (clang, -O2):
<pkt_complete_default>:
jmp    1030 <pkt_free@plt>

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

LLVM IR (-O2):
%struct.pkt = type { i32 }
define void @pkt_complete_default(%struct.pkt* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @pkt_free(%struct.pkt* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ pthread_exit(void *);
int pthread_self();
void *thread2_run(void *arg) {
  printf("thread 2 is running: id is %d\n", pthread_self());
  pthread_exit((void *)0);
}


x86 assembly (clang, -O0):
<thread2_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread2_run>:
push   %rax
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"thread 2 is running: id is %d\0A\00"
define i8* @thread2_run(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @pthread_self()
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @pthread_exit(i8* null)
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
@.str = [31 x i8] c"thread 2 is running: id is %d\0A\00"
define noalias i8* @thread2_run(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @pthread_exit(i8* null)
ret i8* undef
}
void I2CSlaveEnable(unsigned long ulBase) {
  ;
  (*((volatile unsigned long *)(ulBase - 0x40020800 + 0x40020000 +
                                0x00000020))) |= 0x00000020;
  (*((volatile unsigned long *)(ulBase + 0x00000004))) = 0x00000001;
}


x86 assembly (clang, -O0):
<I2CSlaveEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x40020800,%rax
mov    0x40020020(%rax),%rcx
or     $0x20,%rcx
mov    %rcx,0x40020020(%rax)
mov    -0x8(%rbp),%rax
movq   $0x1,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CSlaveEnable>:
orq    $0x20,-0x7e0(%rdi)
20
movq   $0x1,0x4(%rdi)
ret

LLVM IR (-O0):
define void @I2CSlaveEnable(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub i64 %3, 1073874944
%5 = add i64 %4, 1073872896
%6 = add i64 %5, 32
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = or i64 %8, 32
store volatile i64 %9, i64* %7
%10 = load i64, i64* %2
%11 = add i64 %10, 4
%12 = inttoptr i64 %11 to i64*
store volatile i64 1, i64* %12
ret void
}

LLVM IR (-O2):
define void @I2CSlaveEnable(i64 %0) {
%2 = add i64 %0, -2016
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = or i64 %4, 32
store volatile i64 %5, i64* %3
%6 = add i64 %0, 4
%7 = inttoptr i64 %6 to i64*
store volatile i64 1, i64* %7
ret void
}
void GPMCModuleSoftReset(unsigned int baseAddr) {
  (*((volatile unsigned int *)(baseAddr + (0x10)))) = ((0x1u) << (0x00000001u));
}


x86 assembly (clang, -O0):
<GPMCModuleSoftReset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%eax
mov    %eax,%eax
movl   $0x2,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCModuleSoftReset>:
add    $0x10,%edi
movl   $0x2,(%rdi)
ret

LLVM IR (-O0):
define void @GPMCModuleSoftReset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 16
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
store volatile i32 2, i32* %6
ret void
}

LLVM IR (-O2):
define void @GPMCModuleSoftReset(i32 %0) {
%2 = add i32 %0, 16
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
store volatile i32 2, i32* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, int);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void tscfg_report_err_v(const char *file, int line, const char *fmt,
                        va_list args) {
  if (1) {
    fprintf(stderr, "%s:%i: ", file, line);
  }
  vfprintf(stderr, fmt, args);
  fputc('\n', stderr);
}


x86 assembly (clang, -O0):
<tscfg_report_err_v>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xea3(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <vfprintf@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tscfg_report_err_v>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %esi,%ecx
mov    %rdi,%rdx
mov    0x2e9a(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1050 <vfprintf@plt>
mov    0x0(%rbp),%esi
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [8 x i8] c"%s:%i: \00"
define void @tscfg_report_err_v(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11)
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %7
%15 = load i32, i32* %8
%16 = call i32 @vfprintf(i32 %13, i8* %14, i32 %15)
%17 = load i32, i32* @stderr
%18 = call i32 @fputc(i8 signext 10, i32 %17)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [8 x i8] c"%s:%i: \00"
define void @tscfg_report_err_v(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%7 = load i32, i32* @stderr
%8 = tail call i32 @vfprintf(i32 %7, i8* %2, i32 %3)
%9 = load i32, i32* @stderr
%10 = tail call i32 @fputc(i8 signext 10, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void brush_motor_forward(void *brushmotor_address) {
  *((volatile int *)brushmotor_address + 4) = 1;
  usleep(50);
}


x86 assembly (clang, -O0):
<brush_motor_forward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,0x10(%rax)
mov    $0x32,%edi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brush_motor_forward>:
movl   $0x1,0x10(%rdi)
mov    $0x32,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @brush_motor_forward(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 4
store volatile i32 1, i32* %5
%6 = call i32 @usleep(i32 50)
ret void
}

LLVM IR (-O2):
define void @brush_motor_forward(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 16
%3 = bitcast i8* %2 to i32*
store volatile i32 1, i32* %3
%4 = tail call i32 @usleep(i32 50)
ret void
}
int posmod(int i, int n) { return (i % n + n) % n; }


x86 assembly (clang, -O0):
<posmod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
add    -0x8(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<posmod>:
mov    %edi,%eax
cltd
idiv   %esi
lea    (%rdx,%rsi,1),%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @posmod(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 = srem i32 %5, %6
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = srem i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @posmod(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = add nsw i32 %3, %1
%5 = srem i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main(void) {
  int i;
  srand(0);
  double sum = 0.0;
  for (i = 0; i < 100; i++) {
    sum += 0.1;
    fprintf(stderr, "%.13a\n", sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <srand@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1189 <main+0x69>
movsd  0xea9(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
movsd  -0x10(%rbp),%xmm0
lea    0xe92(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1145 <main+0x25>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <srand@plt>
xorpd  %xmm0,%xmm0
mov    $0x64,%ebp
mov    0x2ea1(%rip),%r14
lea    0xec2(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
addsd  0xea8(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    (%r14),%edi
mov    %rbx,%rsi
movsd  0x8(%rsp),%xmm0
call   1040 <fprintf@plt>
movsd  0x8(%rsp),%xmm0
add    $0xffffffff,%ebp
jne    1150 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"%.13a\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 @srand(i32 0)
store double 0.000000e+00, double* %3
store i32 0, i32* %2
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load double, double* %3
%10 = fadd double %9, 1.000000e-01
store double %10, double* %3
%11 = load i32, i32* @stderr
%12 = load double, double* %3
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %12)
br label %14
14: ; preds = %8
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %5
17: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%.13a\0A\00"
define i32 @main() {
%1 = tail call i32 @srand(i32 0)
br label %2
2: ; preds = %0, %2
%3 = phi double [ 0.000000e+00, %0 ], [ %5, %2 ]
%4 = phi i32 [ 0, %0 ], [ %8, %2 ]
%5 = fadd double %3, 1.000000e-01
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %5)
%8 = add nuw nsw i32 %4, 1
%9 = icmp eq i32 %8, 100
br i1 %9, label %10, label %2
10: ; preds = %2
ret i32 0
}
int f() {
  static int local = 2;
  return local;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@f.local = internal global i32 2
define i32 @f() {
%1 = load i32, i32* @f.local
ret i32 %1
}

LLVM IR (-O2):
define i32 @f() {
ret i32 2
}
void log_suspend_abort_reason(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @log_suspend_abort_reason(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int puts(char *);
int foo_func(void) { return puts("foo5"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"foo5\00"
define i32 @foo_func() {
%1 = call i32 @puts(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [5 x i8] c"foo5\00"
define i32 @foo_func() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
struct timeval {
  int tv_sec;
  double tv_usec;
};

/* Variables and functions */
double get_seconds(struct timeval timeStart, struct timeval timeEnd) {
  return ((timeEnd.tv_sec - timeStart.tv_sec) * 1000000 + timeEnd.tv_usec -
          timeStart.tv_usec) /
         1.e6;
}


x86 assembly (clang, -O0):
<get_seconds>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x10(%rbp)
movsd  %xmm0,-0x8(%rbp)
mov    %esi,-0x20(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x20(%rbp),%eax
sub    -0x10(%rbp),%eax
imul   $0xf4240,%eax,%eax
cvtsi2sd %eax,%xmm0
addsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  0xeca(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_seconds>:
sub    %edi,%esi
imul   $0xf4240,%esi,%eax
cvtsi2sd %eax,%xmm2
addsd  %xmm1,%xmm2
subsd  %xmm0,%xmm2
divsd  0xee4(%rip),%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { i32, double }
define double @get_seconds(i32 %0, double %1, i32 %2, double %3) {
%5 = alloca %struct.timeval
%6 = alloca %struct.timeval
%7 = bitcast %struct.timeval* %5 to { i32, double }*
%8 = getelementptr inbounds { i32, double }, { i32, double }* %7, i32 0, i32 0
store i32 %0, i32* %8
%9 = getelementptr inbounds { i32, double }, { i32, double }* %7, i32 0, i32 1
store double %1, double* %9
%10 = bitcast %struct.timeval* %6 to { i32, double }*
%11 = getelementptr inbounds { i32, double }, { i32, double }* %10, i32 0, i32 0
store i32 %2, i32* %11
%12 = getelementptr inbounds { i32, double }, { i32, double }* %10, i32 0, i32 1
store double %3, double* %12
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%16 = load i32, i32* %15
%17 = sub nsw i32 %14, %16
%18 = mul nsw i32 %17, 1000000
%19 = sitofp i32 %18 to double
%20 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%21 = load double, double* %20
%22 = fadd double %19, %21
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%24 = load double, double* %23
%25 = fsub double %22, %24
%26 = fdiv double %25, 1.000000e+06
ret double %26
}

LLVM IR (-O2):
define double @get_seconds(i32 %0, double %1, i32 %2, double %3) {
%5 = sub nsw i32 %2, %0
%6 = mul nsw i32 %5, 1000000
%7 = sitofp i32 %6 to double
%8 = fadd double %7, %3
%9 = fsub double %8, %1
%10 = fdiv double %9, 1.000000e+06
ret double %10
}
int align4(int x) { return (x + 3) & ~3; }


x86 assembly (clang, -O0):
<align4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3,%eax
and    $0xfffffffc,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align4>:
lea    0x3(%rdi),%eax
and    $0xfffffffc,%eax
ret

LLVM IR (-O0):
define i32 @align4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 3
%5 = and i32 %4, -4
ret i32 %5
}

LLVM IR (-O2):
define i32 @align4(i32 %0) {
%2 = add nsw i32 %0, 3
%3 = and i32 %2, -4
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void delay(void) { usleep(1000 * 150); }


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    $0x249f0,%edi
call   1030 <usleep@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
mov    $0x249f0,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @delay() {
%1 = call i32 @usleep(i32 150000)
ret void
}

LLVM IR (-O2):
define void @delay() {
%1 = tail call i32 @usleep(i32 150000)
ret void
}
/* Variables and functions */
int addInstructionToMemory(int);
int createNewlineInstruction(char tokenArray[][20], int numberOfTokens) {
  if (numberOfTokens < 2) {
    return -1;
  }
  int instruction = 12 * 10000;
  if (addInstructionToMemory(instruction) == -1)
    return -1;
  ;
  return 1;
}


x86 assembly (clang, -O0):
<createNewlineInstruction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    1135 <createNewlineInstruction+0x25>
movl   $0xffffffff,-0x4(%rbp)
jmp    1160 <createNewlineInstruction+0x50>
movl   $0x1d4c0,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <addInstructionToMemory@plt>
cmp    $0xffffffff,%eax
jne    1159 <createNewlineInstruction+0x49>
movl   $0xffffffff,-0x4(%rbp)
jmp    1160 <createNewlineInstruction+0x50>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createNewlineInstruction>:
mov    $0xffffffff,%eax
cmp    $0x2,%esi
jl     1137 <createNewlineInstruction+0x27>
push   %rax
mov    $0x1d4c0,%edi
call   1030 <addInstructionToMemory@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
lea    (%rcx,%rcx,1),%eax
add    $0xffffffff,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @createNewlineInstruction([20 x i8]* %0, i32 %1) {
%3 = alloca i32
%4 = alloca [20 x i8]*
%5 = alloca i32
%6 = alloca i32
store [20 x i8]* %0, [20 x i8]** %4
store i32 %1, i32* %5
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 -1, i32* %3
br label %16
10: ; preds = %2
store i32 120000, i32* %6
%11 = load i32, i32* %6
%12 = call i32 @addInstructionToMemory(i32 %11)
%13 = icmp eq i32 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 -1, i32* %3
br label %16
15: ; preds = %10
store i32 1, i32* %3
br label %16
16: ; preds = %15, %14, %9
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @createNewlineInstruction([20 x i8]* nocapture readnone %0, i32 %1) {
%3 = icmp slt i32 %1, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @addInstructionToMemory(i32 120000)
%6 = icmp eq i32 %5, -1
%7 = select i1 %6, i32 -1, i32 1
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ -1, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ test(char *, char *);
void TEST_array_as_function_param(void) {
  test("012345678", "main() { int a[9]; for (int i=0;i<9;i++) a[i]=i; f(a); } "
                    "f(int a[][3]) { for (int i=0;i<3;i++) for (int "
                    "j=0;j<3;j++) printf(\"%d\", a[i][j]); }");
  test("012345678", "main() { int a[9]; for (int i=0;i<9;i++) a[i]=i; f(a); } "
                    "f(int *a[3])  { for (int i=0;i<3;i++) for (int "
                    "j=0;j<3;j++) printf(\"%d\", a[i][j]); }");
}


x86 assembly (clang, -O0):
<TEST_array_as_function_param>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xee8(%rip),%rsi
call   1030 <test@plt>
lea    0xed2(%rip),%rdi
lea    0xf63(%rip),%rsi
call   1030 <test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_array_as_function_param>:
push   %rbx
lea    0xee8(%rip),%rbx
lea    0xeeb(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xf6a(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <test@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"012345678\00"
@.str.1 = [142 x i8] c"main() { int a[9]; for (int i=0;i<9;i++) a[i]=i; f(a); } f(int a[][3]) { for (int i=0;i<3;i++) for (int j=0;j<3;j++) printf(\22%d\22, a[i][j]); }\00"
@.str.2 = [142 x i8] c"main() { int a[9]; for (int i=0;i<9;i++) a[i]=i; f(a); } f(int *a[3]) { for (int i=0;i<3;i++) for (int j=0;j<3;j++) printf(\22%d\22, a[i][j]); }\00"
define void @TEST_array_as_function_param() {
%1 = call i32 @test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"012345678\00"
@.str.1 = [142 x i8] c"main() { int a[9]; for (int i=0;i<9;i++) a[i]=i; f(a); } f(int a[][3]) { for (int i=0;i<3;i++) for (int j=0;j<3;j++) printf(\22%d\22, a[i][j]); }\00"
@.str.2 = [142 x i8] c"main() { int a[9]; for (int i=0;i<9;i++) a[i]=i; f(a); } f(int *a[3]) { for (int i=0;i<3;i++) for (int j=0;j<3;j++) printf(\22%d\22, a[i][j]); }\00"
define void @TEST_array_as_function_param() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void error(char *s) {
  fprintf(stderr, "%s", s);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printid(float);
void main() {
  float x, y, z = 4;
  print("x -4.000000");
  x += -4.;
  printid(x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xed8(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    0xed0(%rip),%rdi
call   1030 <print@plt>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeae(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <printid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
call   1030 <print@plt>
movss  0xecb(%rip),%xmm0
pop    %rax
jmp    1040 <printid@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"x -4.000000\00"
define void @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
store float 4.000000e+00, float* %3
%4 = call i32 @print(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fadd double %6, -4.000000e+00
%8 = fptrunc double %7 to float
store float %8, float* %1
%9 = load float, float* %1
%10 = call i32 @printid(float %9)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"x -4.000000\00"
define void @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printid(float 0x7FF8000000000000)
ret void
}
int testLib7(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @testLib7() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ RST(int, int, int);
int /*<<< orphan*/ T_WAIT_UNTIL(int);
void op_0xd7(void) {
  RST(0x10, 5, 8);
  T_WAIT_UNTIL(11);
  return;
}


x86 assembly (clang, -O0):
<op_0xd7>:
push   %rbp
mov    %rsp,%rbp
mov    $0x10,%edi
mov    $0x5,%esi
mov    $0x8,%edx
call   1030 <RST@plt>
mov    $0xb,%edi
call   1040 <T_WAIT_UNTIL@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_0xd7>:
push   %rax
mov    $0x10,%edi
mov    $0x5,%esi
mov    $0x8,%edx
call   1030 <RST@plt>
mov    $0xb,%edi
pop    %rax
jmp    1040 <T_WAIT_UNTIL@plt>

LLVM IR (-O0):
define void @op_0xd7() {
%1 = call i32 @RST(i32 16, i32 5, i32 8)
%2 = call i32 @T_WAIT_UNTIL(i32 11)
ret void
}

LLVM IR (-O2):
define void @op_0xd7() {
%1 = tail call i32 @RST(i32 16, i32 5, i32 8)
%2 = tail call i32 @T_WAIT_UNTIL(i32 11)
ret void
}
float clad_clampf(float value, float min, float max) {
  if (value < min)
    return min;
  if (value > max)
    return max;
  return value;
}


x86 assembly (clang, -O0):
<clad_clampf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  %xmm2,-0x10(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1135 <clad_clampf+0x35>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <clad_clampf+0x5d>
movss  -0x8(%rbp),%xmm0
ucomiss -0x10(%rbp),%xmm0
jbe    1153 <clad_clampf+0x53>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    115d <clad_clampf+0x5d>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<clad_clampf>:
minss  %xmm0,%xmm2
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm3
andnps %xmm2,%xmm3
andps  %xmm1,%xmm0
orps   %xmm3,%xmm0
ret

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

LLVM IR (-O2):
define float @clad_clampf(float %0, float %1, float %2) {
%4 = fcmp olt float %0, %1
%5 = fcmp ogt float %0, %2
%6 = select i1 %5, float %2, float %0
%7 = select i1 %4, float %1, float %6
ret float %7
}
__attribute__((always_)) int
cmp_bits(const unsigned char *a, const unsigned char *b, unsigned int pos) {
  unsigned int ofs;
  unsigned char bit_a, bit_b;
  ofs = pos >> 3;
  pos = ~pos & 7;
  bit_a = (a[ofs] >> pos) & 1;
  bit_b = (b[ofs] >> pos) & 1;
  return bit_a - bit_b;
}


x86 assembly (clang, -O0):
<cmp_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shr    $0x3,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
and    $0x7,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
mov    -0x14(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %al,-0x19(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
movzbl (%rax,%rcx,1),%eax
mov    -0x14(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %al,-0x1a(%rbp)
movzbl -0x19(%rbp),%eax
movzbl -0x1a(%rbp),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_bits>:
mov    %edx,%ecx
mov    %edx,%edx
shr    $0x3,%rdx
movzbl (%rdi,%rdx,1),%eax
not    %cl
and    $0x7,%cl
shr    %cl,%eax
movzbl (%rsi,%rdx,1),%edx
shr    %cl,%edx
and    $0x1,%eax
and    $0x1,%edx
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @cmp_bits(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = lshr i32 %10, 3
store i32 %11, i32* %7
%12 = load i32, i32* %6
%13 = xor i32 %12, -1
%14 = and i32 %13, 7
store i32 %14, i32* %6
%15 = load i8*, i8** %4
%16 = load i32, i32* %7
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = load i32, i32* %6
%22 = ashr i32 %20, %21
%23 = and i32 %22, 1
%24 = trunc i32 %23 to i8
store i8 %24, i8* %8
%25 = load i8*, i8** %5
%26 = load i32, i32* %7
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = load i32, i32* %6
%32 = ashr i32 %30, %31
%33 = and i32 %32, 1
%34 = trunc i32 %33 to i8
store i8 %34, i8* %9
%35 = load i8, i8* %8
%36 = zext i8 %35 to i32
%37 = load i8, i8* %9
%38 = zext i8 %37 to i32
%39 = sub nsw i32 %36, %38
ret i32 %39
}

LLVM IR (-O2):
define i32 @cmp_bits(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = lshr i32 %2, 3
%5 = and i32 %2, 7
%6 = xor i32 %5, 7
%7 = zext i32 %4 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = lshr i32 %10, %6
%12 = and i32 %11, 1
%13 = getelementptr inbounds i8, i8* %1, i64 %7
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = lshr i32 %15, %6
%17 = and i32 %16, 1
%18 = sub nsw i32 %12, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ __putc(int);
int __io_putchar(int ch) {
  if (ch == '\n')
    __putc('\r');
  __putc(ch);
  return ch;
}


x86 assembly (clang, -O0):
<__io_putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jne    112f <__io_putchar+0x1f>
mov    $0xd,%edi
call   1030 <__putc@plt>
mov    -0x4(%rbp),%edi
call   1030 <__putc@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__io_putchar>:
push   %rbx
mov    %edi,%ebx
cmp    $0xa,%edi
jne    1122 <__io_putchar+0x12>
mov    $0xd,%edi
call   1030 <__putc@plt>
mov    %ebx,%edi
call   1030 <__putc@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @__io_putchar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 10
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @__putc(i32 13)
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* %2
%9 = call i32 @__putc(i32 %8)
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @__io_putchar(i32 returned %0) {
%2 = icmp eq i32 %0, 10
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @__putc(i32 13)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 @__putc(i32 %0)
ret i32 %0
}
/* Variables and functions */
int init_ext(int);
int ext_child_init(int child) { return init_ext(child); }


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

x86 assembly (clang, -O2):
<ext_child_init>:
jmp    1030 <init_ext@plt>

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

LLVM IR (-O2):
define i32 @ext_child_init(i32 %0) {
%2 = tail call i32 @init_ext(i32 %0)
ret i32 %2
}
__attribute__((always_)) int radix_tree_is_indirect_ptr(void *ptr) {
  return (int)((unsigned long)ptr & 1);
}


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

x86 assembly (clang, -O2):
<radix_tree_is_indirect_ptr>:
mov    %rdi,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @radix_tree_is_indirect_ptr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = and i64 %4, 1
%6 = trunc i64 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @radix_tree_is_indirect_ptr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = and i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ check_vect();
int /*<<< orphan*/ foo();
int main(void) {
  int i;
  check_vect();
  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 <check_vect@plt>
mov    $0x0,%al
call   1040 <foo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @check_vect()
%4 = call i32 (...) @foo()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @check_vect()
%2 = tail call i32 (...) @foo()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int Ftestread(char *filename) {
  FILE *in;
  if ((in = fopen(filename, "rb")) == NULL)
    return (-1);
  fclose(in);
  return (0);
}


x86 assembly (clang, -O0):
<Ftestread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1156 <Ftestread+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    1166 <Ftestread+0x46>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ftestread>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     113e <Ftestread+0x1e>
mov    %rax,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define i32 @Ftestread(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %12
9: ; preds = %1
%10 = load i32*, i32** %4
%11 = call i32 @fclose(i32* %10)
store i32 0, i32* %2
br label %12
12: ; preds = %9, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define i32 @Ftestread(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 0, %4 ], [ -1, %1 ]
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int _sys_lseek(int, int /*<<< orphan*/, int);
int lseek(int fd, off_t offset, int type) {
  return _sys_lseek(fd, offset, type);
}


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

x86 assembly (clang, -O2):
<lseek>:
jmp    1030 <_sys_lseek@plt>

LLVM IR (-O0):
define i32 @lseek(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 @_sys_lseek(i32 %7, i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @lseek(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @_sys_lseek(i32 %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Starting.\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 = [11 x i8] c"Starting.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [10 x i8] c"Starting.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putdln(int);
int /*<<< orphan*/ puts(char *);
void emitcondjmp(char cond[], int label) {
  puts("\ttest eax, eax\n");
  puts("\tj");
  puts(cond);
  puts(" label");
  putdln(label);
}


x86 assembly (clang, -O0):
<emitcondjmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    -0xc(%rbp),%edi
call   1040 <putdln@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emitcondjmp>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <putdln@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"\09test eax, eax\0A\00"
@.str.1 = [3 x i8] c"\09j\00"
@.str.2 = [7 x i8] c" label\00"
define void @emitcondjmp(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%7 = load i8*, i8** %3
%8 = call i32 @puts(i8* %7)
%9 = call i32 @puts(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* %4
%11 = call i32 @putdln(i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"\09test eax, eax\0A\00"
@.str.1 = [3 x i8] c"\09j\00"
@.str.2 = [7 x i8] c" label\00"
define void @emitcondjmp(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) %0)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @putdln(i32 %1)
ret void
}
int foo(void) {
  int a, b, c;
  asm("# Magic instruction" : "=r"(a) : : "memory");
  asm("# Magic instruction" : "=r"(b) : : "memory");
  asm("# Magic instruction" : "=r"(c) : : "memory");
  return a + b + c;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %eax,-0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
add    %eax,%ecx
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 asm "# Magic instruction", "=r,~{memory},~{dirflag},~{fpsr},~{flags}"()
store i32 %4, i32* %1
%5 = call i32 asm "# Magic instruction", "=r,~{memory},~{dirflag},~{fpsr},~{flags}"()
store i32 %5, i32* %2
%6 = call i32 asm "# Magic instruction", "=r,~{memory},~{dirflag},~{fpsr},~{flags}"()
store i32 %6, i32* %3
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 asm "# Magic instruction", "=r,~{memory},~{dirflag},~{fpsr},~{flags}"()
%2 = tail call i32 asm "# Magic instruction", "=r,~{memory},~{dirflag},~{fpsr},~{flags}"()
%3 = tail call i32 asm "# Magic instruction", "=r,~{memory},~{dirflag},~{fpsr},~{flags}"()
%4 = add nsw i32 %2, %1
%5 = add nsw i32 %4, %3
ret i32 %5
}
/* Variables and functions */
void print_stack_trace(void) {
  void *trace[16];
  char **messages = (char **)NULL;
  int i, trace_size = 0;
}


x86 assembly (clang, -O0):
<print_stack_trace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x88(%rbp)
movl   $0x0,-0x90(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @print_stack_trace() {
%1 = alloca [16 x i8*]
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i32
store i8** null, i8*** %2
store i32 0, i32* %4
ret void
}

LLVM IR (-O2):
define void @print_stack_trace() {
ret void
}
void vpx_usec_timer_mark(struct vpx_usec_timer *t) {}


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

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

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

LLVM IR (-O2):
%struct.vpx_usec_timer = type opaque
define void @vpx_usec_timer_mark(%struct.vpx_usec_timer* nocapture %0) {
ret void
}
void av_frame_set_qp_table() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_set_qp_table() {
ret void
}
/* Type definitions */
typedef scalar_t__ int16_t;

/* Variables and functions */
int16_t add(int16_t x, int16_t y) { return (x + y); }


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

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

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

LLVM IR (-O2):
define i64 @add(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void pl_mm_free(void *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<pl_mm_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @pl_mm_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *to_str(int num) {
  char *s = malloc(10);
  sprintf(s, "%d", num);
  return s;
}


x86 assembly (clang, -O0):
<to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xeb9(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_str>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
lea    0xec7(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
call   1040 <sprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @to_str(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* @malloc(i32 10)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* %2
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define noalias i8* @to_str(i32 %0) {
%2 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ pop_id();
int /*<<< orphan*/ printf(char *);
void quitter(int ta_socket) {
  printf("bye bye...\n");
  close(ta_socket);
  pop_id();
  exit(0);
}


x86 assembly (clang, -O0):
<quitter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
mov    $0x0,%al
call   1050 <pop_id@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<quitter>:
push   %rbx
mov    %edi,%ebx
lea    0xeb6(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
call   1050 <pop_id@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"bye bye...\0A\00"
define void @quitter(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @close(i32 %4)
%6 = call i32 (...) @pop_id()
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [11 x i8] c"bye bye...\00"
define void @quitter(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @close(i32 %0)
%4 = tail call i32 (...) @pop_id()
%5 = tail call i32 @exit(i32 0)
unreachable
}
void NullFunction(void *junk) { junk = junk; }


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

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

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

LLVM IR (-O2):
define void @NullFunction(i8* nocapture %0) {
ret void
}