xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ rank(int *, int, int);
int test_invalid_k() {
  int array[] = {5, 3, 8, 7, 1, 4, 9, 2, 6};
  return 0 == rank(array, 9, 11) && 0 == rank(array, 9, -2);
}


x86 assembly (clang, -O0):
<test_invalid_k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0xb,%edx
call   1030 <rank@plt>
mov    %rax,%rdx
xor    %eax,%eax
xor    %ecx,%ecx
cmp    %rdx,%rcx
mov    %al,-0x31(%rbp)
jne    1184 <test_invalid_k+0x64>
lea    -0x30(%rbp),%rdi
mov    $0x9,%esi
mov    $0xfffffffe,%edx
call   1030 <rank@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_invalid_k>:
sub    $0x28,%rsp
mov    0xf06(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0xb,%edx
call   1030 <rank@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1156 <test_invalid_k+0x46>
add    $0x28,%rsp
ret
mov    %rsp,%rdi
mov    $0x9,%esi
mov    $0xfffffffe,%edx
call   1030 <rank@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.test_invalid_k.array = [9 x i32] [i32 5, i32 3, i32 8, i32 7, i32 1, i32 4, i32 9, i32 2, i32 6]
define i32 @test_invalid_k() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i64 @rank(i32* %3, i32 9, i32 11)
%5 = icmp eq i64 0, %4
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%8 = call i64 @rank(i32* %7, i32 9, i32 -2)
%9 = icmp eq i64 0, %8
br label %10
10: ; preds = %6, %0
%11 = phi i1 [ false, %0 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@__const.test_invalid_k.array = [9 x i32] [i32 5, i32 3, i32 8, i32 7, i32 1, i32 4, i32 9, i32 2, i32 6]
define i32 @test_invalid_k() {
%1 = alloca [9 x i32]
%2 = bitcast [9 x i32]* %1 to i8*
%3 = getelementptr inbounds [9 x i32], [9 x i32]* %1, i64 0, i64 0
%4 = call i64 @rank(i32* %3, i32 9, i32 11)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %0
%7 = call i64 @rank(i32* %3, i32 9, i32 -2)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %0
%11 = phi i32 [ 0, %0 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ flushbits(int);
scalar_t__ getbits(int);
void ext_bit_info() {
  while (getbits(1))
    flushbits(8);
}


x86 assembly (clang, -O0):
<ext_bit_info>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <ext_bit_info+0x9>
mov    $0x1,%edi
call   1030 <getbits@plt>
cmp    $0x0,%rax
je     114c <ext_bit_info+0x2c>
mov    $0x8,%edi
call   1040 <flushbits@plt>
jmp    1129 <ext_bit_info+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ext_bit_info>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <getbits@plt>
test   %rax,%rax
je     114b <ext_bit_info+0x2b>
mov    $0x8,%edi
call   1040 <flushbits@plt>
jmp    1130 <ext_bit_info+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @ext_bit_info() {
br label %1
1: ; preds = %4, %0
%2 = call i64 @getbits(i32 1)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = call i32 @flushbits(i32 8)
br label %1
6: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @ext_bit_info() {
%1 = tail call i64 @getbits(i32 1)
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0, %3
%4 = tail call i32 @flushbits(i32 8)
%5 = tail call i64 @getbits(i32 1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char, int, char);
int main() {
  printf("Stringformatierungen: %c %c %d %d", 65, 'A', 65, 'A');
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [34 x i8] c"Stringformatierungen: %c %c %d %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 65, i8 signext 65, i32 65, i8 signext 65)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ empty_log(char *);
void *d_defer_new() {
  empty_log("d_defer_new\n");
  return NULL;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"d_defer_new\0A\00"
define i8* @d_defer_new() {
%1 = call i32 @empty_log(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@.str = [13 x i8] c"d_defer_new\0A\00"
define noalias i8* @d_defer_new() {
%1 = tail call i32 @empty_log(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i8* null
}
void RTAvlrU64RangeGet(void) {}


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

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

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

LLVM IR (-O2):
define void @RTAvlrU64RangeGet() {
ret void
}
unsigned char inb_p(unsigned short port) {
  unsigned char _v;
  asm volatile("in"
               "b"
               " %"
               "w"
               "1,%"
               ""
               "0"
               : "=a"(_v)
               : "Nd"(port));
  slow_down_io();
  return _v;
}


x86 assembly (clang, -O0):
<inb_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%al
mov    %al,-0x3(%rbp)
mov    $0x0,%al
call   1030 <slow_down_io@plt>
movzbl -0x3(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb_p>:
push   %rbx
mov    %edi,%edx
in     (%dx),%al
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <slow_down_io@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @inb_p(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i8 asm sideeffect "inb ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i8 %5, i8* %3
%6 = call i32 (...) @slow_down_io()
%7 = load i8, i8* %3
ret i8 %7
}

LLVM IR (-O2):
define zeroext i8 @inb_p(i16 zeroext %0) {
%2 = tail call i8 asm sideeffect "inb ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
%3 = tail call i32 (...) @slow_down_io()
ret i8 %2
}
void intc_clearvectaddr(void) {
  (*((volatile unsigned long *)((0xF2000000) + 0xf00))) = 0;
  (*((volatile unsigned long *)((0xF2100000) + 0xf00))) = 0;
  (*((volatile unsigned long *)((0xF2200000) + 0xf00))) = 0;
  (*((volatile unsigned long *)((0xF2300000) + 0xf00))) = 0;
}


x86 assembly (clang, -O0):
<intc_clearvectaddr>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf2000f00,%eax
movq   $0x0,(%rax)
mov    $0xf2100f00,%eax
movq   $0x0,(%rax)
mov    $0xf2200f00,%eax
movq   $0x0,(%rax)
mov    $0xf2300f00,%eax
movq   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<intc_clearvectaddr>:
mov    $0xf2000f00,%eax
movq   $0x0,(%rax)
movq   $0x0,0x100000(%rax)
movq   $0x0,0x200000(%rax)
movq   $0x0,0x300000(%rax)
ret

LLVM IR (-O0):
define void @intc_clearvectaddr() {
store volatile i64 0, i64* inttoptr (i64 4060090112 to i64*)
store volatile i64 0, i64* inttoptr (i64 4061138688 to i64*)
store volatile i64 0, i64* inttoptr (i64 4062187264 to i64*)
store volatile i64 0, i64* inttoptr (i64 4063235840 to i64*)
ret void
}

LLVM IR (-O2):
define void @intc_clearvectaddr() {
store volatile i64 0, i64* inttoptr (i64 4060090112 to i64*)
store volatile i64 0, i64* inttoptr (i64 4061138688 to i64*)
store volatile i64 0, i64* inttoptr (i64 4062187264 to i64*)
store volatile i64 0, i64* inttoptr (i64 4063235840 to i64*)
ret void
}
int f2() {
  int x;
  if (x + 1)
    return 1;
  return 2;
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
mov    -0x8(%rbp),%eax
add    $0x1,%eax
cmp    $0x0,%eax
je     111f <f2+0x1f>
movl   $0x1,-0x4(%rbp)
jmp    1126 <f2+0x26>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @f2() {
ret i32 2
}
float CubicBezierP0(float t, float p) {
  float k = 1 - t;
  return k * k * k * p;
}


x86 assembly (clang, -O0):
<CubicBezierP0>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  0xeea(%rip),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<CubicBezierP0>:
movss  0xef8(%rip),%xmm2
subss  %xmm0,%xmm2
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
mulss  %xmm2,%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @CubicBezierP0(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %3
%7 = fsub float 1.000000e+00, %6
store float %7, float* %5
%8 = load float, float* %5
%9 = load float, float* %5
%10 = fmul float %8, %9
%11 = load float, float* %5
%12 = fmul float %10, %11
%13 = load float, float* %4
%14 = fmul float %12, %13
ret float %14
}

LLVM IR (-O2):
define float @CubicBezierP0(float %0, float %1) {
%3 = fsub float 1.000000e+00, %0
%4 = fmul float %3, %3
%5 = fmul float %3, %4
%6 = fmul float %5, %1
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ ReadFile(char *);
int main(int argc, char *argv[]) {
  if (argc == 2) {
    ReadFile(argv[1]);
  } else {
    ReadFile(0);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1142 <main+0x32>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <ReadFile@plt>
jmp    114b <main+0x3b>
xor    %eax,%eax
mov    %eax,%edi
call   1030 <ReadFile@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    111c <main+0xc>
mov    0x8(%rsi),%rdi
jmp    111e <main+0xe>
xor    %edi,%edi
call   1030 <ReadFile@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
br label %7
7: ; preds = %2, %4
%8 = phi i8* [ %6, %4 ], [ null, %2 ]
%9 = tail call i32 @ReadFile(i8* %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ carthw_radica_read16(int);
void carthw_radica_reset(void) { carthw_radica_read16(0xa13000); }


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

x86 assembly (clang, -O2):
<carthw_radica_reset>:
mov    $0xa13000,%edi
jmp    1030 <carthw_radica_read16@plt>

LLVM IR (-O0):
define void @carthw_radica_reset() {
%1 = call i32 @carthw_radica_read16(i32 10563584)
ret void
}

LLVM IR (-O2):
define void @carthw_radica_reset() {
%1 = tail call i32 @carthw_radica_read16(i32 10563584)
ret void
}
double almost_pi(int N) { return 0; }


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

x86 assembly (clang, -O2):
<almost_pi>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @almost_pi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @almost_pi(i32 %0) {
ret double 0.000000e+00
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
void _patch_op_imm(unsigned int *p_insn, uint16_t imm, int sh, int len) {
  unsigned int mask = ((1 << len) - 1) << sh;
  *p_insn = (*p_insn & ~mask) | ((imm << sh) & mask);
}


x86 assembly (clang, -O0):
<_patch_op_imm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x18(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    %cl,%eax
mov    -0x1c(%rbp),%ecx
and    -0x18(%rbp),%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_patch_op_imm>:
mov    %edx,%r8d
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
mov    %r8d,%ecx
shl    %cl,%eax
mov    (%rdi),%edx
shl    %cl,%esi
xor    %edx,%esi
and    %eax,%esi
xor    %edx,%esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @_patch_op_imm(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = shl i32 1, %10
%12 = sub nsw i32 %11, 1
%13 = load i32, i32* %7
%14 = shl i32 %12, %13
store i32 %14, i32* %9
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = load i32, i32* %9
%18 = xor i32 %17, -1
%19 = and i32 %16, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = shl i32 %20, %21
%23 = load i32, i32* %9
%24 = and i32 %22, %23
%25 = or i32 %19, %24
%26 = load i32*, i32** %5
store i32 %25, i32* %26
ret void
}

LLVM IR (-O2):
define void @_patch_op_imm(i32* nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = shl nsw i32 -1, %3
%6 = xor i32 %5, -1
%7 = shl i32 %6, %2
%8 = load i32, i32* %0
%9 = xor i32 %7, -1
%10 = and i32 %8, %9
%11 = shl i32 %1, %2
%12 = and i32 %7, %11
%13 = or i32 %10, %12
store i32 %13, i32* %0
ret void
}
extern void findXMLTagsFull(void *ctx, void *root, int tableTableIndex,
                            void (*runAfter)(void *, void *, void *),
                            void *userData) {}


x86 assembly (clang, -O0):
<findXMLTagsFull>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @findXMLTagsFull(i8* %0, i8* %1, i32 %2, void (i8*, i8*, i8*)* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca void (i8*, i8*, i8*)*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store void (i8*, i8*, i8*)* %3, void (i8*, i8*, i8*)** %9
store i8* %4, i8** %10
ret void
}

LLVM IR (-O2):
define void @findXMLTagsFull(i8* nocapture %0, i8* nocapture %1, i32 %2, void (i8*, i8*, i8*)* nocapture %3, i8* nocapture %4) {
ret void
}
int arrsize(char arr[]) {
  int i;
  for (i = 0; arr[i] != '\0'; ++i)
    ;
  return i;
}


x86 assembly (clang, -O0):
<arrsize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <arrsize+0x37>
jmp    1129 <arrsize+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <arrsize+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<arrsize>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <arrsize+0x10>
ret

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

LLVM IR (-O2):
define i32 @arrsize(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
double frexp(double, int *);
int isinf(double d) {
  int expon = 0;
  double val = frexp(d, &expon);
  if (expon == 1025) {
    if (val == 0.5) {
      return 1;
    } else if (val == -0.5) {
      return -1;
    } else {
      return 0;
    }
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<isinf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    -0x14(%rbp),%rdi
call   1030 <frexp@plt>
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x401,-0x14(%rbp)
jne    11a2 <isinf+0x92>
movsd  -0x20(%rbp),%xmm0
movsd  0xeaf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    116d <isinf+0x5d>
jp     116d <isinf+0x5d>
movl   $0x1,-0x4(%rbp)
jmp    11a9 <isinf+0x99>
movsd  -0x20(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1196 <isinf+0x86>
jp     1196 <isinf+0x86>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a9 <isinf+0x99>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <isinf+0x99>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isinf>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <frexp@plt>
xor    %eax,%eax
cmpl   $0x401,0x4(%rsp)
jne    1140 <isinf+0x30>
mov    $0x1,%eax
ucomisd 0xec4(%rip),%xmm0
jne    1142 <isinf+0x32>
jp     1142 <isinf+0x32>
pop    %rcx
ret
cmpeqsd 0xebd(%rip),%xmm0
movq   %xmm0,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @isinf(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store double %0, double* %3
store i32 0, i32* %4
%6 = load double, double* %3
%7 = call double @frexp(double %6, i32* %4)
store double %7, double* %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1025
br i1 %9, label %10, label %19
10: ; preds = %1
%11 = load double, double* %5
%12 = fcmp oeq double %11, 5.000000e-01
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %2
br label %20
14: ; preds = %10
%15 = load double, double* %5
%16 = fcmp oeq double %15, -5.000000e-01
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 -1, i32* %2
br label %20
18: ; preds = %14
store i32 0, i32* %2
br label %20
19: ; preds = %1
store i32 0, i32* %2
br label %20
20: ; preds = %19, %18, %17, %13
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
define i32 @isinf(double %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%4 = call double @frexp(double %0, i32* %2)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 1025
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = fcmp oeq double %4, 5.000000e-01
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = fcmp oeq double %4, -5.000000e-01
%11 = sext i1 %10 to i32
br label %12
12: ; preds = %1, %9, %7
%13 = phi i32 [ 1, %7 ], [ %11, %9 ], [ 0, %1 ]
ret i32 %13
}
/* Type definitions */
typedef int wchar_t;

/* Variables and functions */
int /*<<< orphan*/ _wc_indelim(int, int const *);
size_t wcsspn(const wchar_t *s, const wchar_t *set) {
  size_t n = 0;
  for (;;) {
    wchar_t wc = s[n];
    if (wc == L'\0')
      break;
    if (!_wc_indelim(wc, set))
      break;
    ++n;
  }
  return n;
}


x86 assembly (clang, -O0):
<wcsspn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1145 <wcsspn+0x35>
jmp    1170 <wcsspn+0x60>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <_wc_indelim@plt>
cmp    $0x0,%eax
jne    115f <wcsspn+0x4f>
jmp    1170 <wcsspn+0x60>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <wcsspn+0x18>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcsspn>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ecx,%ecx
nopl   (%rax)
mov    %rcx,%rbx
mov    (%r15,%rcx,4),%edi
test   %edi,%edi
je     113b <wcsspn+0x2b>
mov    %r14,%rsi
call   1030 <_wc_indelim@plt>
lea    0x1(%rbx),%rcx
test   %eax,%eax
jne    1120 <wcsspn+0x10>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @wcsspn(i32* nocapture %0, i32* %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i64 [ 0, %2 ], [ %11, %8 ]
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %3
%9 = tail call i32 @_wc_indelim(i32 %6, i32* %1)
%10 = icmp eq i32 %9, 0
%11 = add i64 %4, 1
br i1 %10, label %12, label %3
12: ; preds = %8, %3
ret i64 %4
}
int match_fn(const char a, const char b) { return (a == b) ? 1 : 0; }


x86 assembly (clang, -O0):
<match_fn>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%edx
movsbl -0x2(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_fn>:
xor    %eax,%eax
cmp    %sil,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @match_fn(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %6, %8
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 1, i32 0
ret i32 %11
}

LLVM IR (-O2):
define i32 @match_fn(i8 signext %0, i8 signext %1) {
%3 = icmp eq i8 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void myServoWrite(int val) { printf("Setting servo at %d degrees\n", val); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"Setting servo at %d degrees\0A\00"
define void @myServoWrite(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Setting servo at %d degrees\0A\00"
define void @myServoWrite(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
void swpcpy(char *dst, char *src, int num) {
  int i;
  num &= ~1;
  for (i = 0; i < num; i += 2) {
    dst[i] = src[i + 1];
    dst[i + 1] = src[i];
  }
}


x86 assembly (clang, -O0):
<swpcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    116f <swpcpy+0x6f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x18(%rbp)
jmp    111f <swpcpy+0x1f>
pop    %rbp
ret

x86 assembly (clang, -O2):
<swpcpy>:
and    $0xfffffffe,%edx
jle    1129 <swpcpy+0x29>
mov    %edx,%eax
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl 0x1(%rsi,%rcx,1),%edx
mov    %dl,(%rdi,%rcx,1)
movzbl (%rsi,%rcx,1),%edx
mov    %dl,0x1(%rdi,%rcx,1)
add    $0x2,%rcx
cmp    %rax,%rcx
jb     1110 <swpcpy+0x10>
ret

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

LLVM IR (-O2):
define void @swpcpy(i8* nocapture writeonly %0, i8* nocapture %1, i32 %2) {
%4 = and i32 %2, -2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = zext i32 %4 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %17, %8 ]
%10 = or i64 %9, 1
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 %12, i8* %13
%14 = getelementptr inbounds i8, i8* %1, i64 %9
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %0, i64 %10
store i8 %15, i8* %16
%17 = add nuw nsw i64 %9, 2
%18 = icmp ult i64 %17, %7
br i1 %18, label %8, label %19
19: ; preds = %8, %3
ret void
}
__attribute__((visibility("default"))) char const *__attribute__((regparm(5)))
acx1_name() {
  return "acx1-gnu_linux";
}


x86 assembly (clang, -O0):
<acx1_name>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<acx1_name>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [15 x i8] c"acx1-gnu_linux\00"
define i8* @acx1_name() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [15 x i8] c"acx1-gnu_linux\00"
define i8* @acx1_name() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(int e) {
  printf("xterm_decode Version "
         "2.0"
         "\n");
  printf("usage:xterm_decode input... \n");
  printf("      xterm_decode\n");
  printf("      output to stdout, input is list of files, or stdin.\n");
  exit(e);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xef4(%rip),%rdi
call   1030 <puts@plt>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"xterm_decode Version 2.0\0A\00"
@.str.1 = [30 x i8] c"usage:xterm_decode input... \0A\00"
@.str.2 = [20 x i8] c" xterm_decode\0A\00"
@.str.3 = [59 x i8] c" output to stdout, input is list of files, or stdin.\0A\00"
define void @usage(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@str = [25 x i8] c"xterm_decode Version 2.0\00"
@str.4 = [29 x i8] c"usage:xterm_decode input... \00"
@str.5 = [19 x i8] c" xterm_decode\00"
@str.6 = [58 x i8] c" output to stdout, input is list of files, or stdin.\00"
define void @usage(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.6, i64 0, i64 0))
%6 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clean_files() { system("rm -f C.c C.i"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"rm -f C.c C.i\00"
define void @clean_files() {
%1 = call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"rm -f C.c C.i\00"
define void @clean_files() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned int irq_minor(unsigned int channel) {
  return (channel & ((unsigned int)(1 << (16)) - 1));
}


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

x86 assembly (clang, -O2):
<irq_minor>:
movzwl %di,%eax
ret

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

LLVM IR (-O2):
define i32 @irq_minor(i32 %0) {
%2 = and i32 %0, 65535
ret i32 %2
}
int rchild(int i) { return i * 2 + 2; }


x86 assembly (clang, -O0):
<rchild>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rchild>:
lea    (%rdi,%rdi,1),%eax
add    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @rchild(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 2
%5 = add nsw i32 %4, 2
ret i32 %5
}

LLVM IR (-O2):
define i32 @rchild(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = add nsw i32 %2, 2
ret i32 %3
}
void unused(const char *fmt, ...) { (void)fmt; }


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

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

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

LLVM IR (-O2):
define void @unused(i8* nocapture %0, ...) {
ret void
}
void note_status_replace(char *line, char old, char new) {
  while (*line) {
    if (*line == old) {
      *line = new;
      break;
    }
    line++;
  }
}


x86 assembly (clang, -O0):
<note_status_replace>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1152 <note_status_replace+0x52>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1141 <note_status_replace+0x41>
mov    -0xa(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
jmp    1152 <note_status_replace+0x52>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1113 <note_status_replace+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<note_status_replace>:
mov    (%rdi),%al
test   %al,%al
je     1120 <note_status_replace+0x20>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    %sil,%al
je     1121 <note_status_replace+0x21>
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <note_status_replace+0x10>
ret
mov    %dl,-0x1(%rdi)
ret

LLVM IR (-O0):
define void @note_status_replace(i8* %0, i8 signext %1, i8 signext %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
br label %7
7: ; preds = %21, %3
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = load i8, i8* %5
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = load i8, i8* %6
%20 = load i8*, i8** %4
store i8 %19, i8* %20
br label %24
21: ; preds = %11
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
br label %7
24: ; preds = %18, %7
ret void
}

LLVM IR (-O2):
define void @note_status_replace(i8* nocapture %0, i8 signext %1, i8 signext %2) {
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %3, %11
%7 = phi i8 [ %13, %11 ], [ %4, %3 ]
%8 = phi i8* [ %12, %11 ], [ %0, %3 ]
%9 = icmp eq i8 %7, %1
br i1 %9, label %10, label %11
10: ; preds = %6
store i8 %2, i8* %8
br label %15
11: ; preds = %6
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %11, %3, %10
ret void
}
/* Variables and functions */
scalar_t__ arith_prec(int);
int higher_prec(int op1, int op2) { return arith_prec(op1) < arith_prec(op2); }


x86 assembly (clang, -O0):
<higher_prec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <arith_prec@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <arith_prec@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
setl   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<higher_prec>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <arith_prec@plt>
mov    %rax,%rbx
mov    %ebp,%edi
call   1030 <arith_prec@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
setl   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @higher_prec(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 i64 @arith_prec(i32 %5)
%7 = load i32, i32* %4
%8 = call i64 @arith_prec(i32 %7)
%9 = icmp slt i64 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @higher_prec(i32 %0, i32 %1) {
%3 = tail call i64 @arith_prec(i32 %0)
%4 = tail call i64 @arith_prec(i32 %1)
%5 = icmp slt i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
char *str_str(char *, char *);
char *str_str_002() {
  char *rel = str_str("1234567", "123");
  do {
    return NULL == rel ? NULL : "expect NULL pointer";
  } while (0);
  ;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <str_str@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
lea    0xece(%rip),%rax
cmp    %rdx,%rcx
cmove  %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee9(%rip),%rsi
call   1030 <str_str@plt>
test   %rax,%rax
lea    0xede(%rip),%rcx
cmovne %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"1234567\00"
@.str.1 = [4 x i8] c"123\00"
@.str.2 = [20 x i8] c"expect NULL pointer\00"
define i8* @str_str_002() {
%1 = alloca i8*
%2 = call i8* @str_str(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i8* %2, i8** %1
br label %3
3: ; preds = %0
%4 = load i8*, i8** %1
%5 = icmp eq i8* null, %4
%6 = zext i1 %5 to i64
%7 = select i1 %5, i8* null, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0)
br label %8
8: ; preds = %3
ret i8* %7
}

LLVM IR (-O2):
@.str = [8 x i8] c"1234567\00"
@.str.1 = [4 x i8] c"123\00"
@.str.2 = [20 x i8] c"expect NULL pointer\00"
define i8* @str_str_002() {
%1 = tail call i8* @str_str(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i8* %1, null
%3 = select i1 %2, i8* null, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0)
ret i8* %3
}
int idle(void) {
  long __res;
  __asm__ volatile("int $0x80" : "=a"(__res) : "0"(112));
  do {
    return (int)(__res);
  } while (0);
}


x86 assembly (clang, -O0):
<idle>:
push   %rbp
mov    %rsp,%rbp
mov    $0x70,%eax
int    $0x80
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<idle>:
mov    $0x70,%eax
int    $0x80
ret

LLVM IR (-O0):
define i32 @idle() {
%1 = alloca i64
%2 = call i64 asm sideeffect "int $$0x80", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i64 112)
store i64 %2, i64* %1
br label %3
3: ; preds = %0
%4 = load i64, i64* %1
%5 = trunc i64 %4 to i32
br label %6
6: ; preds = %3
ret i32 %5
}

LLVM IR (-O2):
define i32 @idle() {
%1 = tail call i64 asm sideeffect "int $$0x80", "={ax},0,~{dirflag},~{fpsr},~{flags}"(i64 112)
%2 = trunc i64 %1 to i32
ret i32 %2
}
void RTStrmRewind(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrmRewind() {
ret void
}
int parent(int _index) { return (_index < 0 ? -1 : (_index - 1) / 2); }


x86 assembly (clang, -O0):
<parent>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <parent+0x1e>
mov    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <parent+0x2f>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent>:
test   %edi,%edi
js     1114 <parent+0x14>
mov    %edi,%eax
add    $0xffffffff,%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0xffffffff,%eax
sar    %eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @parent(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
br label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
%9 = sdiv i32 %8, 2
br label %10
10: ; preds = %6, %5
%11 = phi i32 [ -1, %5 ], [ %9, %6 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @parent(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = sdiv i32 %4, 2
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ -1, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ remove_me();
int main(void) {
  int a = -100;
  int b = 0;
  int c = 3;
  for (a = 0; a < 100; a++) {
    b = b + 3;
    if (b != c)
      remove_me();
    c = c + 3;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffff9c,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1178 <main+0x68>
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
je     1161 <main+0x51>
mov    $0x0,%al
call   1030 <remove_me@plt>
mov    -0x10(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int count_data(int target, int *buf) {
  int result = 0;
  while (*buf != -1) {
    if (*buf = target)
      result++;
    buf++;
  }
  return (result);
}


x86 assembly (clang, -O0):
<count_data>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0xffffffff,(%rax)
je     114b <count_data+0x4b>
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %eax,(%rcx)
cmp    $0x0,%eax
je     113a <count_data+0x3a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x10(%rbp)
jmp    1112 <count_data+0x12>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_data>:
cmpl   $0xffffffff,(%rsi)
je     112f <count_data+0x2f>
xor    %ecx,%ecx
test   %edi,%edi
setne  %cl
add    $0x4,%rsi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %ecx,%eax
mov    %edi,-0x4(%rsi)
cmpl   $0xffffffff,(%rsi)
lea    0x4(%rsi),%rsi
jne    1120 <count_data+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @count_data(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %15, label %5
5: ; preds = %2
%6 = icmp ne i32 %0, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %5, %8
%9 = phi i32 [ 0, %5 ], [ %11, %8 ]
%10 = phi i32* [ %1, %5 ], [ %12, %8 ]
store i32 %0, i32* %10
%11 = add nuw nsw i32 %9, %7
%12 = getelementptr inbounds i32, i32* %10, i64 1
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %8
15: ; preds = %8, %2
%16 = phi i32 [ 0, %2 ], [ %11, %8 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ F_SETLK;
int lockReg(int, int /*<<< orphan*/, int, int, int, int);
int lockRegion(int fd, int type, int whence, int start, int len) {
  return lockReg(fd, F_SETLK, type, whence, start, len);
}


x86 assembly (clang, -O0):
<lockRegion>:
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    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb6(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
call   1030 <lockReg@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lockRegion>:
mov    %r8d,%r9d
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    0x2ec7(%rip),%rax
mov    (%rax),%esi
jmp    1030 <lockReg@plt>

LLVM IR (-O0):
@F_SETLK = global i32 0
define i32 @lockRegion(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %6
%12 = load i32, i32* @F_SETLK
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = call i32 @lockReg(i32 %11, i32 %12, i32 %13, i32 %14, i32 %15, i32 %16)
ret i32 %17
}

LLVM IR (-O2):
@F_SETLK = global i32 0
define i32 @lockRegion(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = load i32, i32* @F_SETLK
%7 = tail call i32 @lockReg(i32 %0, i32 %6, i32 %1, i32 %2, i32 %3, i32 %4)
ret i32 %7
}