xunge/DecIR huggingface dataset:
int to_lower(char *s) {
  int i = 0;
  while (*s != '\0') {
    if (*s > 'A' && *s < 'Z') {
      *s += 32;
      i++;
    }
    s++;
  }
  return i;
}


x86 assembly (clang, -O0):
<to_lower>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1165 <to_lower+0x65>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jle    1154 <to_lower+0x54>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jge    1154 <to_lower+0x54>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
add    $0x20,%ecx
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <to_lower+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_lower>:
mov    (%rdi),%cl
test   %cl,%cl
je     112f <to_lower+0x2f>
add    $0x1,%rdi
xor    %eax,%eax
jmp    111b <to_lower+0x1b>
xchg   %ax,%ax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
je     112e <to_lower+0x2e>
lea    -0x42(%rcx),%edx
cmp    $0x17,%dl
ja     1110 <to_lower+0x10>
add    $0x20,%cl
mov    %cl,-0x1(%rdi)
add    $0x1,%eax
jmp    1110 <to_lower+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @to_lower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1, %13
%5 = phi i8 [ %16, %13 ], [ %2, %1 ]
%6 = phi i32 [ %14, %13 ], [ 0, %1 ]
%7 = phi i8* [ %15, %13 ], [ %0, %1 ]
%8 = add i8 %5, -66
%9 = icmp ult i8 %8, 24
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = add nuw nsw i8 %5, 32
store i8 %11, i8* %7
%12 = add nsw i32 %6, 1
br label %13
13: ; preds = %10, %4
%14 = phi i32 [ %12, %10 ], [ %6, %4 ]
%15 = getelementptr inbounds i8, i8* %7, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %4
18: ; preds = %13, %1
%19 = phi i32 [ 0, %1 ], [ %14, %13 ]
ret i32 %19
}
/* Variables and functions */
int bar();
int /*<<< orphan*/ printf(char *);
int main(void) {
  int v = bar();
  if (v == 42) {
    printf("Ok\n");
    return 0;
  }
  printf("FAIL\n");
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <bar@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x2a,-0x8(%rbp)
jne    115b <main+0x3b>
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    116e <main+0x4e>
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <bar@plt>
xor    %ebx,%ebx
cmp    $0x2a,%eax
setne  %bl
lea    0xece(%rip),%rax
lea    0xec2(%rip),%rdi
cmove  %rax,%rdi
neg    %ebx
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@str = [5 x i8] c"FAIL\00"
@str.2 = [3 x i8] c"Ok\00"
define i32 @main() {
%1 = tail call i32 (...) @bar()
%2 = icmp eq i32 %1, 42
%3 = select i1 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0)
%4 = xor i1 %2, true
%5 = sext i1 %4 to i32
%6 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret i32 %5
}
double c2(float x, short y, int z) { return z ? x + x : y; }


