xunge/DecIR huggingface dataset:
int is_end_of_archive(const char *p) {
  int n;
  for (n = 511; n >= 0; --n)
    if (p[n] != '\0')
      return (0);
  return (1);
}


x86 assembly (clang, -O0):
<is_end_of_archive>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x1ff,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     114d <is_end_of_archive+0x4d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     113a <is_end_of_archive+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    1154 <is_end_of_archive+0x54>
jmp    113f <is_end_of_archive+0x3f>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <is_end_of_archive+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_end_of_archive>:
mov    $0x1ff,%ecx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,(%rdi,%rcx,1)
jne    113b <is_end_of_archive+0x3b>
cmpb   $0x0,-0x1(%rdi,%rcx,1)
jne    113b <is_end_of_archive+0x3b>
cmpb   $0x0,-0x2(%rdi,%rcx,1)
jne    113b <is_end_of_archive+0x3b>
lea    -0x3(%rcx),%edx
cmpb   $0x0,(%rdi,%rdx,1)
jne    113b <is_end_of_archive+0x3b>
add    $0xfffffffffffffffc,%rcx
cmp    $0xffffffff,%ecx
jne    1110 <is_end_of_archive+0x10>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_end_of_archive(i8* nocapture %0) {
br label %23
2: ; preds = %23
%3 = add nsw i32 %24, -1
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %29
8: ; preds = %2
%9 = add nsw i32 %24, -2
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %29
14: ; preds = %8
%15 = add nsw i32 %24, -3
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %14
%21 = add nsw i32 %24, -4
%22 = icmp eq i32 %15, 0
br i1 %22, label %29, label %23
23: ; preds = %20, %1
%24 = phi i32 [ 511, %1 ], [ %21, %20 ]
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %0, i64 %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %2, label %29
29: ; preds = %20, %14, %8, %2, %23
%30 = phi i32 [ 0, %23 ], [ 0, %2 ], [ 0, %8 ], [ 0, %14 ], [ 1, %20 ]
ret i32 %30
}
double minimum4(double x1, double x2, double x3, double x4) {
  x1 = ((x1) < (x2) ? (x1) : (x2));
  x3 = ((x3) < (x4) ? (x3) : (x4));
  return ((x1) < (x3) ? (x1) : (x3));
}


x86 assembly (clang, -O0):
<minimum4>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    113b <minimum4+0x3b>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1145 <minimum4+0x45>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1172 <minimum4+0x72>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    117c <minimum4+0x7c>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11a9 <minimum4+0xa9>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    11b3 <minimum4+0xb3>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<minimum4>:
minsd  %xmm1,%xmm0
minsd  %xmm3,%xmm2
minsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @minimum4(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %6
%11 = fcmp olt double %9, %10
br i1 %11, label %12, label %14
12: ; preds = %4
%13 = load double, double* %5
br label %16
14: ; preds = %4
%15 = load double, double* %6
br label %16
16: ; preds = %14, %12
%17 = phi double [ %13, %12 ], [ %15, %14 ]
store double %17, double* %5
%18 = load double, double* %7
%19 = load double, double* %8
%20 = fcmp olt double %18, %19
br i1 %20, label %21, label %23
21: ; preds = %16
%22 = load double, double* %7
br label %25
23: ; preds = %16
%24 = load double, double* %8
br label %25
25: ; preds = %23, %21
%26 = phi double [ %22, %21 ], [ %24, %23 ]
store double %26, double* %7
%27 = load double, double* %5
%28 = load double, double* %7
%29 = fcmp olt double %27, %28
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = load double, double* %5
br label %34
32: ; preds = %25
%33 = load double, double* %7
br label %34
34: ; preds = %32, %30
%35 = phi double [ %31, %30 ], [ %33, %32 ]
ret double %35
}

