xunge/DecIR huggingface dataset:
int positionSortieCaverne(const unsigned int direction,
                          const unsigned int dimension) {
  static const int basePositionSortieCaverne[4][2] = {
      {-1, 0}, {1, 0}, {0, -1}, {0, 1}};
  return basePositionSortieCaverne[direction][dimension];
}


x86 assembly (clang, -O0):
<positionSortieCaverne>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0xeea(%rip),%rax
shl    $0x3,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<positionSortieCaverne>:
mov    %edi,%eax
mov    %esi,%ecx
lea    0xef5(%rip),%rdx
lea    (%rdx,%rax,8),%rax
mov    (%rax,%rcx,4),%eax
ret

LLVM IR (-O0):
@positionSortieCaverne.basePositionSortieCaverne = internal constant [4 x [2 x i32]] [[2 x i32] [i32 -1, i32 0], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 0, i32 -1], [2 x i32] [i32 0, i32 1]]
define i32 @positionSortieCaverne(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 = zext i32 %5 to i64
%7 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* @positionSortieCaverne.basePositionSortieCaverne, i64 0, i64 %6
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 %9
%11 = load i32, i32* %10
ret i32 %11
}

LLVM IR (-O2):
@positionSortieCaverne.basePositionSortieCaverne = internal unnamed_addr constant [4 x [2 x i32]] [[2 x i32] [i32 -1, i32 0], [2 x i32] [i32 1, i32 0], [2 x i32] [i32 0, i32 -1], [2 x i32] [i32 0, i32 1]]
define i32 @positionSortieCaverne(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = zext i32 %1 to i64
%5 = getelementptr inbounds [4 x [2 x i32]], [4 x [2 x i32]]* @positionSortieCaverne.basePositionSortieCaverne, i64 0, i64 %3, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}
int validate_file(const char *source __attribute__((unused)),
                  const char *dest __attribute__((unused))) {
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @validate_file(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
define i32 @validate_file(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int strcmp(char const *, char const *);
int __keycmp(void *user_data, const void *k1, const void *k2) {
  return (strcmp((const char *)k1, (const char *)k2));
}


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

x86 assembly (clang, -O2):
<__keycmp>:
mov    %rsi,%rdi
mov    %rdx,%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @__keycmp(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = call i32 @strcmp(i8* %7, i8* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @__keycmp(i8* nocapture readnone %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(1) %2)
ret i32 %4
}
void usage(argv) char *argv[];
{
  AJKNETusage("CPMTELNET", "0.0.5", "TELNET", argv[0],
              "the.network.IP.address [port]");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
lea    0xed6(%rip),%rdi
lea    0xed9(%rip),%rsi
lea    0xecb(%rip),%rdx
lea    0xed1(%rip),%r8
mov    $0x0,%al
call   1030 <AJKNETusage@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    (%rdi),%rcx
lea    0xee6(%rip),%rdi
lea    0xee9(%rip),%rsi
lea    0xedb(%rip),%rdx
lea    0xee1(%rip),%r8
xor    %eax,%eax
jmp    1030 <AJKNETusage@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"CPMTELNET\00"
@.str.1 = [6 x i8] c"0.0.5\00"
@.str.2 = [7 x i8] c"TELNET\00"
@.str.3 = [30 x i8] c"the.network.IP.address [port]\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @AJKNETusage to i32 (i8*, i8*, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %5, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"CPMTELNET\00"
@.str.1 = [6 x i8] c"0.0.5\00"
@.str.2 = [7 x i8] c"TELNET\00"
@.str.3 = [30 x i8] c"the.network.IP.address [port]\00"
define void @usage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 (i8*, i8*, i8*, i8*, i8*, ...) bitcast (i32 (...)* @AJKNETusage to i32 (i8*, i8*, i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ timerSet(size_t, int /*<<< orphan*/, int /*<<< orphan*/);
void timerStop() {
  for (size_t i = 4; i--; timerSet(i, 0, 0))
    ;
}


x86 assembly (clang, -O0):
<timerStop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x4,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x8(%rbp)
cmp    $0x0,%rax
je     1150 <timerStop+0x40>
jmp    113e <timerStop+0x2e>
mov    -0x8(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <timerSet@plt>
jmp    1120 <timerStop+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timerStop>:
push   %rax
mov    $0x3,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <timerSet@plt>
mov    $0x2,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <timerSet@plt>
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <timerSet@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
pop    %rax
jmp    1030 <timerSet@plt>

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

LLVM IR (-O2):
define void @timerStop() {
%1 = tail call i32 @timerSet(i64 3, i32 0, i32 0)
%2 = tail call i32 @timerSet(i64 2, i32 0, i32 0)
%3 = tail call i32 @timerSet(i64 1, i32 0, i32 0)
%4 = tail call i32 @timerSet(i64 0, i32 0, i32 0)
ret void
}
int cmodel_is_yuv(int colormodel) {
  switch (colormodel) {
  case 13:
  case 14:
  case 15:
  case 16:
  case 19:
  case 7:
  case 17:
  case 27:
  case 18:
    return 1;
    break;
  default:
    return 0;
    break;
  }
}


x86 assembly (clang, -O0):
<cmodel_is_yuv>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x7,%eax
je     1140 <cmodel_is_yuv+0x40>
jmp    111b <cmodel_is_yuv+0x1b>
mov    -0xc(%rbp),%eax
add    $0xfffffff3,%eax
sub    $0x7,%eax
jb     1140 <cmodel_is_yuv+0x40>
jmp    112f <cmodel_is_yuv+0x2f>
mov    -0xc(%rbp),%eax
sub    $0x1b,%eax
jne    114c <cmodel_is_yuv+0x4c>
jmp    1140 <cmodel_is_yuv+0x40>
movl   $0x1,-0x4(%rbp)
jmp    1153 <cmodel_is_yuv+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmodel_is_yuv>:
add    $0xfffffff9,%edi
xor    %eax,%eax
cmp    $0x14,%edi
ja     1117 <cmodel_is_yuv+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @cmodel_is_yuv(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 13, label %5
i32 14, label %5
i32 15, label %5
i32 16, label %5
i32 19, label %5
i32 7, label %5
i32 17, label %5
i32 27, label %5
i32 18, label %5
]
5: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %7
6: ; preds = %1
store i32 0, i32* %2
br label %7
7: ; preds = %6, %5
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
@switch.table.cmodel_is_yuv = [21 x i32] [i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 1]
define i32 @cmodel_is_yuv(i32 %0) {
%2 = add i32 %0, -7
%3 = icmp ult i32 %2, 21
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [21 x i32], [21 x i32]* @switch.table.cmodel_is_yuv, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
scalar_t__ findMaxMultupleOf3(int *, int);
int /*<<< orphan*/ printf(char *);
int main() {
  int arr[] = {8, 1, 7, 6, 0};
  int size = sizeof(arr) / sizeof(arr[0]);
  if (findMaxMultupleOf3(arr, size) == 0)
    printf("not possible");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x5,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <findMaxMultupleOf3@plt>
cmp    $0x0,%rax
jne    1177 <main+0x57>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1040 <findMaxMultupleOf3@plt>
test   %rax,%rax
jne    1157 <main+0x37>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@__const.main.arr = [5 x i32] [i32 8, i32 1, i32 7, i32 6, i32 0]
@.str = [13 x i8] c"not possible\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%4 = call i64 @findMaxMultupleOf3(i32* %3, i32 5)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
ret i32 0
}
int isLeapYear(int year) {
  if (year < 1582)
    return 0;
  return year % 4 == 0 || year % 400 == 0;
}


x86 assembly (clang, -O0):
<isLeapYear>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x62e,-0x8(%rbp)
jge    1120 <isLeapYear+0x20>
movl   $0x0,-0x4(%rbp)
jmp    1158 <isLeapYear+0x58>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x9(%rbp)
je     114d <isLeapYear+0x4d>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeapYear>:
xor    %eax,%eax
cmp    $0x62e,%edi
jl     1124 <isLeapYear+0x24>
test   $0x3,%dil
je     1125 <isLeapYear+0x25>
imul   $0xc28f5c29,%edi,%ecx
ror    $0x4,%ecx
xor    %eax,%eax
cmp    $0xa3d70b,%ecx
setb   %al
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isLeapYear(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 1582
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %18
7: ; preds = %1
%8 = load i32, i32* %3
%9 = srem i32 %8, 4
%10 = icmp eq i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = srem i32 %12, 400
%14 = icmp eq i32 %13, 0
br label %15
15: ; preds = %11, %7
%16 = phi i1 [ true, %7 ], [ %14, %11 ]
%17 = zext i1 %16 to i32
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @isLeapYear(i32 %0) {
%2 = icmp slt i32 %0, 1582
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = and i32 %0, 3
%5 = icmp eq i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = urem i32 %0, 400
%8 = icmp eq i32 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %3, %6, %1
%11 = phi i32 [ 0, %1 ], [ 1, %3 ], [ %9, %6 ]
ret i32 %11
}
/* Type definitions */
struct nlattr {
  int dummy;
};
typedef int /*<<< orphan*/ __u64;

/* Variables and functions */
scalar_t__ nla_data(struct nlattr const *);
__u64 nla_get_u64(const struct nlattr *nla) { return *(__u64 *)nla_data(nla); }


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

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

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

LLVM IR (-O2):
%struct.nlattr = type { i32 }
define i32 @nla_get_u64(%struct.nlattr* %0) {
%2 = tail call i64 @nla_data(%struct.nlattr* %0)
%3 = inttoptr i64 %2 to i32*
%4 = load i32, i32* %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ dotest(int, int, char *);
int main() {
  dotest(7000, 7100, "7027, 7043, 7057");
  dotest(70000, 70245,
         "70001, 70009, 70061, 70079, 70121, 70141, 70163, 70241");
  dotest(70485, 70600, "70489, 70529, 70573, 70589");
  dotest(60000, 70000, "");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1b58,%edi
mov    $0x1bbc,%esi
lea    0xedb(%rip),%rdx
call   1030 <dotest@plt>
mov    $0x11170,%edi
mov    $0x11265,%esi
lea    0xed6(%rip),%rdx
call   1030 <dotest@plt>
mov    $0x11355,%edi
mov    $0x113c8,%esi
lea    0xef7(%rip),%rdx
call   1030 <dotest@plt>
mov    $0xea60,%edi
mov    $0x11170,%esi
lea    0xee0(%rip),%rdx
call   1030 <dotest@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdx
mov    $0x1b58,%edi
mov    $0x1bbc,%esi
call   1030 <dotest@plt>
lea    0xee3(%rip),%rdx
mov    $0x11170,%edi
mov    $0x11265,%esi
call   1030 <dotest@plt>
lea    0xf04(%rip),%rdx
mov    $0x11355,%edi
mov    $0x113c8,%esi
call   1030 <dotest@plt>
lea    0xeed(%rip),%rdx
mov    $0xea60,%edi
mov    $0x11170,%esi
call   1030 <dotest@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"7027, 7043, 7057\00"
@.str.1 = [55 x i8] c"70001, 70009, 70061, 70079, 70121, 70141, 70163, 70241\00"
@.str.2 = [27 x i8] c"70489, 70529, 70573, 70589\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = call i32 @dotest(i32 7000, i32 7100, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @dotest(i32 70000, i32 70245, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @dotest(i32 70485, i32 70600, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @dotest(i32 60000, i32 70000, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"7027, 7043, 7057\00"
@.str.1 = [55 x i8] c"70001, 70009, 70061, 70079, 70121, 70141, 70163, 70241\00"
@.str.2 = [27 x i8] c"70489, 70529, 70573, 70589\00"
@.str.3 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = tail call i32 @dotest(i32 7000, i32 7100, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @dotest(i32 70000, i32 70245, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @dotest(i32 70485, i32 70600, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @dotest(i32 60000, i32 70000, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
int test_034(int a, int b, int c, int d) { return a + a + ((d >> 31) & 1); }


x86 assembly (clang, -O0):
<test_034>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x4(%rbp),%eax
mov    -0x10(%rbp),%ecx
sar    $0x1f,%ecx
and    $0x1,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_034>:
mov    %edi,%eax
shld   $0x1,%ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_034(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* %5
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %8
%13 = ashr i32 %12, 31
%14 = and i32 %13, 1
%15 = add nsw i32 %11, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @test_034(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %3, i32 1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ CallbackInfoHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void CallbackInfoUpdated() { UAVObjUpdated(CallbackInfoHandle()); }


x86 assembly (clang, -O0):
<CallbackInfoUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <CallbackInfoHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<CallbackInfoUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <CallbackInfoHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @CallbackInfoUpdated() {
%1 = call i32 (...) @CallbackInfoHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @CallbackInfoUpdated() {
%1 = tail call i32 (...) @CallbackInfoHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
void err_sys(const char *info) {
  perror(info);
  exit(1);
}


x86 assembly (clang, -O0):
<err_sys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<err_sys>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @err_sys(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @err_sys(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
double fabs(double);
bool approxEquals(double value, double other, double epsilon) {
  return fabs(value - other) < epsilon;
}


x86 assembly (clang, -O0):
<approxEquals>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movaps 0xedc(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<approxEquals>:
subsd  %xmm1,%xmm0
andpd  0xef4(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm0,%xmm2
seta   %al
ret

LLVM IR (-O0):
define i32 @approxEquals(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
%10 = call double @llvm.fabs.f64(double %9)
%11 = load double, double* %6
%12 = fcmp olt double %10, %11
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @approxEquals(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fcmp olt double %5, %2
%7 = zext i1 %6 to i32
ret i32 %7
}
void write_barrier(void) { return; }


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

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

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

LLVM IR (-O2):
define void @write_barrier() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __svgalib_driver8p_putbox(int, int, int, int, void *, int);
void __svgalib_driver32p_putbox(int x, int y, int w, int h, void *b, int bw) {
  __svgalib_driver8p_putbox(x * 4, y, w * 4, h, b, bw * 4);
}


x86 assembly (clang, -O0):
<__svgalib_driver32p_putbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
shl    $0x2,%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
shl    $0x2,%r9d
call   1030 <__svgalib_driver8p_putbox@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__svgalib_driver32p_putbox>:
shl    $0x2,%edi
shl    $0x2,%edx
shl    $0x2,%r9d
jmp    1030 <__svgalib_driver8p_putbox@plt>

LLVM IR (-O0):
define void @__svgalib_driver32p_putbox(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = mul nsw i32 %13, 4
%15 = load i32, i32* %8
%16 = load i32, i32* %9
%17 = mul nsw i32 %16, 4
%18 = load i32, i32* %10
%19 = load i8*, i8** %11
%20 = load i32, i32* %12
%21 = mul nsw i32 %20, 4
%22 = call i32 @__svgalib_driver8p_putbox(i32 %14, i32 %15, i32 %17, i32 %18, i8* %19, i32 %21)
ret void
}

LLVM IR (-O2):
define void @__svgalib_driver32p_putbox(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = shl nsw i32 %0, 2
%8 = shl nsw i32 %2, 2
%9 = shl nsw i32 %5, 2
%10 = tail call i32 @__svgalib_driver8p_putbox(i32 %7, i32 %1, i32 %8, i32 %3, i8* %4, i32 %9)
ret void
}
unsigned xrop3_190_0_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T ^ S;
  stk1 = D | stk2;
  return (stk1 & S) | (stk1 & (~T)) | (T & (~S) & D);
}


x86 assembly (clang, -O0):
<xrop3_190_0_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
and    -0x8(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_190_0_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
mov    %esi,%edx
shl    $0x8,%edx
lea    (%rdx,%rsi,1),%eax
xor    %ecx,%edx
or     %edi,%ecx
or     $0xff,%edx
not    %eax
or     %ecx,%eax
and    %edx,%eax
not    %edi
and    %esi,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_190_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = xor i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %9
%27 = or i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = load i32, i32* %6
%30 = and i32 %28, %29
%31 = load i32, i32* %8
%32 = load i32, i32* %7
%33 = xor i32 %32, -1
%34 = and i32 %31, %33
%35 = or i32 %30, %34
%36 = load i32, i32* %7
%37 = load i32, i32* %6
%38 = xor i32 %37, -1
%39 = and i32 %36, %38
%40 = load i32, i32* %5
%41 = and i32 %39, %40
%42 = or i32 %35, %41
ret i32 %42
}

LLVM IR (-O2):
define i32 @xrop3_190_0_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = or i32 %4, %3
%6 = zext i8 %1 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %6
%9 = xor i32 %7, %4
%10 = or i32 %9, 255
%11 = xor i32 %8, -1
%12 = or i32 %5, %11
%13 = and i32 %10, %12
%14 = xor i32 %3, -1
%15 = and i32 %14, %6
%16 = or i32 %13, %15
ret i32 %16
}
int integer_log10(long n) {
  int log_val = 0;
  while (n >= 10) {
    log_val++;
    n /= 10;
  }
  return log_val;
}


x86 assembly (clang, -O0):
<integer_log10>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0xa,-0x8(%rbp)
jl     113a <integer_log10+0x3a>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    110f <integer_log10+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<integer_log10>:
xor    %ecx,%ecx
cmp    $0xa,%rdi
jl     1136 <integer_log10+0x36>
xor    %ecx,%ecx
movabs $0xcccccccccccccccd,%rsi
cc cc cc
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ecx
mov    %rdi,%rax
mul    %rsi
shr    $0x3,%rdx
cmp    $0x63,%rdi
mov    %rdx,%rdi
ja     1120 <integer_log10+0x20>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @integer_log10(i64 %0) {
%2 = icmp sgt i64 %0, 9
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i64 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = udiv i64 %5, 10
%8 = icmp ugt i64 %5, 99
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
double test_hypot(double x, double y) { return __builtin_hypot(x, y); }


x86 assembly (clang, -O0):
<test_hypot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <hypot@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hypot>:
jmp    1030 <hypot@plt>

LLVM IR (-O0):
define double @test_hypot(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @hypot(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @test_hypot(double %0, double %1) {
%3 = tail call double @hypot(double %0, double %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void henry() {
  static int fred = 4567;
  printf("%d\n", fred);
  fred++;
}


x86 assembly (clang, -O0):
<henry>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f0e(%rip),%esi
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
mov    0x2efc(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2ef3(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<henry>:
push   %rax
mov    0x2f11(%rip),%esi
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
addl   $0x1,0x2efe(%rip)
pop    %rax
ret

LLVM IR (-O0):
@henry.fred = internal global i32 4567
@.str = [4 x i8] c"%d\0A\00"
define void @henry() {
%1 = load i32, i32* @henry.fred
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @henry.fred
%4 = add nsw i32 %3, 1
store i32 %4, i32* @henry.fred
ret void
}

LLVM IR (-O2):
@henry.fred = internal unnamed_addr global i32 4567
@.str = [4 x i8] c"%d\0A\00"
define void @henry() {
%1 = load i32, i32* @henry.fred
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @henry.fred
%4 = add nsw i32 %3, 1
store i32 %4, i32* @henry.fred
ret void
}
int builtin_allows(char *typ, char *ps, char *s, int n) { return 1; }


x86 assembly (clang, -O0):
<builtin_allows>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @builtin_allows(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
ret i32 1
}

LLVM IR (-O2):
define i32 @builtin_allows(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i32 %3) {
ret i32 1
}
int min(int foo, int bar) { return foo < bar ? foo : bar; }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @min(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
int quickwakeup_check(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @quickwakeup_check() {
ret i32 0
}
/* Type definitions */
struct histlog2 {
  int dummy;
};
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
int histlog2_index(int /*<<< orphan*/, struct histlog2 *);
void histlog2_account(__u32 *bucket, __u32 val, struct histlog2 *h) {
  int index = histlog2_index(val, h);
  bucket[index]++;
}


x86 assembly (clang, -O0):
<histlog2_account>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <histlog2_index@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<histlog2_account>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
mov    %rdx,%rsi
call   1030 <histlog2_index@plt>
cltq
addl   $0x1,(%rbx,%rax,4)
pop    %rbx
ret

LLVM IR (-O0):
%struct.histlog2 = type { i32 }
define void @histlog2_account(i32* %0, i32 %1, %struct.histlog2* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca %struct.histlog2*
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store %struct.histlog2* %2, %struct.histlog2** %6
%8 = load i32, i32* %5
%9 = load %struct.histlog2*, %struct.histlog2** %6
%10 = call i32 @histlog2_index(i32 %8, %struct.histlog2* %9)
store i32 %10, i32* %7
%11 = load i32*, i32** %4
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = add nsw i32 %15, 1
store i32 %16, i32* %14
ret void
}

LLVM IR (-O2):
%struct.histlog2 = type { i32 }
define void @histlog2_account(i32* nocapture %0, i32 %1, %struct.histlog2* %2) {
%4 = tail call i32 @histlog2_index(i32 %1, %struct.histlog2* %2)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1
store i32 %8, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_binary_rep(double);
int /*<<< orphan*/ printf(char *);
int scanf(char *, double *);
int main(void) {
  printf("Enter a real number in the range ]0, 1[\n");
  double n;
  while (scanf("%lf", &n) == 1) {
    print_binary_rep(n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1173 <main+0x43>
movsd  -0x10(%rbp),%xmm0
call   1040 <print_binary_rep@plt>
jmp    114b <main+0x1b>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    117a <main+0x4a>
lea    0xea5(%rip),%r14
mov    %rsp,%rbx
xchg   %ax,%ax
movsd  (%rsp),%xmm0
call   1040 <print_binary_rep@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
je     1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Enter a real number in the range ]0, 1[\0A\00"
@.str.1 = [4 x i8] c"%lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %7, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = load double, double* %2
%9 = call i32 @print_binary_rep(double %8)
br label %4
10: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@str = [40 x i8] c"Enter a real number in the range ]0, 1[\00"
define i32 @main() {
%1 = alloca double
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%3 = bitcast double* %1 to i8*
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %11
6: ; preds = %0, %6
%7 = load double, double* %1
%8 = call i32 @print_binary_rep(double %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%10 = icmp eq i32 %9, 1
br i1 %10, label %6, label %11
11: ; preds = %6, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ loglike_psi_initialize();
void fitfun_initialize() { loglike_psi_initialize(); }


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

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

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

LLVM IR (-O2):
define void @fitfun_initialize() {
%1 = tail call i32 (...) @loglike_psi_initialize()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int type;
  while (1) {
    scanf("%d", &type);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
jmp    111f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
lea    0x4(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <scanf@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
br label %3
}
int countchar(char *string, char search) {
  int count = 0;
  for (char *current = string; *current != '\0'; current++) {
    if (*current == search)
      count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<countchar>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115f <countchar+0x5f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1149 <countchar+0x49>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114e <countchar+0x4e>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111d <countchar+0x1d>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countchar>:
mov    (%rdi),%cl
test   %cl,%cl
je     1126 <countchar+0x26>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %sil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <countchar+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @countchar(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %7, %2
%6 = phi i32 [ 0, %2 ], [ %13, %7 ]
ret i32 %6
7: ; preds = %2, %7
%8 = phi i8 [ %15, %7 ], [ %3, %2 ]
%9 = phi i8* [ %14, %7 ], [ %0, %2 ]
%10 = phi i32 [ %13, %7 ], [ 0, %2 ]
%11 = icmp eq i8 %8, %1
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %10, %12
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %5, label %7
}
/* Type definitions */
typedef int /*<<< orphan*/ aio_context_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_io_setup;
int syscall(int /*<<< orphan*/, unsigned int, int /*<<< orphan*/ *);
int __io_setup(unsigned nr_events, aio_context_t *ctx_idp) {
  return syscall(__NR_io_setup, nr_events, ctx_idp);
}


x86 assembly (clang, -O0):
<__io_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__io_setup>:
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
@__NR_io_setup = global i32 0
define i32 @__io_setup(i32 %0, i32* %1) {
%3 = load i32, i32* @__NR_io_setup
%4 = tail call i32 @syscall(i32 %3, i32 %0, i32* %1)
ret i32 %4
}
double floor(double x) { return __builtin_floor(x); }


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

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

LLVM IR (-O0):
define double @floor(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.floor.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @floor(double %0) {
%2 = tail call double @llvm.floor.f64(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ __emit_string_literal_range(char *, int, int, int);
void test_u(void) { __emit_string_literal_range(u"0123456789", 6, 4, 7); }


x86 assembly (clang, -O0):
<test_u>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x6,%esi
mov    $0x4,%edx
mov    $0x7,%ecx
call   1030 <__emit_string_literal_range@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_u>:
lea    0xee9(%rip),%rdi
mov    $0x6,%esi
mov    $0x4,%edx
mov    $0x7,%ecx
jmp    1030 <__emit_string_literal_range@plt>

LLVM IR (-O0):
@.str = [11 x i16] [i16 48, i16 49, i16 50, i16 51, i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 0]
define void @test_u() {
%1 = call i32 @__emit_string_literal_range(i8* bitcast ([11 x i16]* @.str to i8*), i32 6, i32 4, i32 7)
ret void
}

LLVM IR (-O2):
@.str = [11 x i16] [i16 48, i16 49, i16 50, i16 51, i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 0]
define void @test_u() {
%1 = tail call i32 @__emit_string_literal_range(i8* bitcast ([11 x i16]* @.str to i8*), i32 6, i32 4, i32 7)
ret void
}
int contains(int *numbers, int count, int value) {
  for (int j = 0; j < count; j++)
    if (numbers[j] == value)
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<contains>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1154 <contains+0x54>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1141 <contains+0x41>
movl   $0x1,-0x4(%rbp)
jmp    115b <contains+0x5b>
jmp    1146 <contains+0x46>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <contains+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<contains>:
test   %esi,%esi
jle    113a <contains+0x3a>
mov    $0x1,%eax
cmp    %edx,(%rdi)
je     1139 <contains+0x39>
mov    %esi,%ecx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rax,%rsi
cmp    %rax,%rcx
je     1131 <contains+0x31>
lea    0x1(%rsi),%rax
cmp    %edx,(%rdi,%rsi,4)
jne    1120 <contains+0x20>
xor    %eax,%eax
cmp    %rcx,%rsi
setb   %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @contains(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %21
5: ; preds = %3
%6 = zext i32 %1 to i64
%7 = zext i32 %1 to i64
%8 = load i32, i32* %0
%9 = icmp eq i32 %8, %2
br i1 %9, label %21, label %10
10: ; preds = %5, %13
%11 = phi i64 [ %17, %13 ], [ 1, %5 ]
%12 = icmp eq i64 %11, %7
br i1 %12, label %18, label %13
13: ; preds = %10
%14 = getelementptr inbounds i32, i32* %0, i64 %11
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, %2
%17 = add nuw nsw i64 %11, 1
br i1 %16, label %18, label %10
18: ; preds = %10, %13
%19 = icmp ult i64 %11, %6
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %18, %5, %3
%22 = phi i32 [ 0, %3 ], [ 1, %5 ], [ %20, %18 ]
ret i32 %22
}
int rec(int n) {
  if (n < 2)
    return (n);
  else
    return ((rec(n - 1) + rec(n - 2)) % 100);
}


x86 assembly (clang, -O0):
<rec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1130 <rec+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115b <rec+0x4b>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <rec@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <rec@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rec>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x1,%edi
jle    114c <rec+0x3c>
lea    -0x1(%rbx),%edi
call   1030 <rec@plt>
mov    %eax,%ebp
add    $0xfffffffe,%ebx
mov    %ebx,%edi
call   1030 <rec@plt>
add    %ebp,%eax
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @rec(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi i32 [ %11, %5 ], [ %0, %1 ]
ret i32 %4
5: ; preds = %1
%6 = add nsw i32 %0, -1
%7 = tail call i32 @rec(i32 %6)
%8 = add nsw i32 %0, -2
%9 = tail call i32 @rec(i32 %8)
%10 = add nsw i32 %9, %7
%11 = srem i32 %10, 100
br label %3
}