x86 assembly (clang, -O0):
<c2>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
movss  %xmm0,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1131 <c2+0x31>
movss  -0x4(%rbp),%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    113e <c2+0x3e>
movswl -0x6(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2>:
test   %esi,%esi
je     110d <c2+0xd>
addss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
ret
xorps  %xmm0,%xmm0
cvtsi2ss %edi,%xmm0
cvtss2sd %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @c2(float %0, i16 signext %1, i32 %2) {
%4 = alloca float
%5 = alloca i16
%6 = alloca i32
store float %0, float* %4
store i16 %1, i16* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load float, float* %4
%11 = load float, float* %4
%12 = fadd float %10, %11
br label %17
13: ; preds = %3
%14 = load i16, i16* %5
%15 = sext i16 %14 to i32
%16 = sitofp i32 %15 to float
br label %17
17: ; preds = %13, %9
%18 = phi float [ %12, %9 ], [ %16, %13 ]
%19 = fpext float %18 to double
ret double %19
}

LLVM IR (-O2):
define double @c2(float %0, i16 signext %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = fadd float %0, %0
%6 = sitofp i16 %1 to float
%7 = select i1 %4, float %6, float %5
%8 = fpext float %7 to double
ret double %8
}
int fun107() { return 107; }


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

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

LLVM IR (-O0):
define i32 @fun107() {
ret i32 107
}

LLVM IR (-O2):
define i32 @fun107() {
ret i32 107
}
/* Variables and functions */
double __datand(double);
double d_atand(double *x) { return (__datand(*x)); }


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

x86 assembly (clang, -O2):
<d_atand>:
movsd  (%rdi),%xmm0
jmp    1030 <__datand@plt>

LLVM IR (-O0):
define double @d_atand(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = load double, double* %3
%5 = call double @__datand(double %4)
ret double %5
}

LLVM IR (-O2):
define double @d_atand(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @__datand(double %2)
ret double %3
}
const char *my_queue_mb_impl_type(void) { return ("memory barrier"); }


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

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

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

LLVM IR (-O2):
@.str = [15 x i8] c"memory barrier\00"
define i8* @my_queue_mb_impl_type() {
ret i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
}
void v3i(vec) long vec[3];
{
  float v[3];
  v[0] = vec[0];
  v[1] = vec[1];
  v[2] = vec[2];
  vcall(v, 3);
}


x86 assembly (clang, -O0):
<v3i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2ssq (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2ssq 0x8(%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2ssq 0x10(%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <vcall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3i>:
sub    $0x18,%rsp
cvtsi2ssq (%rdi),%xmm0
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ssq 0x8(%rdi),%xmm0
movss  %xmm0,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ssq 0x10(%rdi),%xmm0
movss  %xmm0,0x14(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <vcall@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @v3i(i64* %0) {
%2 = alloca i64*
%3 = alloca [3 x float]
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = getelementptr inbounds i64, i64* %4, i64 0
%6 = load i64, i64* %5
%7 = sitofp i64 %6 to float
%8 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
store float %7, float* %8
%9 = load i64*, i64** %2
%10 = getelementptr inbounds i64, i64* %9, i64 1
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to float
%13 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 1
store float %12, float* %13
%14 = load i64*, i64** %2
%15 = getelementptr inbounds i64, i64* %14, i64 2
%16 = load i64, i64* %15
%17 = sitofp i64 %16 to float
%18 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 2
store float %17, float* %18
%19 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%20 = call i32 (float*, i32, ...) bitcast (i32 (...)* @vcall to i32 (float*, i32, ...)*)(float* %19, i32 3)
ret void
}

LLVM IR (-O2):
define void @v3i(i64* nocapture %0) {
%2 = alloca [3 x float]
%3 = bitcast [3 x float]* %2 to i8*
%4 = load i64, i64* %0
%5 = sitofp i64 %4 to float
%6 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
store float %5, float* %6
%7 = getelementptr inbounds i64, i64* %0, i64 1
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to float
%10 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 1
store float %9, float* %10
%11 = getelementptr inbounds i64, i64* %0, i64 2
%12 = load i64, i64* %11
%13 = sitofp i64 %12 to float
%14 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 2
store float %13, float* %14
%15 = call i32 (float*, i32, ...) bitcast (i32 (...)* @vcall to i32 (float*, i32, ...)*)(float* %6, i32 3)
ret void
}
/* Type definitions */
struct bpf_prog {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ bpf_jit_free(struct bpf_prog *);
void bpf_prog_free(struct bpf_prog *fp) { bpf_jit_free(fp); }


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

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

LLVM IR (-O0):
%struct.bpf_prog = type { i32 }
define void @bpf_prog_free(%struct.bpf_prog* %0) {
%2 = alloca %struct.bpf_prog*
store %struct.bpf_prog* %0, %struct.bpf_prog** %2
%3 = load %struct.bpf_prog*, %struct.bpf_prog** %2
%4 = call i32 @bpf_jit_free(%struct.bpf_prog* %3)
ret void
}

LLVM IR (-O2):
%struct.bpf_prog = type { i32 }
define void @bpf_prog_free(%struct.bpf_prog* %0) {
%2 = tail call i32 @bpf_jit_free(%struct.bpf_prog* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc < 2) {
    printf("\nThere's no argument!!");
    return -1;
  }
  printf("\nArgument string > %s", argv[1]);
  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)
jge    114a <main+0x3a>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <main+0x57>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jg     112b <main+0x1b>
lea    0xee3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%ebx
jmp    113f <main+0x2f>
mov    0x8(%rsi),%rsi
lea    0xee1(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0AThere's no argument!!\00"
@.str.1 = [22 x i8] c"\0AArgument string > %s\00"
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 slt i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %13)
store i32 0, i32* %3
br label %15
15: ; preds = %10, %8
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0AThere's no argument!!\00"
@.str.1 = [22 x i8] c"\0AArgument string > %s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ -1, %4 ], [ 0, %6 ]
ret i32 %11
}
unsigned is_pow2(unsigned n) { return (n & (n - 1)) == 0; }


x86 assembly (clang, -O0):
<is_pow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_pow2>:
lea    -0x1(%rdi),%ecx
xor    %eax,%eax
test   %ecx,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_pow2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = sub i32 %4, 1
%6 = and i32 %3, %5
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_pow2(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
%3 = icmp ult i32 %2, 2
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_6Fuint16_reg(unsigned short val) {
  return ((val) & (0x6F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Fuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x6f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_6Fuint16_reg>:
test   $0x6f,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_6Fuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 111
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SensorReg_SaveConfig();
void SensorReg_Sleep(void) { SensorReg_SaveConfig(); }


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

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

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

LLVM IR (-O2):
define void @SensorReg_Sleep() {
%1 = tail call i32 (...) @SensorReg_SaveConfig()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "usage: lockf [-kns] [-t seconds] file command [arguments]\n");
  exit(EX_USAGE);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"usage: lockf [-kns] [-t seconds] file command [arguments]\0A\00"
@EX_USAGE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"usage: lockf [-kns] [-t seconds] file command [arguments]\0A\00"
@EX_USAGE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
unsigned char crc16_high(unsigned short crc) { return crc >> 8; }


x86 assembly (clang, -O0):
<crc16_high>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc16_high>:
mov    %edi,%eax
shr    $0x8,%eax
ret

LLVM IR (-O0):
define zeroext i8 @crc16_high(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @crc16_high(i16 zeroext %0) {
%2 = lshr i16 %0, 8
%3 = trunc i16 %2 to i8
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ zsim_magic_op(int);
void zsim_work_begin() { zsim_magic_op((1029)); }


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

x86 assembly (clang, -O2):
<zsim_work_begin>:
mov    $0x405,%edi
jmp    1030 <zsim_magic_op@plt>

LLVM IR (-O0):
define void @zsim_work_begin() {
%1 = call i32 @zsim_magic_op(i32 1029)
ret void
}

LLVM IR (-O2):
define void @zsim_work_begin() {
%1 = tail call i32 @zsim_magic_op(i32 1029)
ret void
}
int is_empty(const char *line) {
  char *tmp = (char *)line;
  int i = 0;
  while (tmp[i] != '\0') {
    if (tmp[i] > ' ')
      return 0;
    i++;
  }
  return 34;
}


x86 assembly (clang, -O0):
<is_empty>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115b <is_empty+0x5b>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jle    114d <is_empty+0x4d>
movl   $0x0,-0x4(%rbp)
jmp    1162 <is_empty+0x62>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <is_empty+0x17>
movl   $0x22,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_empty>:
mov    (%rdi),%cl
mov    $0x22,%eax
test   %cl,%cl
je     1120 <is_empty+0x20>
add    $0x1,%rdi
nop
cmp    $0x21,%cl
jge    1121 <is_empty+0x21>
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <is_empty+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_empty(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %8
4: ; preds = %8
%5 = getelementptr inbounds i8, i8* %0, i64 %12
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %1, %4
%9 = phi i64 [ %12, %4 ], [ 0, %1 ]
%10 = phi i8 [ %6, %4 ], [ %2, %1 ]
%11 = icmp sgt i8 %10, 32
%12 = add nuw i64 %9, 1
br i1 %11, label %13, label %4
13: ; preds = %8, %4, %1
%14 = phi i32 [ 34, %1 ], [ 34, %4 ], [ 0, %8 ]
ret i32 %14
}
int test_imm_EEuint16_reg(unsigned short val) {
  return ((val) & (-0xEE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_EEuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff12,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_EEuint16_reg>:
test   $0xff12,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_EEuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -238
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ render_thread(void *, int);
void render_thread_2(void *param) { render_thread(param, 1); }


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

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

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

LLVM IR (-O2):
define void @render_thread_2(i8* %0) {
%2 = tail call i32 @render_thread(i8* %0, i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int IPC_CREAT;
int /*<<< orphan*/ handle_fatal_error(char *);
int msgget(int /*<<< orphan*/, int);
int get_msgq_id(key_t key) {
  int msgq_id;
  int msg_flag;
  msg_flag = IPC_CREAT | 0666;
  msgq_id = msgget(key, msg_flag);
  if (msgq_id < 0) {
    handle_fatal_error("Error using msgget()\n");
  }
  return msgq_id;
}


x86 assembly (clang, -O0):
<get_msgq_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
or     $0x1b6,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <msgget@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1160 <get_msgq_id+0x40>
lea    0xea5(%rip),%rdi
call   1040 <handle_fatal_error@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_msgq_id>:
push   %rbx
mov    0x2eb8(%rip),%rax
mov    $0x1b6,%esi
or     (%rax),%esi
call   1030 <msgget@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1146 <get_msgq_id+0x26>
lea    0xebf(%rip),%rdi
call   1040 <handle_fatal_error@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@IPC_CREAT = global i32 0
@.str = [22 x i8] c"Error using msgget()\0A\00"
define i32 @get_msgq_id(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* @IPC_CREAT
%6 = or i32 %5, 438
store i32 %6, i32* %4
%7 = load i32, i32* %2
%8 = load i32, i32* %4
%9 = call i32 @msgget(i32 %7, i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %1
%13 = call i32 @handle_fatal_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %1
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@IPC_CREAT = global i32 0
@.str = [22 x i8] c"Error using msgget()\0A\00"
define i32 @get_msgq_id(i32 %0) {
%2 = load i32, i32* @IPC_CREAT
%3 = or i32 %2, 438
%4 = tail call i32 @msgget(i32 %0, i32 %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @handle_fatal_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret i32 %4
}
long soma_digitos(int n) {
  if (n < 10)
    return n;
  return n % 10 + soma_digitos(n / 10);
}


x86 assembly (clang, -O0):
<soma_digitos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1132 <soma_digitos+0x22>
movslq -0xc(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1164 <soma_digitos+0x54>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <soma_digitos@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<soma_digitos>:
xor    %ecx,%ecx
cmp    $0xa,%edi
jl     112e <soma_digitos+0x2e>
mov    $0xcccccccd,%r8d
mov    %edi,%edx
nop
mov    %edx,%edi
imul   %r8,%rdi
shr    $0x23,%rdi
lea    (%rdi,%rdi,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%eax
sub    %esi,%eax
add    %rax,%rcx
cmp    $0x64,%edx
mov    %edi,%edx
jae    1110 <soma_digitos+0x10>
movslq %edi,%rax
add    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @soma_digitos(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %3, label %8
3: ; preds = %8, %1
%4 = phi i64 [ 0, %1 ], [ %14, %8 ]
%5 = phi i32 [ %0, %1 ], [ %13, %8 ]
%6 = sext i32 %5 to i64
%7 = add nsw i64 %4, %6
ret i64 %7
8: ; preds = %1, %8
%9 = phi i32 [ %13, %8 ], [ %0, %1 ]
%10 = phi i64 [ %14, %8 ], [ 0, %1 ]
%11 = urem i32 %9, 10
%12 = zext i32 %11 to i64
%13 = udiv i32 %9, 10
%14 = add nuw nsw i64 %10, %12
%15 = icmp ult i32 %9, 100
br i1 %15, label %3, label %8
}
/* Variables and functions */
int /*<<< orphan*/ mock_push(int /*<<< orphan*/);
int /*<<< orphan*/ pack_glFlush(int /*<<< orphan*/ *);
void gles_glFlush() {
  { mock_push(pack_glFlush(NULL)); };
}


x86 assembly (clang, -O0):
<gles_glFlush>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pack_glFlush@plt>
mov    %eax,%edi
call   1030 <mock_push@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @gles_glFlush() {
%1 = call i32 @pack_glFlush(i32* null)
%2 = call i32 @mock_push(i32 %1)
ret void
}

LLVM IR (-O2):
define void @gles_glFlush() {
%1 = tail call i32 @pack_glFlush(i32* null)
%2 = tail call i32 @mock_push(i32 %1)
ret void
}
int SCE_Math_PowerOfTwo(unsigned int n) { return (!(n & (n - 1)) && n); }


x86 assembly (clang, -O0):
<SCE_Math_PowerOfTwo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
and    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x5(%rbp)
jne    112a <SCE_Math_PowerOfTwo+0x2a>
cmpl   $0x0,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCE_Math_PowerOfTwo>:
lea    -0x1(%rdi),%eax
test   %eax,%edi
sete   %al
test   %edi,%edi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @SCE_Math_PowerOfTwo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = sub i32 %4, 1
%6 = and i32 %3, %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 0
br label %11
11: ; preds = %8, %1
%12 = phi i1 [ false, %1 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @SCE_Math_PowerOfTwo(i32 %0) {
%2 = tail call i32 @llvm.ctpop.i32(i32 %0)
%3 = icmp eq i32 %2, 1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int htonl(int);
int ntohl(int);
uint64_t ntohll(uint64_t n) {
  return htonl(1) == 1 ? n : ((uint64_t)ntohl(n) << 32) | ntohl(n >> 32);
}


x86 assembly (clang, -O0):
<ntohll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <htonl@plt>
cmp    $0x1,%eax
jne    1149 <ntohll+0x29>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <ntohll+0x54>
mov    -0x4(%rbp),%edi
call   1040 <ntohl@plt>
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1040 <ntohl@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
or     %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntohll>:
push   %rbx
mov    %edi,%ebx
mov    $0x1,%edi
call   1030 <htonl@plt>
cmp    $0x1,%eax
je     113e <ntohll+0x1e>
mov    %ebx,%edi
call   1040 <ntohl@plt>
call   1040 <ntohl@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ntohll(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @htonl(i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i32, i32* %2
br label %15
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @ntohl(i32 %8)
%10 = shl i32 %9, 32
%11 = load i32, i32* %2
%12 = ashr i32 %11, 32
%13 = call i32 @ntohl(i32 %12)
%14 = or i32 %10, %13
br label %15
15: ; preds = %7, %5
%16 = phi i32 [ %6, %5 ], [ %14, %7 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @ntohll(i32 returned %0) {
%2 = tail call i32 @htonl(i32 1)
%3 = icmp eq i32 %2, 1
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i32 @ntohl(i32 %0)
%6 = tail call i32 @ntohl(i32 poison)
br label %7
7: ; preds = %1, %4
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ mem_copy_vect2dword_big(int /*<<< orphan*/ *,
                                           unsigned char const *);
uint32_t arch_mem_copy_vect2dword_big(uint32_t *dword, const unsigned char *v) {
  return mem_copy_vect2dword_big(dword, v);
}


x86 assembly (clang, -O0):
<arch_mem_copy_vect2dword_big>:
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 <mem_copy_vect2dword_big@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @arch_mem_copy_vect2dword_big(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 @mem_copy_vect2dword_big(i32* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @arch_mem_copy_vect2dword_big(i32* %0, i8* %1) {
%3 = tail call i32 @mem_copy_vect2dword_big(i32* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
void pgtrace_start(void) {}


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

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

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

LLVM IR (-O2):
define void @pgtrace_start() {
ret void
}
int square(int n) {
  int sq;
  sq = n * n;
  if (n < 0) {
    sq = -sq;
  }
  return sq;
}


x86 assembly (clang, -O0):
<square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1123 <square+0x23>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<square>:
mov    %edi,%ecx
imul   %edi,%ecx
mov    %ecx,%eax
neg    %eax
test   %edi,%edi
cmovns %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @square(i32 %0) {
%2 = mul nsw i32 %0, %0
%3 = icmp slt i32 %0, 0
%4 = sub nsw i32 0, %2
%5 = select i1 %3, i32 %4, i32 %2
ret i32 %5
}
int fct(void) {}


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

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

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

LLVM IR (-O2):
define i32 @fct() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ C_SOFT_RESET();
void Return_Case(void) {
  C_SOFT_RESET();
  return;
}


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

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

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

LLVM IR (-O2):
define void @Return_Case() {
%1 = tail call i32 (...) @C_SOFT_RESET()
ret void
}
const void *cast_to_const_void_ptr(const void *p) { return p; }


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

x86 assembly (clang, -O2):
<cast_to_const_void_ptr>:
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @cast_to_const_void_ptr(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ unlink(char const *);
void clr_pid(const char *pidfile) { unlink(pidfile); }


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

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

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

LLVM IR (-O2):
define void @clr_pid(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ vasprintf(char **, char const *, int /*<<< orphan*/);
char *xvasprintf(const char *fmt, va_list ap) {
  char *strp = NULL;
  if (vasprintf(&strp, fmt, ap) < 0)
    abort();
  return strp;
}


x86 assembly (clang, -O0):
<xvasprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    -0x18(%rbp),%rdi
call   1040 <vasprintf@plt>
cmp    $0x0,%rax
jge    1158 <xvasprintf+0x38>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xvasprintf>:
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   1040 <vasprintf@plt>
test   %rax,%rax
js     1141 <xvasprintf+0x21>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @xvasprintf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i8* null, i8** %5
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i64 @vasprintf(i8** %5, i8* %6, i32 %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %2
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
define i8* @xvasprintf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = call i64 @vasprintf(i8** %3, i8* %0, i32 %1)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %2
%10 = load i8*, i8** %3
ret i8* %10
}
int main() {
  int arg1 = 40;
  int arg2 = 2;
  int quot = 0;
  __asm__("idivl %%ebx;" : "=a"(quot) : "a"(arg1), "d"(0), "b"(arg2));
  return quot;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
movl   $0x0,-0xc(%rbp)
movl   $0x28,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ebx
xor    %edx,%edx
idiv   %ebx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x28,%eax
xor    %edx,%edx
mov    $0x2,%ebx
idiv   %ebx
pop    %rbx
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 40, i32* %2
store i32 2, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 asm "idivl %ebx;", "={ax},{ax},{dx},{bx},~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 0, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 asm "idivl %ebx;", "={ax},{ax},{dx},{bx},~{dirflag},~{fpsr},~{flags}"(i32 40, i32 0, i32 2)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *cmd) {
  printf("Calculate A/D lookup table for NTC thermistor / resistor voltage "
         "divider network\n");
  printf("using temperature-resstance data points from a file for the "
         "thermistor as input.\n");
  printf("Usage: %s [-r R0 (default=10000.0 ohm)] [-m AD_MAX (default=1024)] "
         "[-s AD_STEP (default=32)] filename\n",
         cmd);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xf61(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xf3c(%rip),%rdi
call   1030 <puts@plt>
lea    0xf81(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [82 x i8] c"Calculate A/D lookup table for NTC thermistor / resistor voltage divider network\0A\00"
@.str.1 = [82 x i8] c"using temperature-resstance data points from a file for the thermistor as input.\0A\00"
@.str.2 = [103 x i8] c"Usage: %s [-r R0 (default=10000.0 ohm)] [-m AD_MAX (default=1024)] [-s AD_STEP (default=32)] filename\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str.1, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([103 x i8], [103 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str.2 = [103 x i8] c"Usage: %s [-r R0 (default=10000.0 ohm)] [-m AD_MAX (default=1024)] [-s AD_STEP (default=32)] filename\0A\00"
@str = [81 x i8] c"Calculate A/D lookup table for NTC thermistor / resistor voltage divider network\00"
@str.3 = [81 x i8] c"using temperature-resstance data points from a file for the thermistor as input.\00"
define void @usage(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
void COM_StripExtension(char *in, char *out) {
  while (*in && *in != '.')
    *out++ = *in++;
  *out = 0;
}


x86 assembly (clang, -O0):
<COM_StripExtension>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1131 <COM_StripExtension+0x31>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1141 <COM_StripExtension+0x41>
jmp    1168 <COM_StripExtension+0x68>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
jmp    110c <COM_StripExtension+0xc>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<COM_StripExtension>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
test   %cl,%cl
je     1126 <COM_StripExtension+0x26>
cmp    $0x2e,%cl
je     1126 <COM_StripExtension+0x26>
mov    %cl,(%rsi,%rax,1)
add    $0x1,%rax
jmp    1110 <COM_StripExtension+0x10>
movb   $0x0,(%rsi,%rax,1)
ret

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

LLVM IR (-O2):
define void @COM_StripExtension(i8* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %0, %2 ], [ %8, %7 ]
%5 = phi i8* [ %1, %2 ], [ %9, %7 ]
%6 = load i8, i8* %4
switch i8 %6, label %7 [
i8 0, label %10
i8 46, label %10
]
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %6, i8* %5
br label %3
10: ; preds = %3, %3
store i8 0, i8* %5
ret void
}
DECLARE_INTERFACE_(IElgatoVideoCaptureFilter, IUnknown) {}


x86 assembly (clang, -O0):
<DECLARE_INTERFACE_>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @DECLARE_INTERFACE_(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ posix_acl_xxx_hash_init();
int posix_acl_init(void) {
  posix_acl_xxx_hash_init();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @posix_acl_init() {
%1 = tail call i32 (...) @posix_acl_xxx_hash_init()
ret i32 0
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ fill_to_end(char *, int);
int /*<<< orphan*/ free(char *);
char *line_reading(int);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *bufLine = line_reading(21);
  printf("Line before\n%s", bufLine);
  fill_to_end(bufLine, 21);
  printf("\nLine after\n%s", bufLine);
  free(bufLine);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x15,%edi
call   1060 <line_reading@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    $0x15,%esi
call   1050 <fill_to_end@plt>
mov    -0x10(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e45(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x15,%edi
call   1060 <line_reading@plt>
mov    %rax,%rbx
lea    0xeab(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x15,%esi
call   1050 <fill_to_end@plt>
lea    0xe9e(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Line before\0A%s\00"
@.str.1 = [15 x i8] c"\0ALine after\0A%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @line_reading(i32 21)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i8*, i8** %2
%7 = call i32 @fill_to_end(i8* %6, i32 21)
%8 = load i8*, i8** %2
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @free(i8* %10)
%12 = load i32, i32* @EXIT_SUCCESS
ret i32 %12
}

LLVM IR (-O2):
@.str = [15 x i8] c"Line before\0A%s\00"
@.str.1 = [15 x i8] c"\0ALine after\0A%s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i8* @line_reading(i32 21)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %1)
%3 = tail call i32 @fill_to_end(i8* %1, i32 21)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%5 = tail call i32 @free(i8* %1)
%6 = load i32, i32* @EXIT_SUCCESS
ret i32 %6
}