xunge/DecIR huggingface dataset:
void swap(int *a, int *b) {
  if (*a != *b)
    *a ^= *b ^= *a ^= *b;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
je     113c <swap+0x3c>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
xor    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
mov    (%rdi),%ecx
mov    (%rsi),%eax
cmp    %eax,%ecx
je     1112 <swap+0x12>
xor    %ecx,%eax
mov    %eax,(%rdi)
xor    (%rsi),%eax
mov    %eax,(%rsi)
xor    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @swap(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* %5
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = icmp ne i32 %6, %8
br i1 %9, label %10, label %22
10: ; preds = %2
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = load i32*, i32** %3
%14 = load i32, i32* %13
%15 = xor i32 %14, %12
store i32 %15, i32* %13
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
%18 = xor i32 %17, %15
store i32 %18, i32* %16
%19 = load i32*, i32** %3
%20 = load i32, i32* %19
%21 = xor i32 %20, %18
store i32 %21, i32* %19
br label %22
22: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
define void @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = icmp eq i32 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = xor i32 %4, %3
store i32 %7, i32* %0
%8 = load i32, i32* %1
%9 = xor i32 %8, %7
store i32 %9, i32* %1
%10 = load i32, i32* %0
%11 = xor i32 %10, %9
store i32 %11, i32* %0
br label %12
12: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_setinheritsched(pthread_attr_t *attr, int inheritsched) {
  (void)attr;
  (void)inheritsched;
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @pthread_attr_setinheritsched(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
ret i32 0
}

LLVM IR (-O2):
define i32 @pthread_attr_setinheritsched(i32* nocapture readnone %0, i32 %1) {
ret i32 0
}
int func4(int n, int base) {
  if (n <= 0) {
    return 0;
  }
  if (n == 1) {
    return base;
  }
  return base + func4(n - 1, base) + func4(n - 2, base);
}


x86 assembly (clang, -O0):
<func4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1134 <func4+0x24>
movl   $0x0,-0x4(%rbp)
jmp    117f <func4+0x6f>
cmpl   $0x1,-0x8(%rbp)
jne    1149 <func4+0x39>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <func4+0x6f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <func4@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
mov    -0xc(%rbp),%esi
call   1030 <func4@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func4>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    115d <func4+0x4d>
mov    %esi,%r14d
mov    %edi,%r15d
lea    -0x1(%r15),%ebp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
test   %ebp,%ebp
je     1158 <func4+0x48>
lea    -0x1(%r15),%edi
mov    %r14d,%esi
call   1030 <func4@plt>
lea    -0x2(%r15),%ecx
add    %r14d,%ebx
add    %eax,%ebx
add    $0xfffffffe,%ebp
cmp    $0x2,%r15d
mov    %ecx,%r15d
ja     1130 <func4+0x20>
xor    %r14d,%r14d
add    %r14d,%ebx
jmp    115f <func4+0x4f>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @func4(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %19, label %4
4: ; preds = %2, %8
%5 = phi i32 [ %11, %8 ], [ %0, %2 ]
%6 = phi i32 [ %13, %8 ], [ 0, %2 ]
%7 = icmp eq i32 %5, 1
br i1 %7, label %15, label %8
8: ; preds = %4
%9 = add nsw i32 %5, -1
%10 = tail call i32 @func4(i32 %9, i32 %1)
%11 = add nsw i32 %5, -2
%12 = add i32 %6, %1
%13 = add i32 %12, %10
%14 = icmp ult i32 %5, 3
br i1 %14, label %15, label %4
15: ; preds = %4, %8
%16 = phi i32 [ %13, %8 ], [ %6, %4 ]
%17 = phi i32 [ 0, %8 ], [ %1, %4 ]
%18 = add nsw i32 %17, %16
br label %19
19: ; preds = %15, %2
%20 = phi i32 [ %18, %15 ], [ 0, %2 ]
ret i32 %20
}
void ScaleFilterCols_C() {}


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

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

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

LLVM IR (-O2):
define void @ScaleFilterCols_C() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parallel_clr_eoi(int);
int /*<<< orphan*/ parallel_set_eoi(int);
void parallel_drv2_set_eoi(unsigned char val) {
  if (val) {
    parallel_set_eoi(0x10);
  } else {
    parallel_clr_eoi(~0x10);
  }
}


x86 assembly (clang, -O0):
<parallel_drv2_set_eoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     1147 <parallel_drv2_set_eoi+0x27>
mov    $0x10,%edi
call   1040 <parallel_set_eoi@plt>
jmp    1151 <parallel_drv2_set_eoi+0x31>
mov    $0xffffffef,%edi
call   1030 <parallel_clr_eoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parallel_drv2_set_eoi>:
test   %edi,%edi
je     112e <parallel_drv2_set_eoi+0xe>
mov    $0x10,%edi
jmp    1040 <parallel_set_eoi@plt>
mov    $0xffffffef,%edi
jmp    1030 <parallel_clr_eoi@plt>

LLVM IR (-O0):
define void @parallel_drv2_set_eoi(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = icmp ne i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @parallel_set_eoi(i32 16)
br label %9
7: ; preds = %1
%8 = call i32 @parallel_clr_eoi(i32 -17)
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @parallel_drv2_set_eoi(i8 zeroext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @parallel_set_eoi(i32 16)
br label %7
5: ; preds = %1
%6 = tail call i32 @parallel_clr_eoi(i32 -17)
br label %7
7: ; preds = %5, %3
ret void
}
XUngrabPointer() {}


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

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

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

LLVM IR (-O2):
define i32 @XUngrabPointer() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ XML_Char;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/ const *);
void *charElement(void *userData, const XML_Char *s, int len) {
  char buf[len + 1];
  strcpy(buf, s);
  buf[len] = '\0';
  printf(" str=(%s)\n", buf);
}


x86 assembly (clang, -O0):
<charElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x38(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x38(%rbp),%rsi
movslq -0x1c(%rbp),%rax
movb   $0x0,(%rsi,%rax,1)
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x8(%rbp),%rax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charElement>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %edx,%r14d
lea    0x1(%r14),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
call   1030 <strcpy@plt>
movslq %r14d,%rax
movb   $0x0,(%rax,%rbx,1)
lea    0xeab(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c" str=(%s)\0A\00"
define i8* @charElement(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%10 = load i32, i32* %7
%11 = add nsw i32 %10, 1
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %8
%14 = alloca i8, i64 %12
store i64 %12, i64* %9
%15 = load i32*, i32** %6
%16 = call i32 @strcpy(i8* %14, i32* %15)
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %14, i64 %18
store i8 0, i8* %19
%20 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %14)
%21 = load i8*, i8** %8
%22 = load i8*, i8** %4
ret i8* %22
}

LLVM IR (-O2):
@.str = [11 x i8] c" str=(%s)\0A\00"
define noalias i8* @charElement(i8* nocapture readnone %0, i32* %1, i32 %2) {
%4 = add nsw i32 %2, 1
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = call i32 @strcpy(i8* %6, i32* %1)
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
store i8 0, i8* %9
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ PIN_OFF(int);
int /*<<< orphan*/ Welcome();
main(int argc, char **argv) {
  int pin = 44;
  Welcome();
  PIN_OFF(pin);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2c,-0x14(%rbp)
mov    $0x0,%al
call   1040 <Welcome@plt>
mov    -0x14(%rbp),%edi
call   1030 <PIN_OFF@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <Welcome@plt>
mov    $0x2c,%edi
call   1030 <PIN_OFF@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 44, i32* %5
%6 = call i32 (...) @Welcome()
%7 = load i32, i32* %5
%8 = call i32 @PIN_OFF(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @Welcome()
%4 = tail call i32 @PIN_OFF(i32 44)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int no_return_one_lev(int i) {
  if (i > 2) {
    printf(">2\n");
  }
}


x86 assembly (clang, -O0):
<no_return_one_lev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1131 <no_return_one_lev+0x21>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<no_return_one_lev>:
cmp    $0x3,%edi
jl     1126 <no_return_one_lev+0x16>
push   %rax
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c">2\0A\00"
define i32 @no_return_one_lev(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
@str = [3 x i8] c">2\00"
define i32 @no_return_one_lev(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
ret i32 undef
}
void CursorDown(HowMuch) int HowMuch;
{
  char Str[10];
  if (HowMuch == 0)
    return;
  sprintf(Str, "\033[%dB", HowMuch);
  WRITETEST(Str);
}


x86 assembly (clang, -O0):
<CursorDown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113a <CursorDown+0x1a>
jmp    115a <CursorDown+0x3a>
lea    -0xe(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xeb8(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0xe(%rbp),%rdi
mov    $0x0,%al
call   1030 <WRITETEST@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CursorDown>:
test   %edi,%edi
je     1150 <CursorDown+0x30>
push   %rbx
sub    $0x10,%rsp
mov    %edi,%edx
lea    0xece(%rip),%rsi
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <WRITETEST@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dB\00"
define void @CursorDown(i32 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = icmp eq i32 %0, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0)
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @WRITETEST to i32 (i8*, ...)*)(i8* %3)
br label %8
8: ; preds = %1, %5
ret void
}
/* Type definitions */
struct command_stack {
  int dummy;
};

/* Variables and functions */
int cs_is_empty(const struct command_stack *t) { return (t == NULL); }


x86 assembly (clang, -O0):
<cs_is_empty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cs_is_empty>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %al
ret

LLVM IR (-O0):
%struct.command_stack = type { i32 }
define i32 @cs_is_empty(%struct.command_stack* %0) {
%2 = alloca %struct.command_stack*
store %struct.command_stack* %0, %struct.command_stack** %2
%3 = load %struct.command_stack*, %struct.command_stack** %2
%4 = icmp eq %struct.command_stack* %3, null
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
%struct.command_stack = type { i32 }
define i32 @cs_is_empty(%struct.command_stack* readnone %0) {
%2 = icmp eq %struct.command_stack* %0, null
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int *, long);
void copy_ivector(int *src, long nl1, long nh1, int *dst, long nl2, long nh2) {
  long len = nh1 - nl1 + 1;
  static long size = sizeof(int);
  memcpy(dst + nl2, src + nl1, len * size);
}


x86 assembly (clang, -O0):
<copy_ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
mov    -0x38(%rbp),%rdx
imul   0x2ebe(%rip),%rdx
call   1030 <memcpy@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_ivector>:
sub    %rsi,%rdx
lea    (%rcx,%r8,4),%rax
lea    (%rdi,%rsi,4),%rsi
lea    0x4(,%rdx,4),%rdx
mov    %rax,%rdi
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
@copy_ivector.size = internal global i64 4
define void @copy_ivector(i32* %0, i64 %1, i64 %2, i32* %3, i64 %4, i64 %5) {
%7 = alloca i32*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
store i32* %0, i32** %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i32* %3, i32** %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%14 = load i64, i64* %9
%15 = load i64, i64* %8
%16 = sub nsw i64 %14, %15
%17 = add nsw i64 %16, 1
store i64 %17, i64* %13
%18 = load i32*, i32** %10
%19 = load i64, i64* %11
%20 = getelementptr inbounds i32, i32* %18, i64 %19
%21 = load i32*, i32** %7
%22 = load i64, i64* %8
%23 = getelementptr inbounds i32, i32* %21, i64 %22
%24 = load i64, i64* %13
%25 = load i64, i64* @copy_ivector.size
%26 = mul nsw i64 %24, %25
%27 = call i32 @memcpy(i32* %20, i32* %23, i64 %26)
ret void
}

LLVM IR (-O2):
define void @copy_ivector(i32* %0, i64 %1, i64 %2, i32* %3, i64 %4, i64 %5) {
%7 = sub nsw i64 %2, %1
%8 = getelementptr inbounds i32, i32* %3, i64 %4
%9 = getelementptr inbounds i32, i32* %0, i64 %1
%10 = shl i64 %7, 2
%11 = add i64 %10, 4
%12 = tail call i32 @memcpy(i32* %8, i32* %9, i64 %11)
ret void
}
void avcodec_get_pix_fmt_loss() {}


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

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

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

LLVM IR (-O2):
define void @avcodec_get_pix_fmt_loss() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void funcWithParmRef(int *i) { printf("this is func() %d\n", *i); }


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

x86 assembly (clang, -O2):
<funcWithParmRef>:
mov    (%rdi),%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"this is func() %d\0A\00"
define void @funcWithParmRef(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"this is func() %d\0A\00"
define void @funcWithParmRef(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
int sum(int n, int m) {
  if (n == 0) {
    return m;
  } else {
    return sum(n - 1, m + 1);
  }
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1133 <sum+0x23>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <sum+0x37>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1030 <sum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @sum(i32 %0, i32 %1) {
%3 = add i32 %1, %0
ret i32 %3
}
signed long int signedlongint_ignoring_longint(signed long int x, long int y) {
  return x;
}


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

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

LLVM IR (-O0):
define i64 @signedlongint_ignoring_longint(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
ret i64 %5
}

LLVM IR (-O2):
define i64 @signedlongint_ignoring_longint(i64 returned %0, i64 %1) {
ret i64 %0
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
scalar_t__ tcgetattr(int, struct termios *);
int isatty(int fd) {
  struct termios termios;
  return (tcgetattr(fd, &termios) == 0);
}


x86 assembly (clang, -O0):
<isatty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1030 <tcgetattr@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isatty>:
push   %rax
mov    %rsp,%rsi
call   1030 <tcgetattr@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.termios = type { i32 }
define i32 @isatty(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.termios
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @tcgetattr(i32 %4, %struct.termios* %3)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @isatty(i32 %0) {
%2 = alloca %struct.termios
%3 = bitcast %struct.termios* %2 to i8*
%4 = call i64 @tcgetattr(i32 %0, %struct.termios* %2)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
char *findNonWhitespace(char *p) {
  while (*p && (*p == ' ' || *p == '\t'))
    p++;
  return p;
}


x86 assembly (clang, -O0):
<findNonWhitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1148 <findNonWhitespace+0x48>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0xa(%rbp)
je     1142 <findNonWhitespace+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1158 <findNonWhitespace+0x58>
jmp    1169 <findNonWhitespace+0x69>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <findNonWhitespace+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<findNonWhitespace>:
mov    %rdi,%rax
jmp    1114 <findNonWhitespace+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <findNonWhitespace+0x10>
cmp    $0x9,%cl
je     1110 <findNonWhitespace+0x10>
ret

LLVM IR (-O0):
define i8* @findNonWhitespace(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %22, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 32
br i1 %12, label %18, label %13
13: ; preds = %8
%14 = load i8*, i8** %2
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 9
br label %18
18: ; preds = %13, %8
%19 = phi i1 [ true, %8 ], [ %17, %13 ]
br label %20
20: ; preds = %18, %3
%21 = phi i1 [ false, %3 ], [ %19, %18 ]
br i1 %21, label %22, label %25
22: ; preds = %20
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %2
br label %3
25: ; preds = %20
%26 = load i8*, i8** %2
ret i8* %26
}

LLVM IR (-O2):
define i8* @findNonWhitespace(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 9, label %5
i8 32, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
ret i8* %3
}
/* Type definitions */
struct rtattr {
  int dummy;
};
typedef int /*<<< orphan*/ __u16;

/* Variables and functions */
scalar_t__ RTA_DATA(struct rtattr const *);
__u16 rta_getattr_u16(const struct rtattr *rta) {
  return *(__u16 *)RTA_DATA(rta);
}


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

x86 assembly (clang, -O2):
<rta_getattr_u16>:
push   %rax
call   1030 <RTA_DATA@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.rtattr = type { i32 }
define i32 @rta_getattr_u16(%struct.rtattr* %0) {
%2 = alloca %struct.rtattr*
store %struct.rtattr* %0, %struct.rtattr** %2
%3 = load %struct.rtattr*, %struct.rtattr** %2
%4 = call i64 @RTA_DATA(%struct.rtattr* %3)
%5 = inttoptr i64 %4 to i32*
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
%struct.rtattr = type { i32 }
define i32 @rta_getattr_u16(%struct.rtattr* %0) {
%2 = tail call i64 @RTA_DATA(%struct.rtattr* %0)
%3 = inttoptr i64 %2 to i32*
%4 = load i32, i32* %3
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
void trace1(char *name, char *caller, char *message) {
  FILE *tracef;
  tracef = fopen(name, "a");
  fprintf(tracef, "%s: %s\n", caller, message);
  fclose(tracef);
  return;
}


x86 assembly (clang, -O0):
<trace1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe97(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trace1>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
lea    0xebe(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xeb1(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [8 x i8] c"%s: %s\0A\00"
define void @trace1(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %9, i32** %7
%10 = load i32*, i32** %7
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %11, i8* %12)
%14 = load i32*, i32** %7
%15 = call i32 @fclose(i32* %14)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [8 x i8] c"%s: %s\0A\00"
define void @trace1(i8* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8* %2)
%6 = tail call i32 @fclose(i32* %4)
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int check_authentication(char *password) {
  int auth_flag = 0;
  char password_buffer[16] = {'a'};
  strcpy(password_buffer, password);
  if (strcmp(password_buffer, "p@ssw0rd") == 0) {
    auth_flag = 1;
  }
  return auth_flag;
}


x86 assembly (clang, -O0):
<check_authentication>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    0xec6(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1177 <check_authentication+0x57>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_authentication>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rsi
movaps 0xed1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xecb(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.check_authentication.password_buffer = <{ i8, [15 x i8] }> <{ i8 97, [15 x i8] zeroinitializer }>
@.str = [9 x i8] c"p@ssw0rd\00"
define i32 @check_authentication(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [16 x i8]
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = bitcast [16 x i8]* %4 to i8*
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%10 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 1, i32* %3
br label %13
13: ; preds = %12, %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@__const.check_authentication.password_buffer = <{ i8, [15 x i8] }> <{ i8 97, [15 x i8] zeroinitializer }>
@.str = [9 x i8] c"p@ssw0rd\00"
define i32 @check_authentication(i8* %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = call i32 @strcpy(i8* %3, i8* %0)
%5 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
scalar_t__ ce_utf8_strlen(char const *);
int64_t ce_utf8_last_index(const char *string) {
  int64_t len = ce_utf8_strlen(string);
  if (len > 0)
    len--;
  return len;
}


x86 assembly (clang, -O0):
<ce_utf8_last_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ce_utf8_strlen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    1140 <ce_utf8_last_index+0x30>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ce_utf8_last_index>:
push   %rax
call   1030 <ce_utf8_strlen@plt>
xor    %ecx,%ecx
test   %rax,%rax
setg   %cl
sub    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @ce_utf8_last_index(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @ce_utf8_strlen(i8* %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i64, i64* %3
%10 = add nsw i64 %9, -1
store i64 %10, i64* %3
br label %11
11: ; preds = %8, %1
%12 = load i64, i64* %3
ret i64 %12
}

LLVM IR (-O2):
define i64 @ce_utf8_last_index(i8* %0) {
%2 = tail call i64 @ce_utf8_strlen(i8* %0)
%3 = icmp sgt i64 %2, 0
%4 = sext i1 %3 to i64
%5 = add nsw i64 %2, %4
ret i64 %5
}
void gnttab_grant_foreign_transfer_ref() {}


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

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

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

LLVM IR (-O2):
define void @gnttab_grant_foreign_transfer_ref() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, int);
char *int_to_str(int num, char *bufr) {
  char *prefix = "d# ";
  if (num < 8)
    prefix = "";
  sprintf(bufr, "%s%d", prefix, num);
  return (bufr);
}


x86 assembly (clang, -O0):
<int_to_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    113f <int_to_str+0x2f>
lea    0xec8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x4(%rbp),%ecx
lea    0xeb3(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_to_str>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ecx
cmp    $0x8,%edi
lea    0xee3(%rip),%rax
lea    0xed9(%rip),%rdx
cmovl  %rax,%rdx
lea    0xed2(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"d# \00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"%s%d\00"
define i8* @int_to_str(i32 %0, i8* returned writeonly %1) {
%3 = icmp slt i32 %0, 8
%4 = select i1 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %4, i32 %0)
ret i8* %1
}
int oldfoo(bar)
char bar;
{ return bar - 2; }


x86 assembly (clang, -O0):
<oldfoo>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<oldfoo>:
movsbl %dil,%eax
add    $0xfffffffe,%eax
ret

LLVM IR (-O0):
define i32 @oldfoo(i32 %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = sub nsw i32 %5, 2
ret i32 %6
}

LLVM IR (-O2):
define i32 @oldfoo(i32 %0) {
%2 = shl i32 %0, 24
%3 = ashr exact i32 %2, 24
%4 = add nsw i32 %3, -2
ret i32 %4
}
int myfunc(int a, int b) { return a + b; }


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

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

LLVM IR (-O0):
define i32 @myfunc(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @myfunc(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;
typedef int /*<<< orphan*/ __m128;

/* Variables and functions */
__m128 __attribute__((__always___, __nodebug__)) _mm_castsi128_ps(__m128i in) {
  return (__m128)in;
}


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

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

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

LLVM IR (-O2):
define i32 @_mm_castsi128_ps(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
char *findvar(char *, char ***);
char *get_env(char *name) {
  char **p;
  return (findvar(name, &p));
}


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

x86 assembly (clang, -O2):
<get_env>:
push   %rax
mov    %rsp,%rsi
call   1030 <findvar@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @get_env(i8* %0) {
%2 = alloca i8**
%3 = bitcast i8*** %2 to i8*
%4 = call i8* @findvar(i8* %0, i8*** %2)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ stdout;
int vfprintf(int /*<<< orphan*/, char const *, int /*<<< orphan*/);
int vprintf(const char *format, va_list arg) {
  return vfprintf(stdout, format, arg);
}


x86 assembly (clang, -O0):
<vprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <vfprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vprintf>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <vfprintf@plt>

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

LLVM IR (-O2):
@stdout = global i32 0
define i32 @vprintf(i8* %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @vfprintf(i32 %3, i8* %0, i32 %1)
ret i32 %4
}
void TXC0_interrupt_event(void) {}


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

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

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

LLVM IR (-O2):
define void @TXC0_interrupt_event() {
ret void
}
/* Type definitions */
struct ip_addr {
  int dummy;
};
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
int ip_addr2sbuf(struct ip_addr *, char *, int);
char *ip_addr2a(struct ip_addr *ip) {
  static char buff[(39 + 1)];
  int len;
  len = ip_addr2sbuf(ip, buff, sizeof(buff) - 1);
  buff[len] = 0;
  return buff;
}


x86 assembly (clang, -O0):
<ip_addr2a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0x2f19(%rip),%rsi
mov    $0x27,%edx
call   1030 <ip_addr2sbuf@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rcx
lea    0x2f01(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2ef6(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip_addr2a>:
push   %rbx
lea    0x2f28(%rip),%rbx
mov    %rbx,%rsi
mov    $0x27,%edx
call   1030 <ip_addr2sbuf@plt>
cltq
movb   $0x0,(%rax,%rbx,1)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ip_addr = type { i32 }
@ip_addr2a.buff = internal global [40 x i8] zeroinitializer
define i8* @ip_addr2a(%struct.ip_addr* %0) {
%2 = alloca %struct.ip_addr*
%3 = alloca i32
store %struct.ip_addr* %0, %struct.ip_addr** %2
%4 = load %struct.ip_addr*, %struct.ip_addr** %2
%5 = call i32 @ip_addr2sbuf(%struct.ip_addr* %4, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @ip_addr2a.buff, i64 0, i64 0), i32 39)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [40 x i8], [40 x i8]* @ip_addr2a.buff, i64 0, i64 %7
store i8 0, i8* %8
ret i8* getelementptr inbounds ([40 x i8], [40 x i8]* @ip_addr2a.buff, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.ip_addr = type { i32 }
@ip_addr2a.buff = internal global [40 x i8] zeroinitializer
define i8* @ip_addr2a(%struct.ip_addr* %0) {
%2 = tail call i32 @ip_addr2sbuf(%struct.ip_addr* %0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @ip_addr2a.buff, i64 0, i64 0), i32 39)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds [40 x i8], [40 x i8]* @ip_addr2a.buff, i64 0, i64 %3
store i8 0, i8* %4
ret i8* getelementptr inbounds ([40 x i8], [40 x i8]* @ip_addr2a.buff, i64 0, i64 0)
}
void set_int2(unsigned char *string, int n) {
  string[0] = (n >> 8) & 255;
  string[1] = n & 255;
}


x86 assembly (clang, -O0):
<set_int2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_int2>:
rol    $0x8,%si
mov    %si,(%rdi)
ret

LLVM IR (-O0):
define void @set_int2(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 8
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %4
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %13, i8* %15
ret void
}

LLVM IR (-O2):
define void @set_int2(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 8
%4 = trunc i32 %3 to i8
store i8 %4, i8* %0
%5 = trunc i32 %1 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init_adc();
int /*<<< orphan*/ init_sensor_ports();
void sensors_init(void) {
  init_sensor_ports();
  init_adc();
}


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

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

LLVM IR (-O0):
define void @sensors_init() {
%1 = call i32 (...) @init_sensor_ports()
%2 = call i32 (...) @init_adc()
ret void
}

LLVM IR (-O2):
define void @sensors_init() {
%1 = tail call i32 (...) @init_sensor_ports()
%2 = tail call i32 (...) @init_adc()
ret void
}
atooi(cp) register char *cp;
{
  register int i, base;
  i = 0;
  base = 8;
  while (*cp >= '0' && *cp <= '7') {
    i *= base;
    i += *cp++ - '0';
  }
  return (i);
}


x86 assembly (clang, -O0):
<atooi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x8,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x11(%rbp)
jl     113b <atooi+0x3b>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x37,%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    114b <atooi+0x4b>
jmp    1175 <atooi+0x75>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <atooi+0x16>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atooi>:
mov    (%rdi),%cl
mov    %ecx,%edx
and    $0xf8,%dl
xor    %eax,%eax
cmp    $0x30,%dl
jne    113a <atooi+0x3a>
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl %cl,%ecx
lea    (%rcx,%rax,8),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
mov    %ecx,%edx
and    $0xf8,%dl
add    $0x1,%rdi
cmp    $0x30,%dl
je     1120 <atooi+0x20>
ret

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

LLVM IR (-O2):
define i32 @atooi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -8
%4 = icmp eq i8 %3, 48
br i1 %4, label %5, label %17
5: ; preds = %1, %5
%6 = phi i8 [ %14, %5 ], [ %2, %1 ]
%7 = phi i8* [ %11, %5 ], [ %0, %1 ]
%8 = phi i32 [ %13, %5 ], [ 0, %1 ]
%9 = zext i8 %6 to i32
%10 = shl nsw i32 %8, 3
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = add i32 %10, -48
%13 = add i32 %12, %9
%14 = load i8, i8* %11
%15 = and i8 %14, -8
%16 = icmp eq i8 %15, 48
br i1 %16, label %5, label %17
17: ; preds = %5, %1
%18 = phi i32 [ 0, %1 ], [ %13, %5 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ nrf_set_config(int);
void __attribute__((unused)) nrf_sleep(void) { nrf_set_config(0x08); }


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

x86 assembly (clang, -O2):
<nrf_sleep>:
mov    $0x8,%edi
jmp    1030 <nrf_set_config@plt>

LLVM IR (-O0):
define void @nrf_sleep() {
%1 = call i32 @nrf_set_config(i32 8)
ret void
}

LLVM IR (-O2):
define void @nrf_sleep() {
%1 = tail call i32 @nrf_set_config(i32 8)
ret void
}
/* Variables and functions */
int M_PI;
float kinematicsStepToRad(int steps) {
  return (float)steps / 64. * (25792. / 405.) * (2. * M_PI);
}


x86 assembly (clang, -O0):
<kinematicsStepToRad>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2ssl -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xef8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xee4(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2eb9(%rip),%rax
cvtsi2sdl (%rax),%xmm2
movsd  0xec5(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<kinematicsStepToRad>:
cvtsi2ss %edi,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xef0(%rip),%xmm0
mulsd  0xef0(%rip),%xmm0
mov    0x2ec9(%rip),%rax
cvtsi2sdl (%rax),%xmm1
addsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
ret

LLVM IR (-O0):
@M_PI = global i32 0
define float @kinematicsStepToRad(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to float
%5 = fpext float %4 to double
%6 = fdiv double %5, 6.400000e+01
%7 = fmul double %6, 0x404FD78BB19EA823
%8 = load i32, i32* @M_PI
%9 = sitofp i32 %8 to double
%10 = fmul double 2.000000e+00, %9
%11 = fmul double %7, %10
%12 = fptrunc double %11 to float
ret float %12
}

LLVM IR (-O2):
@M_PI = global i32 0
define float @kinematicsStepToRad(i32 %0) {
%2 = sitofp i32 %0 to float
%3 = fpext float %2 to double
%4 = fmul double %3, 1.562500e-02
%5 = fmul double %4, 0x404FD78BB19EA823
%6 = load i32, i32* @M_PI
%7 = sitofp i32 %6 to double
%8 = fmul double %7, 2.000000e+00
%9 = fmul double %5, %8
%10 = fptrunc double %9 to float
ret float %10
}
int jac_chain_nm6_n_out(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @jac_chain_nm6_n_out() {
ret i32 2
}

LLVM IR (-O2):
define i32 @jac_chain_nm6_n_out() {
ret i32 2
}