xunge/DecIR huggingface dataset:
/* Variables and functions */
double ranf();
int mode_MultSym(int lo, int hi) {
  return lo + (int)(ranf() * (double)(hi - lo + 1));
}


x86 assembly (clang, -O0):
<mode_MultSym>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <ranf@plt>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
cvtsi2sd %ecx,%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_MultSym>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <ranf@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cvtsi2sd %ebx,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mode_MultSym(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 = call double (...) @ranf()
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = add nsw i32 %9, 1
%11 = sitofp i32 %10 to double
%12 = fmul double %6, %11
%13 = fptosi double %12 to i32
%14 = add nsw i32 %5, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @mode_MultSym(i32 %0, i32 %1) {
%3 = tail call double (...) @ranf()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = sitofp i32 %5 to double
%7 = fmul double %3, %6
%8 = fptosi double %7 to i32
%9 = add nsw i32 %8, %0
ret i32 %9
}
int is_sorted(int input[], int size) {
  for (int i = 0; i < size - 1; i++) {
    if (input[i] > input[i + 1])
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_sorted>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1163 <is_sorted+0x63>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%edx
add    $0x1,%edx
movslq %edx,%rdx
cmp    (%rcx,%rdx,4),%eax
jle    1150 <is_sorted+0x50>
movl   $0x0,-0x4(%rbp)
jmp    116a <is_sorted+0x6a>
jmp    1155 <is_sorted+0x55>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <is_sorted+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_sorted>:
add    $0xffffffff,%esi
xor    %edx,%edx
test   %esi,%esi
mov    $0x0,%r8d
cmovg  %esi,%r8d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rdx,%rcx
cmp    %rdx,%r8
je     1135 <is_sorted+0x35>
mov    (%rdi,%rcx,4),%eax
lea    0x1(%rcx),%rdx
cmp    0x4(%rdi,%rcx,4),%eax
jle    1120 <is_sorted+0x20>
movslq %esi,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
setge  %al
ret

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

LLVM IR (-O2):
define i32 @is_sorted(i32* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = call i32 @llvm.smax.i32(i32 %3, i32 0)
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %9, %2
%7 = phi i64 [ %12, %9 ], [ 0, %2 ]
%8 = icmp eq i64 %7, %5
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = getelementptr inbounds i32, i32* %0, i64 %7
%11 = load i32, i32* %10
%12 = add nuw nsw i64 %7, 1
%13 = getelementptr inbounds i32, i32* %0, i64 %12
%14 = load i32, i32* %13
%15 = icmp sgt i32 %11, %14
br i1 %15, label %16, label %6
16: ; preds = %9, %6
%17 = sext i32 %3 to i64
%18 = icmp sge i64 %7, %17
%19 = zext i1 %18 to i32
ret i32 %19
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void oom(void) { exit(-1); }


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

x86 assembly (clang, -O2):
<oom>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @oom() {
%1 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define void @oom() {
%1 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void _dmt_abort(void) { abort(); }


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

x86 assembly (clang, -O2):
<_dmt_abort>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @_dmt_abort() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @_dmt_abort() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int uint64_t;
typedef int uint32_t;

/* Variables and functions */
int ntohl(int);
uint64_t ntohll(uint64_t value) {
  static const int num = 23;
  if (*(const char *)(&num) != num)
    return value;
  uint32_t high_part = ntohl((uint32_t)(value >> 32));
  uint32_t low_part = ntohl((uint32_t)(value & 0xffffffffLL));
  return ((uint64_t)low_part << 32) | high_part;
}


x86 assembly (clang, -O0):
<ntohll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movsbl 0xede(%rip),%eax
cmp    $0x17,%eax
je     1136 <ntohll+0x26>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1173 <ntohll+0x63>
mov    -0x8(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1030 <ntohl@plt>
mov    %eax,-0xc(%rbp)
movslq -0x8(%rbp),%rax
movabs $0xffffffff,%rcx
and    %rcx,%rax
mov    %eax,%edi
call   1030 <ntohl@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntohll>:
push   %rbx
mov    %edi,%ebx
call   1030 <ntohl@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <ntohl@plt>

LLVM IR (-O0):
@ntohll.num = internal constant i32 23
define i32 @ntohll(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i8, i8* bitcast (i32* @ntohll.num to i8*)
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 23
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %3
store i32 %10, i32* %2
br label %24
11: ; preds = %1
%12 = load i32, i32* %3
%13 = ashr i32 %12, 32
%14 = call i32 @ntohl(i32 %13)
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = and i64 %16, 4294967295
%18 = trunc i64 %17 to i32
%19 = call i32 @ntohl(i32 %18)
store i32 %19, i32* %5
%20 = load i32, i32* %5
%21 = shl i32 %20, 32
%22 = load i32, i32* %4
%23 = or i32 %21, %22
store i32 %23, i32* %2
br label %24
24: ; preds = %11, %9
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @ntohll(i32 %0) {
%2 = tail call i32 @ntohl(i32 poison)
%3 = tail call i32 @ntohl(i32 %0)
ret i32 poison
}
/* Variables and functions */
char toupper(char in) { return in & 0xDF; }


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

x86 assembly (clang, -O2):
<toupper>:
mov    %edi,%eax
and    $0xdf,%al
ret

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

LLVM IR (-O2):
define signext i8 @toupper(i8 signext %0) {
%2 = and i8 %0, -33
ret i8 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, float);
void write_tempo(FILE *file, int speed, int tempo) {
  float real_tempo = 6;
  real_tempo /= speed;
  real_tempo *= tempo;
  fprintf(file, "  tempo %.2f", real_tempo);
}


x86 assembly (clang, -O0):
<write_tempo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movss  0xed6(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0x14(%rbp),%xmm0
lea    0xea3(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_tempo>:
cvtsi2ss %esi,%xmm1
cvtsi2ss %edx,%xmm0
movss  0xee0(%rip),%xmm2
divss  %xmm1,%xmm2
mulss  %xmm2,%xmm0
lea    0xed5(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c" tempo %.2f\00"
define void @write_tempo(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store float 6.000000e+00, float* %7
%8 = load i32, i32* %5
%9 = sitofp i32 %8 to float
%10 = load float, float* %7
%11 = fdiv float %10, %9
store float %11, float* %7
%12 = load i32, i32* %6
%13 = sitofp i32 %12 to float
%14 = load float, float* %7
%15 = fmul float %14, %13
store float %15, float* %7
%16 = load i32*, i32** %4
%17 = load float, float* %7
%18 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %17)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c" tempo %.2f\00"
define void @write_tempo(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sitofp i32 %1 to float
%5 = fdiv float 6.000000e+00, %4
%6 = sitofp i32 %2 to float
%7 = fmul float %5, %6
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %7)
ret void
}
void lpc2000_debug_printf(char const *format, ...) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @lpc2000_debug_printf(i8* nocapture %0, ...) {
ret void
}
int ListType(int nCode) {
  switch (nCode) {
  case 336:
    return 258;
  case 337:
    return 259;
  }
  return 257;
}


x86 assembly (clang, -O0):
<ListType>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x150,%eax
je     1130 <ListType+0x30>
jmp    111d <ListType+0x1d>
mov    -0xc(%rbp),%eax
sub    $0x151,%eax
je     113c <ListType+0x3c>
jmp    1148 <ListType+0x48>
movl   $0x102,-0x4(%rbp)
jmp    114f <ListType+0x4f>
movl   $0x103,-0x4(%rbp)
jmp    114f <ListType+0x4f>
movl   $0x101,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ListType>:
xor    %eax,%eax
cmp    $0x151,%edi
sete   %al
lea    (%rax,%rax,1),%ecx
add    $0x101,%ecx
cmp    $0x150,%edi
mov    $0x102,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ListType(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 336, label %5
i32 337, label %6
]
5: ; preds = %1
store i32 258, i32* %2
br label %8
6: ; preds = %1
store i32 259, i32* %2
br label %8
7: ; preds = %1
store i32 257, i32* %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @ListType(i32 %0) {
%2 = icmp eq i32 %0, 337
%3 = select i1 %2, i32 259, i32 257
%4 = icmp eq i32 %0, 336
%5 = select i1 %4, i32 258, i32 %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void displayTitle() { printf("C Function Example 7\n\n"); }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"C Function Example 7\0A\0A\00"
define void @displayTitle() {
%1 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [22 x i8] c"C Function Example 7\0A\00"
define void @displayTitle() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ intfunc();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello Split Module Table world (11)\n");
  intfunc();
  return (0);
}


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"Hello Split Module Table world (11)\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @intfunc()
ret i32 0
}

LLVM IR (-O2):
@str = [36 x i8] c"Hello Split Module Table world (11)\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @intfunc()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __assert_fail(int);
void __assert(int cond, int line) {
  if (!cond) {
    __assert_fail(line);
  }
}


x86 assembly (clang, -O0):
<__assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1130 <__assert+0x20>
mov    -0x8(%rbp),%edi
call   1030 <__assert_fail@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__assert>:
test   %edi,%edi
je     1115 <__assert+0x5>
ret
mov    %esi,%edi
jmp    1030 <__assert_fail@plt>

LLVM IR (-O0):
define void @__assert(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 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %4
%9 = call i32 @__assert_fail(i32 %8)
br label %10
10: ; preds = %7, %2
ret void
}

LLVM IR (-O2):
define void @__assert(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @__assert_fail(i32 %1)
br label %6
6: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ decode3(int *, int *);
int lookupB64(int);
void decode4(uint8_t *src, uint8_t *dst) {
  decode3(src, dst);
  dst += 2;
  *dst = (lookupB64(src[2]) & 0x03) << 6;
  *dst |= lookupB64(src[3]);
}


x86 assembly (clang, -O0):
<decode4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <decode3@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%edi
call   1040 <lookupB64@plt>
mov    %eax,%ecx
and    $0x3,%ecx
shl    $0x6,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edi
call   1040 <lookupB64@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode4>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <decode3@plt>
mov    0x8(%rbx),%edi
call   1040 <lookupB64@plt>
shl    $0x6,%eax
movzbl %al,%eax
mov    %eax,0x8(%r14)
mov    0xc(%rbx),%edi
call   1040 <lookupB64@plt>
or     %eax,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @decode4(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32*, i32** %4
%7 = call i32 @decode3(i32* %5, i32* %6)
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 2
store i32* %9, i32** %4
%10 = load i32*, i32** %3
%11 = getelementptr inbounds i32, i32* %10, i64 2
%12 = load i32, i32* %11
%13 = call i32 @lookupB64(i32 %12)
%14 = and i32 %13, 3
%15 = shl i32 %14, 6
%16 = load i32*, i32** %4
store i32 %15, i32* %16
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 3
%19 = load i32, i32* %18
%20 = call i32 @lookupB64(i32 %19)
%21 = load i32*, i32** %4
%22 = load i32, i32* %21
%23 = or i32 %22, %20
store i32 %23, i32* %21
ret void
}

LLVM IR (-O2):
define void @decode4(i32* %0, i32* %1) {
%3 = tail call i32 @decode3(i32* %0, i32* %1)
%4 = getelementptr inbounds i32, i32* %1, i64 2
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = load i32, i32* %5
%7 = tail call i32 @lookupB64(i32 %6)
%8 = shl i32 %7, 6
%9 = and i32 %8, 192
store i32 %9, i32* %4
%10 = getelementptr inbounds i32, i32* %0, i64 3
%11 = load i32, i32* %10
%12 = tail call i32 @lookupB64(i32 %11)
%13 = load i32, i32* %4
%14 = or i32 %13, %12
store i32 %14, i32* %4
ret void
}
/* Type definitions */
struct vec3i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec3i_dot(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
__attribute__((always_)) int32_t psvec3i_dot(struct vec3i *a, struct vec3i *b) {
  return vec3i_dot((int32_t *)a, (int32_t *)b);
}


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

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

LLVM IR (-O0):
%struct.vec3i = type { i32 }
define i32 @psvec3i_dot(%struct.vec3i* %0, %struct.vec3i* %1) {
%3 = alloca %struct.vec3i*
%4 = alloca %struct.vec3i*
store %struct.vec3i* %0, %struct.vec3i** %3
store %struct.vec3i* %1, %struct.vec3i** %4
%5 = load %struct.vec3i*, %struct.vec3i** %3
%6 = bitcast %struct.vec3i* %5 to i32*
%7 = load %struct.vec3i*, %struct.vec3i** %4
%8 = bitcast %struct.vec3i* %7 to i32*
%9 = call i32 @vec3i_dot(i32* %6, i32* %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.vec3i = type { i32 }
define i32 @psvec3i_dot(%struct.vec3i* %0, %struct.vec3i* %1) {
%3 = getelementptr %struct.vec3i, %struct.vec3i* %0, i64 0, i32 0
%4 = getelementptr %struct.vec3i, %struct.vec3i* %1, i64 0, i32 0
%5 = tail call i32 @vec3i_dot(i32* %3, i32* %4)
ret i32 %5
}
int exact_square(int number) {
  int digit, i;
  digit = 0;
  for (i = 1; i <= number; i++) {
    if (i * i == number) {
      digit = 1;
      break;
    }
  }
  return digit;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1150 <exact_square+0x50>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    113d <exact_square+0x3d>
movl   $0x1,-0x8(%rbp)
jmp    1150 <exact_square+0x50>
jmp    1142 <exact_square+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <exact_square+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
xor    %eax,%eax
test   %edi,%edi
jle    1127 <exact_square+0x27>
mov    %edi,%ecx
neg    %ecx
mov    $0x1,%edx
nop
mov    %edx,%esi
imul   %edx,%esi
cmp    %edi,%esi
je     1128 <exact_square+0x28>
lea    (%rcx,%rdx,1),%esi
add    $0x1,%esi
add    $0x1,%edx
cmp    $0x1,%esi
jne    1110 <exact_square+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %10, label %6
3: ; preds = %6
%4 = add nuw i32 %7, 1
%5 = icmp eq i32 %7, %0
br i1 %5, label %10, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ 1, %1 ]
%8 = mul nsw i32 %7, %7
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %6, %1
%11 = phi i32 [ 0, %1 ], [ 1, %6 ], [ 0, %3 ]
ret i32 %11
}
int recGcd(int a, int b) {
  while (a != b) {
    if (a > b)
      return recGcd(a - b, b);
    else
      return recGcd(a, b - a);
  }
  return a;
}


x86 assembly (clang, -O0):
<recGcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1162 <recGcd+0x52>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    114c <recGcd+0x3c>
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <recGcd@plt>
mov    %eax,-0x4(%rbp)
jmp    1168 <recGcd+0x58>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    -0x8(%rbp),%esi
call   1030 <recGcd@plt>
mov    %eax,-0x4(%rbp)
jmp    1168 <recGcd+0x58>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recGcd>:
cmp    %esi,%edi
jne    1107 <recGcd+0x7>
mov    %edi,%eax
ret
mov    %esi,%eax
mov    %eax,%ecx
nopl   0x0(%rax,%rax,1)
sub    %edi,%ecx
jl     1120 <recGcd+0x20>
mov    %ecx,%eax
cmp    %ecx,%edi
jne    1110 <recGcd+0x10>
jmp    1104 <recGcd+0x4>
nopl   0x0(%rax)
sub    %eax,%edi
cmp    %edi,%eax
jne    1109 <recGcd+0x9>
jmp    1106 <recGcd+0x6>

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

LLVM IR (-O2):
define i32 @recGcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
br i1 %3, label %16, label %4
4: ; preds = %2, %10
%5 = phi i32 [ %8, %10 ], [ %1, %2 ]
%6 = phi i32 [ %11, %10 ], [ %0, %2 ]
br label %7
7: ; preds = %4, %13
%8 = phi i32 [ %5, %4 ], [ %14, %13 ]
%9 = icmp slt i32 %8, %6
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = sub nsw i32 %6, %8
%12 = icmp eq i32 %11, %8
br i1 %12, label %16, label %4
13: ; preds = %7
%14 = sub nsw i32 %8, %6
%15 = icmp eq i32 %6, %14
br i1 %15, label %16, label %7
16: ; preds = %10, %13, %2
%17 = phi i32 [ %0, %2 ], [ %6, %13 ], [ %8, %10 ]
ret i32 %17
}
int fun1312() { return 1312; }


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

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

LLVM IR (-O0):
define i32 @fun1312() {
ret i32 1312
}

LLVM IR (-O2):
define i32 @fun1312() {
ret i32 1312
}
unsigned int value_size(long long value) {
  value >>= 8;
  if (!value)
    return 8;
  value >>= 8;
  if (!value)
    return 16;
  value >>= 16;
  if (!value)
    return 32;
  return 64;
}


x86 assembly (clang, -O0):
<value_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sar    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    112b <value_size+0x2b>
movl   $0x8,-0x4(%rbp)
jmp    1178 <value_size+0x78>
mov    -0x10(%rbp),%rax
sar    $0x8,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114e <value_size+0x4e>
movl   $0x10,-0x4(%rbp)
jmp    1178 <value_size+0x78>
mov    -0x10(%rbp),%rax
sar    $0x10,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1171 <value_size+0x71>
movl   $0x20,-0x4(%rbp)
jmp    1178 <value_size+0x78>
movl   $0x40,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<value_size>:
mov    $0x8,%eax
cmp    $0x100,%rdi
jb     112b <value_size+0x2b>
mov    $0x10,%eax
cmp    $0x10000,%rdi
jb     112b <value_size+0x2b>
xor    %eax,%eax
shr    $0x20,%rdi
setne  %al
shl    $0x5,%eax
add    $0x20,%eax
ret

LLVM IR (-O0):
define i32 @value_size(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = ashr i64 %4, 8
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = icmp ne i64 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 8, i32* %2
br label %22
9: ; preds = %1
%10 = load i64, i64* %3
%11 = ashr i64 %10, 8
store i64 %11, i64* %3
%12 = load i64, i64* %3
%13 = icmp ne i64 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %9
store i32 16, i32* %2
br label %22
15: ; preds = %9
%16 = load i64, i64* %3
%17 = ashr i64 %16, 16
store i64 %17, i64* %3
%18 = load i64, i64* %3
%19 = icmp ne i64 %18, 0
br i1 %19, label %21, label %20
20: ; preds = %15
store i32 32, i32* %2
br label %22
21: ; preds = %15
store i32 64, i32* %2
br label %22
22: ; preds = %21, %20, %14, %8
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @value_size(i64 %0) {
%2 = icmp ult i64 %0, 256
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = icmp ult i64 %0, 65536
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = icmp ult i64 %0, 4294967296
%7 = select i1 %6, i32 32, i32 64
br label %8
8: ; preds = %5, %3, %1
%9 = phi i32 [ 8, %1 ], [ 16, %3 ], [ %7, %5 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ crash_handler(unsigned int *, int);
void crash_handler_data(unsigned int *context, int unused1, int unused2) {
  crash_handler(context, 1);
}


x86 assembly (clang, -O0):
<crash_handler_data>:
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    $0x1,%esi
call   1030 <crash_handler@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crash_handler_data>:
mov    $0x1,%esi
jmp    1030 <crash_handler@plt>

LLVM IR (-O0):
define void @crash_handler_data(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 = call i32 @crash_handler(i32* %7, i32 1)
ret void
}

LLVM IR (-O2):
define void @crash_handler_data(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @crash_handler(i32* %0, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Welcome to Demo of \"Cracking The Coding Interviews\"!\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [54 x i8] c"Welcome to Demo of \22Cracking The Coding Interviews\22!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [53 x i8] c"Welcome to Demo of \22Cracking The Coding Interviews\22!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ test();
int main2(void) {
  test();
  return 0;
}


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

x86 assembly (clang, -O2):
<main2>:
push   %rax
xor    %eax,%eax
call   1030 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main2() {
%1 = call i32 (...) @test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main2() {
%1 = tail call i32 (...) @test()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
scalar_t__ is_little_endian();
int /*<<< orphan*/ swap16(int /*<<< orphan*/);
uint16_t pgp_hton16(uint16_t in) {
  return (is_little_endian()) ? swap16(in) : in;
}


x86 assembly (clang, -O0):
<pgp_hton16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <is_little_endian@plt>
cmp    $0x0,%rax
je     114c <pgp_hton16+0x2c>
mov    -0x4(%rbp),%edi
call   1030 <swap16@plt>
mov    %eax,-0x8(%rbp)
jmp    1152 <pgp_hton16+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pgp_hton16>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <is_little_endian@plt>
test   %rax,%rax
je     1137 <pgp_hton16+0x17>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <swap16@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @pgp_hton16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @is_little_endian()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 @swap16(i32 %6)
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @pgp_hton16(i32 %0) {
%2 = tail call i64 (...) @is_little_endian()
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @swap16(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
int xf86pathIsAbsolute(const char *path) {
  if (path && path[0] == '/')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<xf86pathIsAbsolute>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     112f <xf86pathIsAbsolute+0x2f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    112f <xf86pathIsAbsolute+0x2f>
movl   $0x1,-0x4(%rbp)
jmp    1136 <xf86pathIsAbsolute+0x36>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xf86pathIsAbsolute>:
test   %rdi,%rdi
je     110f <xf86pathIsAbsolute+0xf>
mov    $0x1,%eax
cmpb   $0x2f,(%rdi)
je     1111 <xf86pathIsAbsolute+0x11>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @xf86pathIsAbsolute(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 47
br i1 %5, label %7, label %6
6: ; preds = %3, %1
br label %7
7: ; preds = %3, %6
%8 = phi i32 [ 0, %6 ], [ 1, %3 ]
ret i32 %8
}
int test_imm_82uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x82 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_82uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 8519680
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int fun1183() { return 1183; }


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

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

LLVM IR (-O0):
define i32 @fun1183() {
ret i32 1183
}

LLVM IR (-O2):
define i32 @fun1183() {
ret i32 1183
}
/* Variables and functions */
unsigned char VIM_HIF_GetReg8(int);
unsigned char VIM_MARB_GetRecaptureTime(void) {
  return VIM_HIF_GetReg8((0x2400 + 0x0A7));
}


x86 assembly (clang, -O0):
<VIM_MARB_GetRecaptureTime>:
push   %rbp
mov    %rsp,%rbp
mov    $0x24a7,%edi
call   1030 <VIM_HIF_GetReg8@plt>
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIM_MARB_GetRecaptureTime>:
mov    $0x24a7,%edi
jmp    1030 <VIM_HIF_GetReg8@plt>

LLVM IR (-O0):
define zeroext i8 @VIM_MARB_GetRecaptureTime() {
%1 = call zeroext i8 @VIM_HIF_GetReg8(i32 9383)
ret i8 %1
}

LLVM IR (-O2):
define zeroext i8 @VIM_MARB_GetRecaptureTime() {
%1 = tail call zeroext i8 @VIM_HIF_GetReg8(i32 9383)
ret i8 %1
}
void nfs_fscache_zap_cookie(struct inode *inode) {}


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

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

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

LLVM IR (-O2):
%struct.inode = type opaque
define void @nfs_fscache_zap_cookie(%struct.inode* nocapture %0) {
ret void
}
void two_tasks(int *x, int *y) {
  *x = 1;
  *y = 2;
}


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

x86 assembly (clang, -O2):
<two_tasks>:
movl   $0x1,(%rdi)
movl   $0x2,(%rsi)
ret

LLVM IR (-O0):
define void @two_tasks(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
store i32 1, i32* %5
%6 = load i32*, i32** %4
store i32 2, i32* %6
ret void
}

LLVM IR (-O2):
define void @two_tasks(i32* nocapture writeonly %0, i32* nocapture writeonly %1) {
store i32 1, i32* %0
store i32 2, i32* %1
ret void
}
void print(const char *__restrict fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @print(i8* noalias nocapture %0, ...) {
ret void
}
/* Variables and functions */
int sys_zoomfontwidth(int, int, int /*<<< orphan*/);
int sys_fontwidth(int fontsize) { return (sys_zoomfontwidth(fontsize, 1, 0)); }


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

x86 assembly (clang, -O2):
<sys_fontwidth>:
mov    $0x1,%esi
xor    %edx,%edx
jmp    1030 <sys_zoomfontwidth@plt>

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

LLVM IR (-O2):
define i32 @sys_fontwidth(i32 %0) {
%2 = tail call i32 @sys_zoomfontwidth(i32 %0, i32 1, i32 0)
ret i32 %2
}
int FUNC_NAME(void) { return 12345; }


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

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

LLVM IR (-O0):
define i32 @FUNC_NAME() {
ret i32 12345
}

LLVM IR (-O2):
define i32 @FUNC_NAME() {
ret i32 12345
}
cuf(pn) int pn;
{ brc(pn, 'C'); }


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

x86 assembly (clang, -O2):
<cuf>:
mov    $0x43,%esi
xor    %eax,%eax
jmp    1030 <brc@plt>

LLVM IR (-O0):
define i32 @cuf(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i32, i32, ...) bitcast (i32 (...)* @brc to i32 (i32, i32, ...)*)(i32 %4, i32 67)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @cuf(i32 %0) {
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @brc to i32 (i32, i32, ...)*)(i32 %0, i32 67)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ BNCIO(int);
int BNC_5() {
  int ii, stat = 99;
  char com1, data;
  BNCIO(5);
  return (stat);
}


x86 assembly (clang, -O0):
<BNC_5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x63,-0x8(%rbp)
mov    $0x5,%edi
call   1030 <BNCIO@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BNC_5>:
push   %rax
mov    $0x5,%edi
call   1030 <BNCIO@plt>
mov    $0x63,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @BNC_5() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
%4 = alloca i8
store i32 99, i32* %2
%5 = call i32 @BNCIO(i32 5)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @BNC_5() {
%1 = tail call i32 @BNCIO(i32 5)
ret i32 99
}
/* Type definitions */
typedef int /*<<< orphan*/ WINDOW;

/* Variables and functions */
int wprintw(int /*<<< orphan*/ *, char const *);
int n_wprintw(WINDOW *win, const char *fmt) { return (wprintw(win, fmt)); }


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

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

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

LLVM IR (-O2):
define i32 @n_wprintw(i32* %0, i8* %1) {
%3 = tail call i32 @wprintw(i32* %0, i8* %1)
ret i32 %3
}
int div16(int x) {
  int sign = x >> 31;
  int bias = sign & 0xF;
  int x_with_bias = x + bias;
  return x_with_bias >> 4;
}


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

x86 assembly (clang, -O2):
<div16>:
mov    %edi,%eax
sar    $0x1f,%eax
and    $0xf,%eax
add    %edi,%eax
sar    $0x4,%eax
ret

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

LLVM IR (-O2):
define i32 @div16(i32 %0) {
%2 = icmp slt i32 %0, 0
%3 = select i1 %2, i32 15, i32 0
%4 = add nsw i32 %3, %0
%5 = ashr i32 %4, 4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ destory_thompson();
void free_nfa(void) { destory_thompson(); }


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

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

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

LLVM IR (-O2):
define void @free_nfa() {
%1 = tail call i32 (...) @destory_thompson()
ret void
}
void OS_setPref(const char *name, const char *value) {}


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

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

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

LLVM IR (-O2):
define void @OS_setPref(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void do_help() {
  printf("	  help : display help info\n");
  printf("	  list : display file list from server\n");
  printf("get <file> : download file from server\n ");
  printf("put <file> : upload file to server\n");
  printf("	  quit : exit\n");
}


x86 assembly (clang, -O0):
<do_help>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
lea    0xf13(%rip),%rdi
call   1030 <printf@plt>
lea    0xf30(%rip),%rdi
call   1030 <printf@plt>
lea    0xf48(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_help>:
push   %rax
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1040 <printf@plt>
lea    0xf21(%rip),%rdi
call   1030 <puts@plt>
lea    0xf38(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"\09 help : display help info\0A\00"
@.str.1 = [41 x i8] c"\09 list : display file list from server\0A\00"
@.str.2 = [41 x i8] c"get <file> : download file from server\0A \00"
@.str.3 = [36 x i8] c"put <file> : upload file to server\0A\00"
@.str.4 = [16 x i8] c"\09 quit : exit\0A\00"
define void @do_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [41 x i8] c"get <file> : download file from server\0A \00"
@str = [28 x i8] c"\09 help : display help info\00"
@str.5 = [40 x i8] c"\09 list : display file list from server\00"
@str.6 = [35 x i8] c"put <file> : upload file to server\00"
@str.7 = [15 x i8] c"\09 quit : exit\00"
define void @do_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.7, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main() {
  int *arr = malloc(10 * sizeof(int));
  arr[1] = 1;
  free(arr);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @malloc(i32 40)
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 1
store i32 1, i32* %5
%6 = load i32*, i32** %2
%7 = call i32 @free(i32* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 40)
%2 = getelementptr inbounds i32, i32* %1, i64 1
store i32 1, i32* %2
%3 = tail call i32 @free(i32* %1)
ret i32 0
}
/* Type definitions */
struct evkeyvalq {
  int dummy;
};
struct evhttp_request {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ evhttp_add_header(struct evkeyvalq *, char const *,
                                     char const *);
int /*<<< orphan*/ evhttp_remove_header(struct evkeyvalq *, char const *);
struct evkeyvalq *evhttp_request_get_output_headers(struct evhttp_request *);
void _set_header(struct evhttp_request *req, const char *key,
                 const char *value) {
  struct evkeyvalq *headers = evhttp_request_get_output_headers(req);
  evhttp_remove_header(headers, key);
  evhttp_add_header(headers, key, value);
}


x86 assembly (clang, -O0):
<_set_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <evhttp_request_get_output_headers@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <evhttp_remove_header@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <evhttp_add_header@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_set_header>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
call   1040 <evhttp_request_get_output_headers@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
call   1030 <evhttp_remove_header@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <evhttp_add_header@plt>

LLVM IR (-O0):
%struct.evhttp_request = type { i32 }
%struct.evkeyvalq = type { i32 }
define void @_set_header(%struct.evhttp_request* %0, i8* %1, i8* %2) {
%4 = alloca %struct.evhttp_request*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.evkeyvalq*
store %struct.evhttp_request* %0, %struct.evhttp_request** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load %struct.evhttp_request*, %struct.evhttp_request** %4
%9 = call %struct.evkeyvalq* @evhttp_request_get_output_headers(%struct.evhttp_request* %8)
store %struct.evkeyvalq* %9, %struct.evkeyvalq** %7
%10 = load %struct.evkeyvalq*, %struct.evkeyvalq** %7
%11 = load i8*, i8** %5
%12 = call i32 @evhttp_remove_header(%struct.evkeyvalq* %10, i8* %11)
%13 = load %struct.evkeyvalq*, %struct.evkeyvalq** %7
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = call i32 @evhttp_add_header(%struct.evkeyvalq* %13, i8* %14, i8* %15)
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
%struct.evkeyvalq = type { i32 }
define void @_set_header(%struct.evhttp_request* %0, i8* %1, i8* %2) {
%4 = tail call %struct.evkeyvalq* @evhttp_request_get_output_headers(%struct.evhttp_request* %0)
%5 = tail call i32 @evhttp_remove_header(%struct.evkeyvalq* %4, i8* %1)
%6 = tail call i32 @evhttp_add_header(%struct.evkeyvalq* %4, i8* %1, i8* %2)
ret void
}