LLVM IR (-O2):
define double @minimum4(double %0, double %1, double %2, double %3) {
%5 = fcmp olt double %0, %1
%6 = select i1 %5, double %0, double %1
%7 = fcmp olt double %2, %3
%8 = select i1 %7, double %2, double %3
%9 = fcmp olt double %6, %8
%10 = select i1 %9, double %6, double %8
ret double %10
}
/* Variables and functions */
scalar_t__ is_prime(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, const char *argv[]) {
  int n;
  scanf("%d", &n);
  if (is_prime(n)) {
    printf("Y\n");
  } else {
    printf("N\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
call   1040 <is_prime@plt>
cmp    $0x0,%rax
je     1179 <main+0x49>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
jmp    1185 <main+0x55>
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <is_prime@plt>
test   %rax,%rax
lea    0xeae(%rip),%rax
lea    0xea9(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"Y\0A\00"
@.str.2 = [3 x i8] c"N\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%8 = load i32, i32* %6
%9 = call i64 @is_prime(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %15
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [2 x i8] c"N\00"
@str.3 = [2 x i8] c"Y\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %3
%7 = call i64 @is_prime(i32 %6)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0)
%10 = call i32 @puts(i8* dereferenceable(1) %9)
ret i32 0
}
/* Variables and functions */
int setsockopt(int, int, int, void *, int);
int SetSockOpt(int fd, int level, int option, int yesno) {
  return setsockopt(fd, level, option, (void *)&yesno, sizeof yesno);
}


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

x86 assembly (clang, -O2):
<SetSockOpt>:
push   %rax
mov    %ecx,0x4(%rsp)
lea    0x4(%rsp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @SetSockOpt(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = bitcast i32* %8 to i8*
%13 = call i32 @setsockopt(i32 %9, i32 %10, i32 %11, i8* %12, i32 4)
ret i32 %13
}

LLVM IR (-O2):
define i32 @SetSockOpt(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
store i32 %3, i32* %5
%6 = bitcast i32* %5 to i8*
%7 = call i32 @setsockopt(i32 %0, i32 %1, i32 %2, i8* %6, i32 4)
ret i32 %7
}
int add(int m) {
  int n = 7;
  int c1 = m + n;
  c1 = m + n;
  int c2 = m + n;
  return c1;
}


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

x86 assembly (clang, -O2):
<add>:
lea    0x7(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @add(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
store i32 7, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = add nsw i32 %6, %7
store i32 %8, i32* %4
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
store i32 %11, i32* %4
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %12, %13
store i32 %14, i32* %5
%15 = load i32, i32* %4
ret i32 %15
}

LLVM IR (-O2):
define i32 @add(i32 %0) {
%2 = add nsw i32 %0, 7
ret i32 %2
}
/* Type definitions */
struct msghdr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int MSG_DONTWAIT;
int MSG_NOSIGNAL;
int /*<<< orphan*/ recvmsg(int, struct msghdr *, int);
ssize_t recv_process(int fd, struct msghdr *msg, int timeout_ms) {
  return recvmsg(fd, msg, MSG_DONTWAIT | MSG_NOSIGNAL);
}


x86 assembly (clang, -O0):
<recv_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
mov    0x2e9f(%rip),%rax
or     (%rax),%edx
call   1030 <recvmsg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recv_process>:
mov    0x2ec9(%rip),%rax
mov    0x2eba(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
jmp    1030 <recvmsg@plt>

LLVM IR (-O0):
%struct.msghdr = type { i32 }
@MSG_DONTWAIT = global i32 0
@MSG_NOSIGNAL = global i32 0
define i32 @recv_process(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.msghdr*, %struct.msghdr** %5
%9 = load i32, i32* @MSG_DONTWAIT
%10 = load i32, i32* @MSG_NOSIGNAL
%11 = or i32 %9, %10
%12 = call i32 @recvmsg(i32 %7, %struct.msghdr* %8, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
@MSG_DONTWAIT = global i32 0
@MSG_NOSIGNAL = global i32 0
define i32 @recv_process(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = load i32, i32* @MSG_DONTWAIT
%5 = load i32, i32* @MSG_NOSIGNAL
%6 = or i32 %5, %4
%7 = tail call i32 @recvmsg(i32 %0, %struct.msghdr* %1, i32 %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ deeper();
void one_more() { deeper(); }


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

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

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

LLVM IR (-O2):
define void @one_more() {
%1 = tail call i32 (...) @deeper()
ret void
}
/* Variables and functions */
int __fls(unsigned long);
int __flz(unsigned long x) { return __fls(~x); }


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

x86 assembly (clang, -O2):
<__flz>:
not    %rdi
jmp    1030 <__fls@plt>

LLVM IR (-O0):
define i32 @__flz(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = xor i64 %3, -1
%5 = call i32 @__fls(i64 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @__flz(i64 %0) {
%2 = xor i64 %0, -1
%3 = tail call i32 @__fls(i64 %2)
ret i32 %3
}
void *string_copy(void *to_copy) {
  char *s = (char *)calloc(strlen((char *)to_copy) + 1, sizeof(char));
  strcpy(s, (char *)to_copy);
  return s;
}


x86 assembly (clang, -O0):
<string_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_copy>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
mov    $0x1,%esi
call   1050 <calloc@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @string_copy(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add i64 %5, 1
%7 = call i8* @calloc(i64 %6, i64 1)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i8* @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @string_copy(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @calloc(i64 %3, i64 1)
%5 = tail call i8* @strcpy(i8* dereferenceable(1) %4, i8* dereferenceable(1) %0)
ret i8* %4
}
void set_fs(unsigned long val) {}


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

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

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

LLVM IR (-O2):
define void @set_fs(i64 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
void stuck_transfer_check(time_t current_time) { return; }


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

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

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

LLVM IR (-O2):
define void @stuck_transfer_check(i32 %0) {
ret void
}
/* Variables and functions */
scalar_t__ soc_is_ar9341();
scalar_t__ soc_is_ar9342();
scalar_t__ soc_is_ar9344();
int soc_is_ar934x(void) {
  return soc_is_ar9341() || soc_is_ar9342() || soc_is_ar9344();
}


x86 assembly (clang, -O0):
<soc_is_ar934x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <soc_is_ar9341@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jne    117b <soc_is_ar934x+0x4b>
mov    $0x0,%al
call   1040 <soc_is_ar9342@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x1(%rbp)
jne    117b <soc_is_ar934x+0x4b>
mov    $0x0,%al
call   1050 <soc_is_ar9344@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<soc_is_ar934x>:
push   %rbx
xor    %eax,%eax
call   1030 <soc_is_ar9341@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    115d <soc_is_ar934x+0x2d>
xor    %eax,%eax
call   1040 <soc_is_ar9342@plt>
test   %rax,%rax
jne    115d <soc_is_ar934x+0x2d>
xor    %eax,%eax
call   1050 <soc_is_ar9344@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @soc_is_ar934x() {
%1 = call i64 (...) @soc_is_ar9341()
%2 = icmp ne i64 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = call i64 (...) @soc_is_ar9342()
%5 = icmp ne i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = call i64 (...) @soc_is_ar9344()
%8 = icmp ne i64 %7, 0
br label %9
9: ; preds = %6, %3, %0
%10 = phi i1 [ true, %3 ], [ true, %0 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @soc_is_ar934x() {
%1 = tail call i64 (...) @soc_is_ar9341()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = tail call i64 (...) @soc_is_ar9342()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 (...) @soc_is_ar9344()
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3, %0
%11 = phi i32 [ 1, %3 ], [ 1, %0 ], [ %9, %6 ]
ret i32 %11
}
int fun741() { return 741; }


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

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

LLVM IR (-O0):
define i32 @fun741() {
ret i32 741
}

LLVM IR (-O2):
define i32 @fun741() {
ret i32 741
}
/* Type definitions */
struct sd {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ w9968cf_write_sb(struct sd *, int);
void w9968cf_smbus_start(struct sd *sd) {
  w9968cf_write_sb(sd, 0x0011);
  w9968cf_write_sb(sd, 0x0010);
}


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

x86 assembly (clang, -O2):
<w9968cf_smbus_start>:
push   %rbx
mov    %rdi,%rbx
mov    $0x11,%esi
call   1030 <w9968cf_write_sb@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
pop    %rbx
jmp    1030 <w9968cf_write_sb@plt>

LLVM IR (-O0):
%struct.sd = type { i32 }
define void @w9968cf_smbus_start(%struct.sd* %0) {
%2 = alloca %struct.sd*
store %struct.sd* %0, %struct.sd** %2
%3 = load %struct.sd*, %struct.sd** %2
%4 = call i32 @w9968cf_write_sb(%struct.sd* %3, i32 17)
%5 = load %struct.sd*, %struct.sd** %2
%6 = call i32 @w9968cf_write_sb(%struct.sd* %5, i32 16)
ret void
}

LLVM IR (-O2):
%struct.sd = type { i32 }
define void @w9968cf_smbus_start(%struct.sd* %0) {
%2 = tail call i32 @w9968cf_write_sb(%struct.sd* %0, i32 17)
%3 = tail call i32 @w9968cf_write_sb(%struct.sd* %0, i32 16)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int do_exit(int error_number) {
  exit(error_number);
  return error_number;
}


x86 assembly (clang, -O0):
<do_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<do_exit>:
push   %rax
call   1030 <exit@plt>

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

LLVM IR (-O2):
define i32 @do_exit(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ putchar(int);
void lf_putchar(uint32_t ch) { putchar((int)ch); }


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

x86 assembly (clang, -O2):
<lf_putchar>:
jmp    1030 <putchar@plt>

LLVM IR (-O0):
define void @lf_putchar(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = call i32 @putchar(i32 %4)
ret void
}

LLVM IR (-O2):
define void @lf_putchar(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @putchar(i32 %2)
ret void
}
IR0A1(r0, r1, x0, x1, p0, p1) int r0, r1;
int *p0, *p1;
{ (*p0) = (*((int *)11111111)); }


x86 assembly (clang, -O0):
<IR0A1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    $0xa98ac7,%eax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IR0A1>:
mov    0xa98ac7,%eax
mov    %eax,(%r8)
ret

LLVM IR (-O0):
define i32 @IR0A1(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32* %4, i32** %12
store i32* %5, i32** %13
%14 = load i32, i32* inttoptr (i64 11111111 to i32*)
%15 = load i32*, i32** %12
store i32 %14, i32* %15
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
define i32 @IR0A1(i32 %0, i32 %1, i32 %2, i32 %3, i32* nocapture writeonly %4, i32* nocapture readnone %5) {
%7 = load i32, i32* inttoptr (i64 11111111 to i32*)
store i32 %7, i32* %4
ret i32 undef
}
int test_imm_D9int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0xD9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_D9int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 932007903232
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int is_path_delim(char const c) { return c == '/'; }


x86 assembly (clang, -O0):
<is_path_delim>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x2f,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @is_path_delim(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 47
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_path_delim(i8 signext %0) {
%2 = icmp eq i8 %0, 47
%3 = zext i1 %2 to i32
ret i32 %3
}
int decrypt_value(const int value[5]) {
  int i;
  int ret = 0;
  for (i = 0; i < 5; i++)
    ret |= value[i] << i;
  return ret;
}


x86 assembly (clang, -O0):
<decrypt_value>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1144 <decrypt_value+0x44>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <decrypt_value+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrypt_value>:
mov    0x4(%rdi),%ecx
mov    0x8(%rdi),%eax
add    %ecx,%ecx
or     (%rdi),%ecx
shl    $0x2,%eax
mov    0xc(%rdi),%edx
shl    $0x3,%edx
or     %eax,%edx
mov    0x10(%rdi),%eax
shl    $0x4,%eax
or     %edx,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @decrypt_value(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = shl i32 %4, 1
%6 = or i32 %5, %2
%7 = getelementptr inbounds i32, i32* %0, i64 2
%8 = load i32, i32* %7
%9 = shl i32 %8, 2
%10 = or i32 %9, %6
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = shl i32 %12, 3
%14 = or i32 %13, %10
%15 = getelementptr inbounds i32, i32* %0, i64 4
%16 = load i32, i32* %15
%17 = shl i32 %16, 4
%18 = or i32 %17, %14
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ _enable_interrupts();
void tube_IntOn(unsigned int *reg) { _enable_interrupts(); }


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

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

LLVM IR (-O0):
define void @tube_IntOn(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 (...) @_enable_interrupts()
ret void
}

LLVM IR (-O2):
define void @tube_IntOn(i32* nocapture readnone %0) {
%2 = tail call i32 (...) @_enable_interrupts()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
int /*<<< orphan*/ puts(char *);
void print_rnd_key(unsigned long key[]) {
  int idx;
  for (idx = 0; idx < 4; idx++)
    printf("%08x", key[idx]);
  puts("");
}


x86 assembly (clang, -O0):
<print_rnd_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    1163 <print_rnd_key+0x43>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <print_rnd_key+0x13>
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_rnd_key>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rsi
lea    0xecf(%rip),%r14
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    0x18(%rbx),%rsi
mov    %r14,%rdi
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%08x\00"
@.str.1 = [1 x i8] zeroinitializer
define void @print_rnd_key(i64* %0) {
%2 = alloca i64*
%3 = alloca i32
store i64* %0, i64** %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = load i64*, i64** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i64, i64* %8, i64 %10
%12 = load i64, i64* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %12)
br label %14
14: ; preds = %7
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %4
17: ; preds = %4
%18 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%08x\00"
define void @print_rnd_key(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = getelementptr inbounds i64, i64* %0, i64 1
%5 = load i64, i64* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %5)
%7 = getelementptr inbounds i64, i64* %0, i64 2
%8 = load i64, i64* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %8)
%10 = getelementptr inbounds i64, i64* %0, i64 3
%11 = load i64, i64* %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ android_compiler_barrier();
extern int32_t android_atomic_acquire_load(volatile int32_t *ptr) {
  int32_t value = *ptr;
  android_compiler_barrier();
  return value;
}


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

x86 assembly (clang, -O2):
<android_atomic_acquire_load>:
push   %rbx
mov    (%rdi),%ebx
xor    %eax,%eax
call   1030 <android_compiler_barrier@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @android_atomic_acquire_load(i32* %0) {
%2 = load volatile i32, i32* %0
%3 = tail call i32 (...) @android_compiler_barrier()
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ greet(char *);
int main() {
  greet("world");
  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 <greet@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"world\00"
define i32 @main() {
%1 = tail call i32 @greet(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned long fib(unsigned long x) {
  if (x > 2)
    return (fib(x - 1) + fib(x - 2));
  else
    return (1);
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x2,-0x10(%rbp)
jbe    1158 <fib+0x48>
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <fib@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x2,%rdi
call   1030 <fib@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <fib+0x50>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
cmp    $0x3,%rdi
jb     114a <fib+0x3a>
mov    %rdi,%rbx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
lea    -0x1(%rbx),%rdi
call   1030 <fib@plt>
add    $0xfffffffffffffffe,%rbx
add    %rax,%r14
cmp    $0x2,%rbx
ja     1130 <fib+0x20>
add    $0x1,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fib(i64 %0) {
%2 = icmp ugt i64 %0, 2
br i1 %2, label %3, label %13
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i64 [ %9, %3 ], [ 0, %1 ]
%6 = add i64 %4, -1
%7 = tail call i64 @fib(i64 %6)
%8 = add i64 %4, -2
%9 = add i64 %7, %5
%10 = icmp ugt i64 %8, 2
br i1 %10, label %3, label %11
11: ; preds = %3
%12 = add i64 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i64 [ 1, %1 ], [ %12, %11 ]
ret i64 %14
}
unsigned long getExceptionHandler(int tt) {
  unsigned long *tb = (unsigned long *)0x00000040;
  return ((tb[tt] & ~0xff000000) << 2) + (unsigned long)(&tb[tt]);
}


x86 assembly (clang, -O0):
<getExceptionHandler>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x40,%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
and    $0xffffff,%rax
shl    $0x2,%rax
mov    -0x10(%rbp),%rcx
movslq -0x4(%rbp),%rdx
shl    $0x3,%rdx
add    %rdx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getExceptionHandler>:
movslq %edi,%rax
mov    0x40(,%rax,8),%ecx
shl    $0x3,%rax
and    $0xffffff,%ecx
lea    (%rax,%rcx,4),%rax
add    $0x40,%rax
ret

LLVM IR (-O0):
define i64 @getExceptionHandler(i32 %0) {
%2 = alloca i32
%3 = alloca i64*
store i32 %0, i32* %2
store i64* inttoptr (i64 64 to i64*), i64** %3
%4 = load i64*, i64** %3
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i64, i64* %4, i64 %6
%8 = load i64, i64* %7
%9 = and i64 %8, 16777215
%10 = shl i64 %9, 2
%11 = load i64*, i64** %3
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i64, i64* %11, i64 %13
%15 = ptrtoint i64* %14 to i64
%16 = add i64 %10, %15
ret i64 %16
}

LLVM IR (-O2):
define i64 @getExceptionHandler(i32 %0) {
%2 = sext i32 %0 to i64
%3 = getelementptr inbounds i64, i64* inttoptr (i64 64 to i64*), i64 %2
%4 = load i64, i64* %3
%5 = shl i64 %4, 2
%6 = and i64 %5, 67108860
%7 = ptrtoint i64* %3 to i64
%8 = add i64 %6, %7
ret i64 %8
}
/* Variables and functions */
char **bp_sw_breakstring_protect(char *, char *, char *);
char **bp_sw_breakstring(char *string, char *parsestr) {
  return bp_sw_breakstring_protect(string, parsestr, "\"");
}


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

x86 assembly (clang, -O2):
<bp_sw_breakstring>:
lea    0xee9(%rip),%rdx
jmp    1030 <bp_sw_breakstring_protect@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\22\00"
define i8** @bp_sw_breakstring(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8** @bp_sw_breakstring_protect(i8* %5, i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8** %7
}

LLVM IR (-O2):
@.str = [2 x i8] c"\22\00"
define i8** @bp_sw_breakstring(i8* %0, i8* %1) {
%3 = tail call i8** @bp_sw_breakstring_protect(i8* %0, i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8** %3
}
OP(ed, e0) { illegal_2(); }


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

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

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

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Variables and functions */
int c2();
int d() { return c2() + 2; }


x86 assembly (clang, -O0):
<d>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <c2@plt>
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d>:
push   %rax
xor    %eax,%eax
call   1030 <c2@plt>
add    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @d() {
%1 = call i32 (...) @c2()
%2 = add nsw i32 %1, 2
ret i32 %2
}

LLVM IR (-O2):
define i32 @d() {
%1 = tail call i32 (...) @c2()
%2 = add nsw i32 %1, 2
ret i32 %2
}
void prefetch(const void *addr) {
  __asm__ __volatile__("prefetcht0 %[addr]"
                       : [addr] "+m"(*(volatile char *)addr));
}


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

x86 assembly (clang, -O2):
<prefetch>:
prefetcht0 (%rdi)
ret

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

LLVM IR (-O2):
define void @prefetch(i8* %0) {
tail call void asm sideeffect "prefetcht0 $0", "=*m,*m,~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %0, i8* elementtype(i8) %0)
ret void
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("EOF is %d\n\n", EOF);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"EOF is %d\0A\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = load i32, i32* @EOF
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float *);
int main() {
  float a = 0.001;
  float b = 0.003;
  float c, *pa, *pb;
  pa = &a;
  *pa = 2 * a;
  pb = &b;
  c = 3 * (*pb + *pa);
  printf("%p \n", &(*pa));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xee5(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xed4(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movss  0xebb(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x18(%rbp),%rax
addss  (%rax),%xmm1
movss  0xe8a(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x3b03126f,0x4(%rsp)
3b
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%p \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float*
%6 = alloca float*
store i32 0, i32* %1
store float 0x3F50624DE0000000, float* %2
store float 0x3F689374C0000000, float* %3
store float* %2, float** %5
%7 = load float, float* %2
%8 = fmul float 2.000000e+00, %7
%9 = load float*, float** %5
store float %8, float* %9
store float* %3, float** %6
%10 = load float*, float** %6
%11 = load float, float* %10
%12 = load float*, float** %5
%13 = load float, float* %12
%14 = fadd float %11, %13
%15 = fmul float 3.000000e+00, %14
store float %15, float* %4
%16 = load float*, float** %5
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%p \0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
store float 0x3F60624DE0000000, float* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float* %1)
ret i32 0
}
char convertValue(int c) {
  return (c >= 0 && c <= 9) ? (c + '0') : ((c - 10) + 'A');
}


x86 assembly (clang, -O0):
<convertValue>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1129 <convertValue+0x29>
cmpl   $0x9,-0x4(%rbp)
jg     1129 <convertValue+0x29>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    1135 <convertValue+0x35>
mov    -0x4(%rbp),%eax
sub    $0xa,%eax
add    $0x41,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertValue>:
lea    0x37(%rdi),%ecx
lea    0x30(%rdi),%eax
cmp    $0xa,%edi
cmovae %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @convertValue(i32 %0) {
%2 = icmp ult i32 %0, 10
%3 = select i1 %2, i32 48, i32 55
%4 = add nsw i32 %3, %0
%5 = trunc i32 %4 to i8
ret i8 %5
}
char *remove_column(char ***g, int slice, int index, int pos) {
  return g[index][slice] + pos;
}


x86 assembly (clang, -O0):
<remove_column>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_column>:
movslq %edx,%rax
mov    (%rdi,%rax,8),%rdx
movslq %esi,%rsi
movslq %ecx,%rax
add    (%rdx,%rsi,8),%rax
ret

LLVM IR (-O0):
define i8* @remove_column(i8*** %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8***
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8*** %0, i8**** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8***, i8**** %5
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8**, i8*** %9, i64 %11
%13 = load i8**, i8*** %12
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
ret i8* %20
}

LLVM IR (-O2):
define i8* @remove_column(i8*** nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8**, i8*** %0, i64 %5
%7 = load i8**, i8*** %6
%8 = sext i32 %1 to i64
%9 = getelementptr inbounds i8*, i8** %7, i64 %8
%10 = load i8*, i8** %9
%11 = sext i32 %3 to i64
%12 = getelementptr inbounds i8, i8* %10, i64 %11
ret i8* %12
}
/* Variables and functions */
int yas_kxtf9_write_reg(unsigned char, unsigned char *, int);
int yas_kxtf9_write_reg_byte(unsigned char adr, unsigned char val) {
  return yas_kxtf9_write_reg(adr, &val, 1);
}


x86 assembly (clang, -O0):
<yas_kxtf9_write_reg_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
lea    -0x2(%rbp),%rsi
mov    $0x1,%edx
movzbl -0x1(%rbp),%edi
call   1030 <yas_kxtf9_write_reg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yas_kxtf9_write_reg_byte>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <yas_kxtf9_write_reg@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @yas_kxtf9_write_reg_byte(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = call i32 @yas_kxtf9_write_reg(i8 zeroext %5, i8* %4, i32 1)
ret i32 %6
}

LLVM IR (-O2):
define i32 @yas_kxtf9_write_reg_byte(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @yas_kxtf9_write_reg(i8 zeroext %0, i8* %3, i32 1)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ GLsizei;

/* Variables and functions */
int /*<<< orphan*/ glViewport(int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
void reshape(int w, int h) { glViewport(0, 0, (GLsizei)w, (GLsizei)h); }


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

x86 assembly (clang, -O2):
<reshape>:
mov    %esi,%ecx
mov    %edi,%edx
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <glViewport@plt>

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

LLVM IR (-O2):
define void @reshape(i32 %0, i32 %1) {
%3 = tail call i32 @glViewport(i32 0, i32 0, i32 %0, i32 %1)
ret void
}
int in_range(int input, int wanted, int fudge) {
  if (wanted + fudge >= input && wanted - fudge <= input)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<in_range>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1137 <in_range+0x37>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1137 <in_range+0x37>
movl   $0x1,-0x4(%rbp)
jmp    113e <in_range+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<in_range>:
lea    (%rdx,%rsi,1),%eax
cmp    %edi,%eax
setge  %al
sub    %edx,%esi
cmp    %edi,%esi
setle  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @in_range(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, %1
%5 = icmp sge i32 %4, %0
%6 = sub nsw i32 %1, %2
%7 = icmp sle i32 %6, %0
%8 = select i1 %5, i1 %7, i1 false
%9 = zext i1 %8 to i32
ret i32 %9
}