xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ malloc(int);
int main() {
  int *x;
  int y;
  x = (int *)malloc(4);
  *x = 7654;
  y = ++*x;
  return y;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1de6,(%rax)
mov    -0x10(%rbp),%rcx
mov    (%rcx),%eax
add    $0x1,%eax
mov    %eax,(%rcx)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
movl   $0x1de7,(%rax)
mov    $0x1de7,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @malloc(i32 4)
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
store i32 7654, i32* %6
%7 = load i32*, i32** %2
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %7
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
store i32 7655, i32* %2
ret i32 7655
}
int test_arr_search(int key, int a[], int len) {
  int ret = -1;
  int i;
  for (int i = 0; i < len; i++) {
    if (a[i] == key) {
      ret = i;
      break;
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<test_arr_search>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115a <test_arr_search+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x4(%rbp),%eax
jne    1147 <test_arr_search+0x47>
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    115a <test_arr_search+0x5a>
jmp    114c <test_arr_search+0x4c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111c <test_arr_search+0x1c>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_arr_search>:
mov    $0xffffffff,%eax
test   %edx,%edx
jle    111e <test_arr_search+0x1e>
mov    %edx,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmp    %edi,(%rsi,%rcx,4)
je     111f <test_arr_search+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <test_arr_search+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_arr_search(i32 %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %1, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %0
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
void ble_rsp_test_channel_mode(const void *nul) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define i32 @XFreeCursor() {
ret i32 undef
}
/* Variables and functions */
int unmap_log(char const *, int /*<<< orphan*/, int /*<<< orphan*/);
int unmap_log_all(const char *fpath) { return unmap_log(fpath, 0, 0); }


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

x86 assembly (clang, -O2):
<unmap_log_all>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <unmap_log@plt>

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

LLVM IR (-O2):
define i32 @unmap_log_all(i8* %0) {
%2 = tail call i32 @unmap_log(i8* %0, i32 0, i32 0)
ret i32 %2
}
int main() {
  int i;
  int j;
  int k;
  i = 0;
  j = 100;
  k = 1;
  while (i < j) {
    k = k + 1;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x64,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113a <main+0x3a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <main+0x20>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 100, i32* %3
store i32 1, i32* %4
br label %5
5: ; preds = %9, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 1
store i32 %11, i32* %4
br label %5
12: ; preds = %5
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
int nodot(char *fileName) {
  if (fileName[0] == '.')
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<nodot>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    1124 <nodot+0x24>
movl   $0x0,-0x4(%rbp)
jmp    112b <nodot+0x2b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nodot>:
xor    %eax,%eax
cmpb   $0x2e,(%rdi)
setne  %al
ret

LLVM IR (-O0):
define i32 @nodot(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 46
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %11
10: ; preds = %1
store i32 1, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @nodot(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp ne i8 %2, 46
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int strncmp(char *, char *, int);
int verifySuperIndex(void *buf) {
  int ret = strncmp((char *)buf, "SUPERINDEX                      ", 32);
  if (ret == 0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<verifySuperIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x20,%edx
call   1030 <strncmp@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    114a <verifySuperIndex+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1151 <verifySuperIndex+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verifySuperIndex>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x20,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [33 x i8] c"SUPERINDEX \00"
define i32 @verifySuperIndex(i8* %0) {
%2 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 32)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello 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 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sysapi_get_int(char *, int *, int *);
int sysapi_atoi(char *data) {
  int val;
  int err;
  sysapi_get_int(data, &err, &val);
  if (err != -1)
    return val;
  return 0;
}


x86 assembly (clang, -O0):
<sysapi_atoi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sysapi_get_int@plt>
cmpl   $0xffffffff,-0x18(%rbp)
je     1142 <sysapi_atoi+0x32>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1149 <sysapi_atoi+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysapi_atoi>:
push   %rax
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1030 <sysapi_get_int@plt>
xor    %eax,%eax
cmpl   $0xffffffff,(%rsp)
je     112a <sysapi_atoi+0x1a>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @sysapi_atoi(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @sysapi_get_int(i8* %6, i32* %5, i32* %4)
%8 = load i32, i32* %5
%9 = icmp ne i32 %8, -1
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = load i32, i32* %4
store i32 %11, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %10
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @sysapi_atoi(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @sysapi_get_int(i8* %0, i32* %3, i32* %2)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, -1
%9 = load i32, i32* %2
%10 = select i1 %8, i32 0, i32 %9
ret i32 %10
}
double ls_cost_nm6_sign(double x) { return x < 0 ? -1 : x > 0 ? 1 : x; }


x86 assembly (clang, -O0):
<ls_cost_nm6_sign>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <ls_cost_nm6_sign+0x29>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1161 <ls_cost_nm6_sign+0x61>
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114d <ls_cost_nm6_sign+0x4d>
movsd  0xebd(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <ls_cost_nm6_sign+0x57>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls_cost_nm6_sign>:
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
movsd  0xeeb(%rip),%xmm3
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm1
andnpd %xmm2,%xmm1
movsd  0xed2(%rip),%xmm2
andpd  %xmm2,%xmm0
orpd   %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @ls_cost_nm6_sign(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fcmp ogt double %0, 0.000000e+00
%4 = select i1 %3, double 1.000000e+00, double %0
%5 = select i1 %2, double -1.000000e+00, double %4
ret double %5
}
/* Variables and functions */
int f446(int *);
int f447(int *p) { return f446(p); }


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

x86 assembly (clang, -O2):
<f447>:
jmp    1030 <f446@plt>

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

LLVM IR (-O2):
define i32 @f447(i32* %0) {
%2 = tail call i32 @f446(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;
typedef int /*<<< orphan*/ siginfo_t;

/* Variables and functions */
int sigtimedwait(int /*<<< orphan*/ const *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *);
int sigwaitinfo(const sigset_t *restrict set, siginfo_t *restrict info) {
  return sigtimedwait(set, info, NULL);
}


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

x86 assembly (clang, -O2):
<sigwaitinfo>:
xor    %edx,%edx
jmp    1030 <sigtimedwait@plt>

LLVM IR (-O0):
define i32 @sigwaitinfo(i32* noalias %0, i32* noalias %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 @sigtimedwait(i32* %5, i32* %6, i32* null)
ret i32 %7
}

LLVM IR (-O2):
define i32 @sigwaitinfo(i32* noalias %0, i32* noalias %1) {
%3 = tail call i32 @sigtimedwait(i32* %0, i32* %1, i32* null)
ret i32 %3
}
int test_imm_11int32_mem(int *val) {
  return ((*val) & (0x11 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_11int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 17
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
extern double sparcfltest(int x1, int x2, int x3, int x4, int x5, double x6,
                          int x7, double x8) {
  return (x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8);
}


x86 assembly (clang, -O0):
<sparcfltest>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
movsd  %xmm1,-0x30(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cvtsi2sd %eax,%xmm0
addsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
addsd  %xmm1,%xmm0
addsd  -0x30(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sparcfltest>:
add    %esi,%edi
add    %edx,%edi
add    %ecx,%edi
add    %r8d,%edi
cvtsi2sd %edi,%xmm2
addsd  %xmm2,%xmm0
xorps  %xmm2,%xmm2
cvtsi2sd %r9d,%xmm2
addsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sparcfltest(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5, i32 %6, double %7) {
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca i32
%16 = alloca double
store i32 %0, i32* %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i32 %4, i32* %13
store double %5, double* %14
store i32 %6, i32* %15
store double %7, double* %16
%17 = load i32, i32* %9
%18 = load i32, i32* %10
%19 = add nsw i32 %17, %18
%20 = load i32, i32* %11
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %12
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %13
%25 = add nsw i32 %23, %24
%26 = sitofp i32 %25 to double
%27 = load double, double* %14
%28 = fadd double %26, %27
%29 = load i32, i32* %15
%30 = sitofp i32 %29 to double
%31 = fadd double %28, %30
%32 = load double, double* %16
%33 = fadd double %31, %32
ret double %33
}

LLVM IR (-O2):
define double @sparcfltest(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, double %5, i32 %6, double %7) {
%9 = add nsw i32 %1, %0
%10 = add nsw i32 %9, %2
%11 = add nsw i32 %10, %3
%12 = add nsw i32 %11, %4
%13 = sitofp i32 %12 to double
%14 = fadd double %13, %5
%15 = sitofp i32 %6 to double
%16 = fadd double %14, %15
%17 = fadd double %16, %7
ret double %17
}
void test1_ptr_arith_ok(int x) {
  int buf[100];
  int *p = buf;
  p = p + 99;
  p[0] = 1;
}


x86 assembly (clang, -O0):
<test1_ptr_arith_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x1a0(%rbp),%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rax
add    $0x18c,%rax
mov    %rax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rax
movl   $0x1,(%rax)
add    $0x130,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @test1_ptr_arith_ok(i32 %0) {
ret void
}
int isreserved(char x) { return (x == '[' || x == ']') ? 1 : 0; }


x86 assembly (clang, -O0):
<isreserved>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x5b,%ecx
mov    %al,-0x2(%rbp)
je     1129 <isreserved+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x5d,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isreserved>:
add    $0xa5,%dil
xor    %eax,%eax
test   $0xfd,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isreserved(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, 91
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 93
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
ret i32 %13
}

LLVM IR (-O2):
define i32 @isreserved(i8 signext %0) {
%2 = icmp eq i8 %0, 91
%3 = icmp eq i8 %0, 93
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *createTree(int);
int /*<<< orphan*/ display(struct node *);
int /*<<< orphan*/ insert(struct node *, int);
void main() {
  struct node *head = createTree(20);
  insert(head, 10);
  insert(head, 5);
  insert(head, 30);
  insert(head, 15);
  display(head);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x14,%edi
call   1030 <createTree@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1050 <insert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x5,%esi
call   1050 <insert@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1e,%esi
call   1050 <insert@plt>
mov    -0x8(%rbp),%rdi
mov    $0xf,%esi
call   1050 <insert@plt>
mov    -0x8(%rbp),%rdi
call   1040 <display@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x14,%edi
call   1030 <createTree@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0xa,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0x1e,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
mov    $0xf,%esi
call   1050 <insert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <display@plt>

LLVM IR (-O0):
%struct.node = type { i32 }
define void @main() {
%1 = alloca %struct.node*
%2 = call %struct.node* @createTree(i32 20)
store %struct.node* %2, %struct.node** %1
%3 = load %struct.node*, %struct.node** %1
%4 = call i32 @insert(%struct.node* %3, i32 10)
%5 = load %struct.node*, %struct.node** %1
%6 = call i32 @insert(%struct.node* %5, i32 5)
%7 = load %struct.node*, %struct.node** %1
%8 = call i32 @insert(%struct.node* %7, i32 30)
%9 = load %struct.node*, %struct.node** %1
%10 = call i32 @insert(%struct.node* %9, i32 15)
%11 = load %struct.node*, %struct.node** %1
%12 = call i32 @display(%struct.node* %11)
ret void
}

LLVM IR (-O2):
%struct.node = type { i32 }
define void @main() {
%1 = tail call %struct.node* @createTree(i32 20)
%2 = tail call i32 @insert(%struct.node* %1, i32 10)
%3 = tail call i32 @insert(%struct.node* %1, i32 5)
%4 = tail call i32 @insert(%struct.node* %1, i32 30)
%5 = tail call i32 @insert(%struct.node* %1, i32 15)
%6 = tail call i32 @display(%struct.node* %1)
ret void
}
/* Variables and functions */
scalar_t__ strlen(char *);
__attribute__((always_, used)) bool __TalesEmptyS(char *s) {
  return strlen(s) == 0;
}


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

x86 assembly (clang, -O2):
<__TalesEmptyS>:
xor    %eax,%eax
cmpb   $0x0,(%rdi)
sete   %al
ret

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i8*)* @__TalesEmptyS to i8*)], section "llvm.metadata"
define i32 @__TalesEmptyS(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = icmp eq i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (i32 (i8*)* @__TalesEmptyS to i8*)], section "llvm.metadata"
define i32 @__TalesEmptyS(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int ULONG_MAX;
int is_on_1st_quarter(unsigned long i) { return i <= ULONG_MAX / 4; }


x86 assembly (clang, -O0):
<is_on_1st_quarter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
setbe  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_on_1st_quarter>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%eax
lea    0x3(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x2,%ecx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    %rdi,%rcx
setae  %al
ret

LLVM IR (-O0):
@ULONG_MAX = global i32 0
define i32 @is_on_1st_quarter(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i32, i32* @ULONG_MAX
%5 = sdiv i32 %4, 4
%6 = sext i32 %5 to i64
%7 = icmp ule i64 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
@ULONG_MAX = global i32 0
define i32 @is_on_1st_quarter(i64 %0) {
%2 = load i32, i32* @ULONG_MAX
%3 = sdiv i32 %2, 4
%4 = sext i32 %3 to i64
%5 = icmp uge i64 %4, %0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
struct netdev {
  int dummy;
};

/* Variables and functions */
short IFF_RUNNING;
int netdev_getflags(struct netdev *, short *);
int netdev_running(struct netdev *dev) {
  short flags;
  int ret = netdev_getflags(dev, &flags);
  return ret ? 0 : !!(flags & IFF_RUNNING);
}


x86 assembly (clang, -O0):
<netdev_running>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xa(%rbp),%rsi
call   1030 <netdev_getflags@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     1140 <netdev_running+0x30>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <netdev_running+0x52>
movswl -0xa(%rbp),%eax
mov    0x2e9d(%rip),%rcx
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<netdev_running>:
push   %rax
lea    0x6(%rsp),%rsi
call   1030 <netdev_getflags@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
je     1125 <netdev_running+0x15>
pop    %rcx
ret
mov    0x2ebc(%rip),%rax
movzwl (%rax),%ecx
xor    %eax,%eax
test   %cx,0x6(%rsp)
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.netdev = type { i32 }
@IFF_RUNNING = global i16 0
define i32 @netdev_running(%struct.netdev* %0) {
%2 = alloca %struct.netdev*
%3 = alloca i16
%4 = alloca i32
store %struct.netdev* %0, %struct.netdev** %2
%5 = load %struct.netdev*, %struct.netdev** %2
%6 = call i32 @netdev_getflags(%struct.netdev* %5, i16* %3)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
br label %20
10: ; preds = %1
%11 = load i16, i16* %3
%12 = sext i16 %11 to i32
%13 = load i16, i16* @IFF_RUNNING
%14 = sext i16 %13 to i32
%15 = and i32 %12, %14
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
%18 = xor i1 %17, true
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %10, %9
%21 = phi i32 [ 0, %9 ], [ %19, %10 ]
ret i32 %21
}

LLVM IR (-O2):
%struct.netdev = type { i32 }
@IFF_RUNNING = global i16 0
define i32 @netdev_running(%struct.netdev* %0) {
%2 = alloca i16
%3 = bitcast i16* %2 to i8*
%4 = call i32 @netdev_getflags(%struct.netdev* %0, i16* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i16, i16* %2
%8 = load i16, i16* @IFF_RUNNING
%9 = and i16 %8, %7
%10 = icmp ne i16 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %1, %6
%13 = phi i32 [ %11, %6 ], [ 0, %1 ]
ret i32 %13
}
/* Type definitions */
struct task_struct {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ irqtime_account_irq(struct task_struct *);
int /*<<< orphan*/ vtime_account_irq_exit(struct task_struct *);
void account_irq_exit_time(struct task_struct *tsk) {
  vtime_account_irq_exit(tsk);
  irqtime_account_irq(tsk);
}


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

x86 assembly (clang, -O2):
<account_irq_exit_time>:
push   %rbx
mov    %rdi,%rbx
call   1040 <vtime_account_irq_exit@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <irqtime_account_irq@plt>

LLVM IR (-O0):
%struct.task_struct = type { i32 }
define void @account_irq_exit_time(%struct.task_struct* %0) {
%2 = alloca %struct.task_struct*
store %struct.task_struct* %0, %struct.task_struct** %2
%3 = load %struct.task_struct*, %struct.task_struct** %2
%4 = call i32 @vtime_account_irq_exit(%struct.task_struct* %3)
%5 = load %struct.task_struct*, %struct.task_struct** %2
%6 = call i32 @irqtime_account_irq(%struct.task_struct* %5)
ret void
}

LLVM IR (-O2):
%struct.task_struct = type { i32 }
define void @account_irq_exit_time(%struct.task_struct* %0) {
%2 = tail call i32 @vtime_account_irq_exit(%struct.task_struct* %0)
%3 = tail call i32 @irqtime_account_irq(%struct.task_struct* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ print_mprf_banksel_gen(int /*<<< orphan*/ *, unsigned int,
                                          unsigned int);
int /*<<< orphan*/ print_mprf_bram_gen(int /*<<< orphan*/ *, unsigned int,
                                       unsigned int);
int /*<<< orphan*/ print_mprf_outmuxes_gen(int /*<<< orphan*/ *, unsigned int,
                                           unsigned int);
void print_mprf_architecture_body(FILE *infile, unsigned int num_ni,
                                  unsigned int num_no) {
  print_mprf_bram_gen(infile, num_ni, num_no);
  print_mprf_banksel_gen(infile, num_ni, num_no);
  print_mprf_outmuxes_gen(infile, num_ni, num_no);
}


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

x86 assembly (clang, -O2):
<print_mprf_architecture_body>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1050 <print_mprf_bram_gen@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <print_mprf_banksel_gen@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <print_mprf_outmuxes_gen@plt>

LLVM IR (-O0):
define void @print_mprf_architecture_body(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @print_mprf_bram_gen(i32* %7, i32 %8, i32 %9)
%11 = load i32*, i32** %4
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @print_mprf_banksel_gen(i32* %11, i32 %12, i32 %13)
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call i32 @print_mprf_outmuxes_gen(i32* %15, i32 %16, i32 %17)
ret void
}

LLVM IR (-O2):
define void @print_mprf_architecture_body(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @print_mprf_bram_gen(i32* %0, i32 %1, i32 %2)
%5 = tail call i32 @print_mprf_banksel_gen(i32* %0, i32 %1, i32 %2)
%6 = tail call i32 @print_mprf_outmuxes_gen(i32* %0, i32 %1, i32 %2)
ret void
}
/* Variables and functions */
int errno;
__attribute__((no)) double with_errno(double y, int e) {
  errno = e;
  return y;
}


x86 assembly (clang, -O0):
<with_errno>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    0x2eca(%rip),%rax
mov    %ecx,(%rax)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<with_errno>:
mov    0x2ed9(%rip),%rax
mov    %edi,(%rax)
ret

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

LLVM IR (-O2):
@errno = global i32 0
define double @with_errno(double returned %0, i32 %1) {
store i32 %1, i32* @errno
ret double %0
}
/* Variables and functions */
int /*<<< orphan*/ foo();
void xxx(void) {
  int x = 45;
  while (x >>= 1)
    foo();
}


x86 assembly (clang, -O0):
<xxx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2d,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     113d <xxx+0x2d>
mov    $0x0,%al
call   1030 <foo@plt>
jmp    111f <xxx+0xf>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @xxx() {
%1 = alloca i32
store i32 45, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load i32, i32* %1
%4 = ashr i32 %3, 1
store i32 %4, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = call i32 (...) @foo()
br label %2
8: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @xxx() {
%1 = tail call i32 (...) @foo()
%2 = tail call i32 (...) @foo()
%3 = tail call i32 (...) @foo()
%4 = tail call i32 (...) @foo()
%5 = tail call i32 (...) @foo()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void emit_help(void) {
  fprintf(stderr, "Usage: llcount [-x] [file|-]\n");
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_help>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"Usage: llcount [-x] [file|-]\0A\00"
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"Usage: llcount [-x] [file|-]\0A\00"
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ALautowahState_Delete(void *ptr) { free(ptr); }


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

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

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

LLVM IR (-O2):
define void @ALautowahState_Delete(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
float invSqrt(float x) {
  unsigned int i = 0x5F1F1412 - (*(unsigned int *)&x >> 1);
  float tmp = *(float *)&i;
  float y = tmp * (1.69000231f - 0.714158168f * x * tmp * tmp);
  return y;
}


x86 assembly (clang, -O0):
<invSqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
shr    $0x1,%ecx
mov    $0x5f1f1412,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xed4(%rip),%xmm1
mulss  -0x4(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xea8(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<invSqrt>:
movd   %xmm0,%eax
shr    %eax
mov    $0x5f1f1412,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
mulss  0xee7(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0xedb(%rip),%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @invSqrt(float %0) {
%2 = alloca float
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store float %0, float* %2
%6 = bitcast float* %2 to i32*
%7 = load i32, i32* %6
%8 = lshr i32 %7, 1
%9 = sub i32 1595872274, %8
store i32 %9, i32* %3
%10 = bitcast i32* %3 to float*
%11 = load float, float* %10
store float %11, float* %4
%12 = load float, float* %4
%13 = load float, float* %2
%14 = fmul float 0x3FE6DA6240000000, %13
%15 = load float, float* %4
%16 = fmul float %14, %15
%17 = load float, float* %4
%18 = fneg float %16
%19 = call float @llvm.fmuladd.f32(float %18, float %17, float 0x3FFB0A3FE0000000)
%20 = fmul float %12, %19
store float %20, float* %5
%21 = load float, float* %5
ret float %21
}

LLVM IR (-O2):
define float @invSqrt(float %0) {
%2 = bitcast float %0 to i32
%3 = lshr i32 %2, 1
%4 = sub nsw i32 1595872274, %3
%5 = bitcast i32 %4 to float
%6 = fmul float %0, 0xBFE6DA6240000000
%7 = fmul float %6, %5
%8 = tail call float @llvm.fmuladd.f32(float %7, float %5, float 0x3FFB0A3FE0000000)
%9 = fmul float %8, %5
ret float %9
}
int chkPrime(int i) {
  int j, flag = 0;
  for (j = 2; j <= i; j++) {
    if (i % j == 0) {
      flag = 1;
      break;
    } else
      flag = 0;
  }
  if (flag == 0) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<chkPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1157 <chkPrime+0x57>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    113d <chkPrime+0x3d>
movl   $0x1,-0x10(%rbp)
jmp    1157 <chkPrime+0x57>
movl   $0x0,-0x10(%rbp)
jmp    1149 <chkPrime+0x49>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <chkPrime+0x15>
cmpl   $0x0,-0x10(%rbp)
jne    116d <chkPrime+0x6d>
movl   $0x0,-0x4(%rbp)
jmp    1174 <chkPrime+0x74>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chkPrime>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     1139 <chkPrime+0x39>
mov    $0x1,%eax
test   $0x1,%dil
je     1139 <chkPrime+0x39>
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
mov    %esi,%ecx
cmp    %esi,%edi
je     1132 <chkPrime+0x32>
lea    0x1(%rcx),%esi
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1120 <chkPrime+0x20>
xor    %eax,%eax
cmp    %edi,%ecx
setl   %al
ret

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

LLVM IR (-O2):
define i32 @chkPrime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %16, label %3
3: ; preds = %1
%4 = and i32 %0, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %3, %10
%7 = phi i32 [ %8, %10 ], [ 2, %3 ]
%8 = add nuw i32 %7, 1
%9 = icmp eq i32 %7, %0
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = srem i32 %0, %8
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %10
%14 = icmp slt i32 %7, %0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %13, %3, %1
%17 = phi i32 [ 0, %1 ], [ 1, %3 ], [ %15, %13 ]
ret i32 %17
}
/* Variables and functions */
int db_sql_enum_end_fn(char **);
int db_sql_enum_end(char **pe) { return db_sql_enum_end_fn(pe); }


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

x86 assembly (clang, -O2):
<db_sql_enum_end>:
jmp    1030 <db_sql_enum_end_fn@plt>

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

LLVM IR (-O2):
define i32 @db_sql_enum_end(i8** %0) {
%2 = tail call i32 @db_sql_enum_end_fn(i8** %0)
ret i32 %2
}
void ft_striteri(char *s, void (*f)(unsigned int, char *)) {
  int i;
  i = -1;
  if (s && f)
    while (*(s + ++i))
      f(i, s + i);
}


x86 assembly (clang, -O0):
<ft_striteri>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116a <ft_striteri+0x6a>
cmpq   $0x0,-0x10(%rbp)
je     116a <ft_striteri+0x6a>
jmp    1132 <ft_striteri+0x32>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1165 <ft_striteri+0x65>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%rsi
movslq -0x14(%rbp),%rcx
add    %rcx,%rsi
call   *%rax
jmp    1132 <ft_striteri+0x32>
jmp    116a <ft_striteri+0x6a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_striteri>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1135 <ft_striteri+0x35>
mov    %rsi,%r14
test   %rsi,%rsi
je     1135 <ft_striteri+0x35>
mov    %rdi,%r15
cmpb   $0x0,(%rdi)
je     1135 <ft_striteri+0x35>
xor    %ebx,%ebx
nopl   0x0(%rax)
lea    (%r15,%rbx,1),%rsi
mov    %ebx,%edi
call   *%r14
cmpb   $0x0,0x1(%r15,%rbx,1)
lea    0x1(%rbx),%rbx
jne    1120 <ft_striteri+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @ft_striteri(i8* %0, void (i32, i8*)* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne void (i32, i8*)* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = load i8, i8* %0
%8 = icmp eq i8 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %6, %9
%10 = phi i64 [ %13, %9 ], [ 0, %6 ]
%11 = phi i8* [ %14, %9 ], [ %0, %6 ]
%12 = trunc i64 %10 to i32
tail call void %1(i32 %12, i8* %11)
%13 = add nuw i64 %10, 1
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %9
17: ; preds = %9, %6, %2
ret void
}
/* Variables and functions */
int getChar();
int /*<<< orphan*/ ungetChar(int);
void skipWS(void) {
  int c = getChar();
  while (c == ' ' || c == '\n')
    c = getChar();
  ungetChar(c);
}


x86 assembly (clang, -O0):
<skipWS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getChar@plt>
mov    %eax,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     114b <skipWS+0x2b>
cmpl   $0xa,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    115b <skipWS+0x3b>
jmp    116a <skipWS+0x4a>
mov    $0x0,%al
call   1030 <getChar@plt>
mov    %eax,-0x4(%rbp)
jmp    1132 <skipWS+0x12>
mov    -0x4(%rbp),%edi
call   1040 <ungetChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipWS>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getChar@plt>
cmp    $0xa,%eax
je     1130 <skipWS+0x10>
cmp    $0x20,%eax
je     1130 <skipWS+0x10>
mov    %eax,%edi
pop    %rax
jmp    1040 <ungetChar@plt>

LLVM IR (-O0):
define void @skipWS() {
%1 = alloca i32
%2 = call i32 (...) @getChar()
store i32 %2, i32* %1
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 32
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 10
br label %9
9: ; preds = %6, %3
%10 = phi i1 [ true, %3 ], [ %8, %6 ]
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = call i32 (...) @getChar()
store i32 %12, i32* %1
br label %3
13: ; preds = %9
%14 = load i32, i32* %1
%15 = call i32 @ungetChar(i32 %14)
ret void
}

LLVM IR (-O2):
define void @skipWS() {
br label %1
1: ; preds = %3, %0
%2 = tail call i32 (...) @getChar()
switch i32 %2, label %4 [
i32 32, label %3
i32 10, label %3
]
3: ; preds = %1, %1
br label %1
4: ; preds = %1
%5 = tail call i32 @ungetChar(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pause();
void idle_loop(void) { pause(); }


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

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

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

LLVM IR (-O2):
define void @idle_loop() {
%1 = tail call i32 (...) @pause()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mpfr_t;
typedef int mpfr_rnd_t;

/* Variables and functions */
int /*<<< orphan*/ mpfr_d_div(int /*<<< orphan*/, double, int /*<<< orphan*/,
                              int);
void mpfrddiv(mpfr_t r2, double *d, mpfr_t r1, mpfr_rnd_t *irnd) {
  double d1;
  int n1;
  d1 = *d;
  n1 = *irnd;
  mpfr_d_div(r2, d1, r1, n1);
}


x86 assembly (clang, -O0):
<mpfrddiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x28(%rbp),%xmm0
mov    -0x14(%rbp),%esi
mov    -0x2c(%rbp),%edx
call   1030 <mpfr_d_div@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpfrddiv>:
movsd  (%rsi),%xmm0
mov    (%rcx),%eax
mov    %edx,%esi
mov    %eax,%edx
jmp    1030 <mpfr_d_div@plt>

LLVM IR (-O0):
define void @mpfrddiv(i32 %0, double* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca double
%10 = alloca i32
store i32 %0, i32* %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%11 = load double*, double** %6
%12 = load double, double* %11
store double %12, double* %9
%13 = load i32*, i32** %8
%14 = load i32, i32* %13
store i32 %14, i32* %10
%15 = load i32, i32* %5
%16 = load double, double* %9
%17 = load i32, i32* %7
%18 = load i32, i32* %10
%19 = call i32 @mpfr_d_div(i32 %15, double %16, i32 %17, i32 %18)
ret void
}

LLVM IR (-O2):
define void @mpfrddiv(i32 %0, double* nocapture %1, i32 %2, i32* nocapture %3) {
%5 = load double, double* %1
%6 = load i32, i32* %3
%7 = tail call i32 @mpfr_d_div(i32 %0, double %5, i32 %2, i32 %6)
ret void
}