xunge/DecIR huggingface dataset:
/* Variables and functions */
int partition(int *, int, int);
void quicksort(int *a, int p, int r, char *str) {
  if (p < r) {
    int q = partition(a, p, r);
    quicksort(a, p, (q - 1), "left");
    quicksort(a, (q + 1), r, "right");
  }
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1186 <quicksort+0x66>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
lea    0xe98(%rip),%rcx
call   1040 <quicksort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
lea    0xe84(%rip),%rcx
call   1040 <quicksort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quicksort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quicksort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quicksort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"left\00"
@.str.1 = [6 x i8] c"right\00"
define void @quicksort(i32* %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %26
13: ; preds = %4
%14 = load i32*, i32** %5
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = call i32 @partition(i32* %14, i32 %15, i32 %16)
store i32 %17, i32* %9
%18 = load i32*, i32** %5
%19 = load i32, i32* %6
%20 = load i32, i32* %9
%21 = sub nsw i32 %20, 1
%22 = load i32*, i32** %5
%23 = load i32, i32* %9
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %7
br label %26
26: ; preds = %13, %4
ret void
}

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1, i32 %2, i8* nocapture readnone %3) {
%5 = icmp slt i32 %1, %2
br i1 %5, label %6, label %12
6: ; preds = %4, %6
%7 = phi i32 [ %10, %6 ], [ %1, %4 ]
%8 = tail call i32 @partition(i32* %0, i32 %7, i32 %2)
%9 = add nsw i32 %8, -1
tail call void @quicksort(i32* %0, i32 %7, i32 %9, i8* undef)
%10 = add nsw i32 %8, 1
%11 = icmp slt i32 %10, %2
br i1 %11, label %6, label %12
12: ; preds = %6, %4
ret void
}
/* Variables and functions */
char *optarg;
char *octave_optarg_wrapper(void) { return optarg; }


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

x86 assembly (clang, -O2):
<octave_optarg_wrapper>:
mov    0x2ef1(%rip),%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
@optarg = global i8* null
define i8* @octave_optarg_wrapper() {
%1 = load i8*, i8** @optarg
ret i8* %1
}

LLVM IR (-O2):
@optarg = global i8* null
define i8* @octave_optarg_wrapper() {
%1 = load i8*, i8** @optarg
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int metil_mpi_send(void *buf, int count, int dest, int tag) { assert(0); }


x86 assembly (clang, -O0):
<metil_mpi_send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<metil_mpi_send>:
xor    %edi,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
define i32 @metil_mpi_send(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
%10 = call i32 @assert(i32 0)
%11 = load i32, i32* %5
ret i32 %11
}

LLVM IR (-O2):
define i32 @metil_mpi_send(i8* nocapture readnone %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @assert(i32 0)
ret i32 undef
}
int test_imm_48int8_reg(signed char val) {
  return ((val) & (-0x48 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_48int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xffffffb8,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_48int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -72
%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_48int8_reg(i8 signext %0) {
%2 = and i8 %0, -72
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_imm_40int64_highword_reg(long long val) {
  return ((val >> 32) & (0x40 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_40int64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x20,%rdx
and    $0x40,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_40int64_highword_reg>:
bt     $0x26,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_40int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 64
%6 = icmp ne i64 %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_40int64_highword_reg(i64 %0) {
%2 = and i64 %0, 274877906944
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_or_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_slli_epi64(int /*<<< orphan*/, unsigned int);
int /*<<< orphan*/ _mm_slli_si128(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_srli_epi64(int /*<<< orphan*/, int);
__m128i shift_left_in(__m128i a, unsigned num_bytes) {
  unsigned count = num_bytes * 8;
  __m128i result, tmp;
  result = _mm_slli_epi64(a, count);
  tmp = _mm_slli_si128(a, 8);
  tmp = _mm_srli_epi64(tmp, 64 - (count));
  result = _mm_or_si128(result, tmp);
  return result;
}


x86 assembly (clang, -O0):
<shift_left_in>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1060 <_mm_slli_epi64@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1050 <_mm_slli_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    $0x40,%esi
sub    -0xc(%rbp),%esi
call   1030 <_mm_srli_epi64@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1040 <_mm_or_si128@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift_left_in>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
shl    $0x3,%ebx
mov    %ebx,%esi
call   1060 <_mm_slli_epi64@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    $0x8,%esi
call   1050 <_mm_slli_si128@plt>
mov    $0x40,%esi
sub    %ebx,%esi
mov    %eax,%edi
call   1030 <_mm_srli_epi64@plt>
mov    %r14d,%edi
mov    %eax,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <_mm_or_si128@plt>

LLVM IR (-O0):
define i32 @shift_left_in(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %4
%9 = mul i32 %8, 8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %5
%12 = call i32 @_mm_slli_epi64(i32 %10, i32 %11)
store i32 %12, i32* %6
%13 = load i32, i32* %3
%14 = call i32 @_mm_slli_si128(i32 %13, i32 8)
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = load i32, i32* %5
%17 = sub i32 64, %16
%18 = call i32 @_mm_srli_epi64(i32 %15, i32 %17)
store i32 %18, i32* %7
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = call i32 @_mm_or_si128(i32 %19, i32 %20)
store i32 %21, i32* %6
%22 = load i32, i32* %6
ret i32 %22
}

LLVM IR (-O2):
define i32 @shift_left_in(i32 %0, i32 %1) {
%3 = shl i32 %1, 3
%4 = tail call i32 @_mm_slli_epi64(i32 %0, i32 %3)
%5 = tail call i32 @_mm_slli_si128(i32 %0, i32 8)
%6 = sub i32 64, %3
%7 = tail call i32 @_mm_srli_epi64(i32 %5, i32 %6)
%8 = tail call i32 @_mm_or_si128(i32 %4, i32 %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ CameraStabSettingsHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void CameraStabSettingsRequestUpdate() {
  UAVObjRequestUpdate(CameraStabSettingsHandle());
}


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

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

LLVM IR (-O0):
define void @CameraStabSettingsRequestUpdate() {
%1 = call i32 (...) @CameraStabSettingsHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @CameraStabSettingsRequestUpdate() {
%1 = tail call i32 (...) @CameraStabSettingsHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
double v_sprod(double *a, double *b) {
  return (a[0] * b[0] + a[1] * b[1] + a[2] * b[2]);
}


x86 assembly (clang, -O0):
<v_sprod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<v_sprod>:
movsd  0x8(%rdi),%xmm0
mulsd  0x8(%rsi),%xmm0
movsd  (%rdi),%xmm1
mulsd  (%rsi),%xmm1
addsd  %xmm0,%xmm1
movsd  0x10(%rdi),%xmm0
mulsd  0x10(%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @v_sprod(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = call double @llvm.fmuladd.f64(double %7, double %10, double %17)
%19 = load double*, double** %3
%20 = getelementptr inbounds double, double* %19, i64 2
%21 = load double, double* %20
%22 = load double*, double** %4
%23 = getelementptr inbounds double, double* %22, i64 2
%24 = load double, double* %23
%25 = call double @llvm.fmuladd.f64(double %21, double %24, double %18)
ret double %25
}

LLVM IR (-O2):
define double @v_sprod(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %1, i64 2
%14 = load double, double* %13
%15 = tail call double @llvm.fmuladd.f64(double %12, double %14, double %10)
ret double %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int public_func();
int main(int argc, char **argv) {
  if (public_func() != 42) {
    printf("Something failed.\n");
    return 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)
mov    $0x0,%al
call   1030 <public_func@plt>
cmp    $0x2a,%eax
je     115e <main+0x3e>
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1165 <main+0x45>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <public_func@plt>
cmp    $0x2a,%eax
je     1140 <main+0x20>
lea    0xeca(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Something failed.\0A\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 = call i32 (...) @public_func()
%7 = icmp ne i32 %6, 42
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %11
10: ; preds = %2
store i32 0, i32* %3
br label %11
11: ; preds = %10, %8
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@str = [18 x i8] c"Something failed.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @public_func()
%4 = icmp eq i32 %3, 42
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ 1, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ circ1(double, double, double);
int /*<<< orphan*/ default_line_gwt();
int /*<<< orphan*/ set_line_gwt(double, double, int);
void circ(double x1, double y1, double r1, double g, double w, int it) {
  set_line_gwt(g, w, it);
  circ1(x1, y1, r1);
  default_line_gwt();
  return;
}


x86 assembly (clang, -O0):
<circ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %edi,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
mov    -0x2c(%rbp),%edi
call   1030 <set_line_gwt@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1040 <circ1@plt>
mov    $0x0,%al
call   1050 <default_line_gwt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<circ>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
movaps %xmm3,%xmm0
movaps %xmm4,%xmm1
call   1030 <set_line_gwt@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
call   1040 <circ1@plt>
xor    %eax,%eax
add    $0x18,%rsp
jmp    1050 <default_line_gwt@plt>

LLVM IR (-O0):
define void @circ(double %0, double %1, double %2, double %3, double %4, i32 %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store i32 %5, i32* %12
%13 = load double, double* %10
%14 = load double, double* %11
%15 = load i32, i32* %12
%16 = call i32 @set_line_gwt(double %13, double %14, i32 %15)
%17 = load double, double* %7
%18 = load double, double* %8
%19 = load double, double* %9
%20 = call i32 @circ1(double %17, double %18, double %19)
%21 = call i32 (...) @default_line_gwt()
ret void
}

LLVM IR (-O2):
define void @circ(double %0, double %1, double %2, double %3, double %4, i32 %5) {
%7 = tail call i32 @set_line_gwt(double %3, double %4, i32 %5)
%8 = tail call i32 @circ1(double %0, double %1, double %2)
%9 = tail call i32 (...) @default_line_gwt()
ret void
}
int sum(int n, int m) { return n + m; }


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

x86 assembly (clang, -O2):
<sum>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @sum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
int test_imm_09int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x09 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_09int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 589824
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  scalar_t__ tm_year;
};

/* Variables and functions */
scalar_t__ leap(scalar_t__);
int /*<<< orphan*/ localtime_r(int /*<<< orphan*/ *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int days_this_year(void) {
  struct tm time_record;
  time_t current_time;
  time(&current_time);
  localtime_r(&current_time, &time_record);
  if (leap(time_record.tm_year + 1900)) {
    return 366;
  }
  return 365;
}


x86 assembly (clang, -O0):
<days_this_year>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x14(%rbp),%rdi
call   1050 <time@plt>
lea    -0x14(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x10(%rbp),%rdi
add    $0x76c,%rdi
call   1040 <leap@plt>
cmp    $0x0,%rax
je     1174 <days_this_year+0x44>
movl   $0x16e,-0x4(%rbp)
jmp    117b <days_this_year+0x4b>
movl   $0x16d,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<days_this_year>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <localtime_r@plt>
mov    $0x76c,%edi
add    (%rsp),%rdi
call   1040 <leap@plt>
cmp    $0x1,%rax
mov    $0x16e,%eax
sbb    $0x0,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i64 }
define i32 @days_this_year() {
%1 = alloca i32
%2 = alloca %struct.tm
%3 = alloca i32
%4 = call i32 @time(i32* %3)
%5 = call i32 @localtime_r(i32* %3, %struct.tm* %2)
%6 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%7 = load i64, i64* %6
%8 = add nsw i64 %7, 1900
%9 = call i64 @leap(i64 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %0
store i32 366, i32* %1
br label %13
12: ; preds = %0
store i32 365, i32* %1
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
%struct.tm = type { i64 }
define i32 @days_this_year() {
%1 = alloca %struct.tm
%2 = alloca i32
%3 = bitcast %struct.tm* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @time(i32* %2)
%6 = call i32 @localtime_r(i32* %2, %struct.tm* %1)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = add nsw i64 %8, 1900
%10 = call i64 @leap(i64 %9)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i32 365, i32 366
ret i32 %12
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned int button;
};
typedef TYPE_1__ XButtonReleasedEvent;

/* Variables and functions */
void set_XButtonReleasedEvent_button(void *_p, unsigned _v) {
  ((XButtonReleasedEvent *)_p)->button = (unsigned)_v;
}


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

x86 assembly (clang, -O2):
<set_XButtonReleasedEvent_button>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XButtonReleasedEvent_button(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XButtonReleasedEvent_button(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LOG_NOTICE;
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, char const *);
void log_message(const char *filename, const char *message) {
  syslog(LOG_NOTICE, "%s", message);
}


x86 assembly (clang, -O0):
<log_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xecc(%rip),%rsi
call   1030 <syslog@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_message>:
mov    %rsi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <syslog@plt>

LLVM IR (-O0):
@LOG_NOTICE = global i32 0
@.str = [3 x i8] c"%s\00"
define void @log_message(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @LOG_NOTICE
%6 = load i8*, i8** %4
%7 = call i32 @syslog(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@LOG_NOTICE = global i32 0
@.str = [3 x i8] c"%s\00"
define void @log_message(i8* nocapture readnone %0, i8* %1) {
%3 = load i32, i32* @LOG_NOTICE
%4 = tail call i32 @syslog(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  int n = 500;
  float number;
  scanf("%f", &number);
  printf("%.2f元", number * 500);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1f4,-0x8(%rbp)
lea    0xec7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  0xeb2(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
mulss  0xec0(%rip),%xmm0
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [8 x i8] c"%.2f\E5\85\83\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
store i32 500, i32* %2
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%5 = load float, float* %3
%6 = fmul float %5, 5.000000e+02
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), float %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [8 x i8] c"%.2f\E5\85\83\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fmul float %4, 5.000000e+02
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), float %5)
ret i32 0
}
/* Variables and functions */
int memcmp(void *, void *, int);
int dlist_match(const void *data1, const void *data2) {
  int res = 0;
  res = memcmp((void *)data1, (void *)data2, sizeof(int));
  return res == 0 ? 1 : 0;
}


x86 assembly (clang, -O0):
<dlist_match>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlist_match>:
push   %rax
mov    $0x4,%edx
call   1030 <memcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @dlist_match(i8* %0, i8* %1) {
%3 = tail call i32 @memcmp(i8* %0, i8* %1, i32 4)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memfatal(char *, scalar_t__);
char *strdup(char const *);
scalar_t__ strlen(char const *);
char *checking_strdup(const char *s) {
  char *copy;
  copy = strdup(s);
  if (!copy)
    memfatal("strdup", 1 + strlen(s));
  return copy;
}


x86 assembly (clang, -O0):
<checking_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1170 <checking_strdup+0x40>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
add    $0x1,%rsi
lea    0xe95(%rip),%rdi
call   1040 <memfatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checking_strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    115c <checking_strdup+0x2c>
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    0x1(%rax),%rsi
lea    0xea9(%rip),%rdi
call   1040 <memfatal@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [7 x i8] c"strdup\00"
define i8* @checking_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 1, %10
%12 = call i32 @memfatal(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %11)
br label %13
13: ; preds = %8, %1
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
@.str = [7 x i8] c"strdup\00"
define noalias i8* @checking_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add nsw i64 %5, 1
%7 = tail call i32 @memfatal(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %6)
br label %8
8: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ pthread_detach(int /*<<< orphan*/);
int /*<<< orphan*/ pthread_exit(void *);
int /*<<< orphan*/ pthread_self();
void *thread(void *vargp) {
  pthread_detach(pthread_self());
  pthread_exit((void *)42);
}


x86 assembly (clang, -O0):
<thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %eax,%edi
call   1040 <pthread_detach@plt>
mov    $0x2a,%edi
call   1030 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread>:
push   %rax
xor    %eax,%eax
call   1050 <pthread_self@plt>
mov    %eax,%edi
call   1040 <pthread_detach@plt>
mov    $0x2a,%edi
pop    %rax
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
define i8* @thread(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @pthread_self()
%5 = call i32 @pthread_detach(i32 %4)
%6 = call i32 @pthread_exit(i8* inttoptr (i64 42 to i8*))
%7 = load i8*, i8** %2
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @thread(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @pthread_self()
%3 = tail call i32 @pthread_detach(i32 %2)
%4 = tail call i32 @pthread_exit(i8* inttoptr (i64 42 to i8*))
ret i8* undef
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ getppid();
void test(void) {
  pid_t pid;
  pid = getppid();
}


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

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

LLVM IR (-O0):
define void @test() {
%1 = alloca i32
%2 = call i32 (...) @getppid()
store i32 %2, i32* %1
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 (...) @getppid()
ret void
}
void TRACE_ALLOC_ENTER(const char *const func_name) {}


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

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

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

LLVM IR (-O2):
define void @TRACE_ALLOC_ENTER(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int main() {
  int *p = NULL;
  *p = 0xdead;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0xdead,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
store i32* null, i32** %2
%3 = load i32*, i32** %2
store i32 57005, i32* %3
ret i32 0
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ putc(char);
__attribute__((optimize(0))) void stacksmash() {
  putc('A');
  char buffer[10];
  memcpy(buffer, (char *)"AAAAAAAAAAAAAAABBBB", 20);
  putc('B');
  putc('\n');
}


x86 assembly (clang, -O0):
<stacksmash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x41,%edi
call   1030 <putc@plt>
lea    -0xa(%rbp),%rdi
lea    0xec3(%rip),%rsi
mov    $0x14,%edx
call   1040 <memcpy@plt>
mov    $0x42,%edi
call   1030 <putc@plt>
mov    $0xa,%edi
call   1030 <putc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stacksmash>:
sub    $0x18,%rsp
mov    $0x41,%edi
call   1030 <putc@plt>
lea    0xecb(%rip),%rsi
lea    0xe(%rsp),%rdi
mov    $0x14,%edx
call   1040 <memcpy@plt>
mov    $0x42,%edi
call   1030 <putc@plt>
mov    $0xa,%edi
call   1030 <putc@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"AAAAAAAAAAAAAAABBBB\00"
define void @stacksmash() {
%1 = alloca [10 x i8]
%2 = call i32 @putc(i8 signext 65)
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 @memcpy(i8* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 20)
%5 = call i32 @putc(i8 signext 66)
%6 = call i32 @putc(i8 signext 10)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"AAAAAAAAAAAAAAABBBB\00"
define void @stacksmash() {
%1 = alloca [10 x i8]
%2 = tail call i32 @putc(i8 signext 65)
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 @memcpy(i8* %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 20)
%5 = call i32 @putc(i8 signext 66)
%6 = call i32 @putc(i8 signext 10)
ret void
}
void rop3_45_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~*D;
  stk2 = S | stk3;
  stk1 = T ^ stk2;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_45_0_0>:
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
movzbl (%rax),%eax
xor    $0xffffffff,%eax
mov    %al,-0xd(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_45_0_0>:
mov    (%rdi),%al
not    %al
or     %sil,%al
xor    %dl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_45_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = xor i32 %12, -1
%14 = trunc i32 %13 to i8
store i8 %14, i8* %9
%15 = load i8, i8* %5
%16 = zext i8 %15 to i32
%17 = load i8, i8* %9
%18 = zext i8 %17 to i32
%19 = or i32 %16, %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %8
%21 = load i8, i8* %6
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = xor i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = load i8*, i8** %4
store i8 %27, i8* %28
ret void
}

LLVM IR (-O2):
define void @rop3_45_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = xor i8 %4, -1
%6 = or i8 %5, %1
%7 = xor i8 %6, %2
store i8 %7, i8* %0
ret void
}
/* Variables and functions */
int syscall4(int, unsigned int, short, short);
int chown(const char *path, short owner, short group) {
  return syscall4(182, (unsigned int)path, owner, group);
}


x86 assembly (clang, -O0):
<chown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dx,%ax
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
mov    -0xa(%rbp),%ax
mov    $0xb6,%edi
movswl %ax,%edx
movswl -0xc(%rbp),%ecx
call   1030 <syscall4@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chown>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
mov    $0xb6,%edi
jmp    1030 <syscall4@plt>

LLVM IR (-O0):
define i32 @chown(i8* %0, i16 signext %1, i16 signext %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
store i8* %0, i8** %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%7 = load i8*, i8** %4
%8 = ptrtoint i8* %7 to i32
%9 = load i16, i16* %5
%10 = load i16, i16* %6
%11 = call i32 @syscall4(i32 182, i32 %8, i16 signext %9, i16 signext %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @chown(i8* %0, i16 signext %1, i16 signext %2) {
%4 = ptrtoint i8* %0 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @syscall4(i32 182, i32 %5, i16 signext %1, i16 signext %2)
ret i32 %6
}
/* Type definitions */
typedef char *uint32_t;

/* Variables and functions */
uint32_t function() {
  uint32_t result;
  __asm__ volatile("smc_address:			\n"
                   "	mov $0xbadcaffe, %%eax	\n"
                   : "=a"(result));
  return result;
}


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

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

LLVM IR (-O0):
define i8* @function() {
%1 = alloca i8*
%2 = call i8* asm sideeffect "smc_address:\09\09\09\0A\09mov $$0xbadcaffe, %eax\09\0A", "={ax},~{dirflag},~{fpsr},~{flags}"()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
define i8* @function() {
%1 = tail call i8* asm sideeffect "smc_address:\09\09\09\0A\09mov $$0xbadcaffe, %eax\09\0A", "={ax},~{dirflag},~{fpsr},~{flags}"()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int closeUSBDriver(int file_handle) {
  int ret;
  ret = !close(file_handle);
  file_handle = -1;
  return ret;
}


x86 assembly (clang, -O0):
<closeUSBDriver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
movl   $0xffffffff,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closeUSBDriver>:
push   %rax
call   1030 <close@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @closeUSBDriver(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @close(i32 %4)
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
store i32 %8, i32* %3
store i32 -1, i32* %2
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @closeUSBDriver(i32 %0) {
%2 = tail call i32 @close(i32 %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
int parity(int x) {
  x ^= x >> 16;
  x ^= x >> 8;
  x ^= x >> 4;
  x &= 0xf;
  return (0x6996 >> x) & 1;
}


x86 assembly (clang, -O0):
<parity>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x6996,%eax
sar    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity>:
mov    %edi,%eax
sar    $0x10,%eax
xor    %edi,%eax
mov    %eax,%edx
sar    $0x8,%edx
xor    %eax,%edx
mov    %edx,%ecx
shr    $0x4,%ecx
xor    %edx,%ecx
and    $0xf,%cl
mov    $0x6996,%eax
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @parity(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 16
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = ashr i32 %7, 8
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = ashr i32 %11, 4
%13 = load i32, i32* %2
%14 = xor i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = and i32 %15, 15
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = ashr i32 27030, %17
%19 = and i32 %18, 1
ret i32 %19
}

LLVM IR (-O2):
define i32 @parity(i32 %0) {
%2 = ashr i32 %0, 16
%3 = xor i32 %2, %0
%4 = ashr i32 %3, 8
%5 = xor i32 %4, %3
%6 = lshr i32 %5, 4
%7 = xor i32 %6, %5
%8 = and i32 %7, 15
%9 = lshr i32 27030, %8
%10 = and i32 %9, 1
ret i32 %10
}
/* Variables and functions */
int strncmp(char const *, char const *, int);
int cmp_path(const void *a, const void *b) {
  return strncmp((const char *)a, (const char *)b, 128);
}


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

x86 assembly (clang, -O2):
<cmp_path>:
mov    $0x80,%edx
jmp    1030 <strncmp@plt>

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

LLVM IR (-O2):
define i32 @cmp_path(i8* %0, i8* %1) {
%3 = tail call i32 @strncmp(i8* %0, i8* %1, i32 128)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ SETHLm(int);
void SET3HLm() { SETHLm(0x08); }


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

x86 assembly (clang, -O2):
<SET3HLm>:
mov    $0x8,%edi
jmp    1030 <SETHLm@plt>

LLVM IR (-O0):
define void @SET3HLm() {
%1 = call i32 @SETHLm(i32 8)
ret void
}

LLVM IR (-O2):
define void @SET3HLm() {
%1 = tail call i32 @SETHLm(i32 8)
ret void
}
/* Type definitions */
struct tempfile {
  int dummy;
};

/* Variables and functions */
int mks_tempfile_sm(struct tempfile *, char const *, int /*<<< orphan*/, int);
int mks_tempfile_m(struct tempfile *tempfile, const char *template, int mode) {
  return mks_tempfile_sm(tempfile, template, 0, mode);
}


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

x86 assembly (clang, -O2):
<mks_tempfile_m>:
mov    %edx,%ecx
xor    %edx,%edx
jmp    1030 <mks_tempfile_sm@plt>

LLVM IR (-O0):
%struct.tempfile = type { i32 }
define i32 @mks_tempfile_m(%struct.tempfile* %0, i8* %1, i32 %2) {
%4 = alloca %struct.tempfile*
%5 = alloca i8*
%6 = alloca i32
store %struct.tempfile* %0, %struct.tempfile** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.tempfile*, %struct.tempfile** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @mks_tempfile_sm(%struct.tempfile* %7, i8* %8, i32 0, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.tempfile = type { i32 }
define i32 @mks_tempfile_m(%struct.tempfile* %0, i8* %1, i32 %2) {
%4 = tail call i32 @mks_tempfile_sm(%struct.tempfile* %0, i8* %1, i32 0, i32 %2)
ret i32 %4
}
/* Variables and functions */
unsigned char VIM_HIF_GetReg8(int);
unsigned char VIM_JPEG_GetQFactor(void) {
  return VIM_HIF_GetReg8((0x0000 + 0x005));
}


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

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

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

LLVM IR (-O2):
define zeroext i8 @VIM_JPEG_GetQFactor() {
%1 = tail call zeroext i8 @VIM_HIF_GetReg8(i32 5)
ret i8 %1
}
/* Variables and functions */
scalar_t__ isdigit(char);
float toupper(char);
int isxdigit(char c) {
  return isdigit(c) || (toupper(c) >= 'A' && toupper(c) <= 'F');
}


x86 assembly (clang, -O0):
<isxdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x2(%rbp)
jne    118b <isxdigit+0x6b>
movsbl -0x1(%rbp),%edi
call   1040 <toupper@plt>
xor    %eax,%eax
movss  0xea4(%rip),%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0x3(%rbp)
jb     1185 <isxdigit+0x65>
movsbl -0x1(%rbp),%edi
call   1040 <toupper@plt>
movaps %xmm0,%xmm1
movss  0xe88(%rip),%xmm0
ucomiss %xmm1,%xmm0
setae  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isxdigit>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <isxdigit+0x17>
pop    %rbx
ret
movsbl %bl,%ebx
mov    %ebx,%edi
call   1040 <toupper@plt>
xor    %eax,%eax
ucomiss 0xeb6(%rip),%xmm0
jb     1135 <isxdigit+0x15>
mov    %ebx,%edi
call   1040 <toupper@plt>
movss  0xea9(%rip),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
setae  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isxdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i64 @isdigit(i8 signext %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = call float @toupper(i8 signext %7)
%9 = fcmp oge float %8, 6.500000e+01
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = call float @toupper(i8 signext %11)
%13 = fcmp ole float %12, 7.000000e+01
br label %14
14: ; preds = %10, %6
%15 = phi i1 [ false, %6 ], [ %13, %10 ]
br label %16
16: ; preds = %14, %1
%17 = phi i1 [ true, %1 ], [ %15, %14 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @isxdigit(i8 signext %0) {
%2 = tail call i64 @isdigit(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = tail call float @toupper(i8 signext %0)
%6 = fcmp ult float %5, 6.500000e+01
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = tail call float @toupper(i8 signext %0)
%9 = fcmp ole float %8, 7.000000e+01
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %4, %7, %1
%12 = phi i32 [ 1, %1 ], [ 0, %4 ], [ %10, %7 ]
ret i32 %12
}
/* Variables and functions */
int getchar();
int /*<<< orphan*/ putchar(int);
int main(int argc, char *argv[]) {
  int ch;
  while ((ch = getchar()) != '\n')
    putchar(ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xa,%eax
je     1156 <main+0x36>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0xa,%eax
je     1145 <main+0x25>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    1130 <main+0x10>
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**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %7
7: ; preds = %10, %2
%8 = call i32 (...) @getchar()
store i32 %8, i32* %6
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = load i32, i32* %6
%12 = call i32 @putchar(i32 %11)
br label %7
13: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getchar()
%4 = icmp eq i32 %3, 10
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ %3, %2 ]
%7 = tail call i32 @putchar(i32 %6)
%8 = tail call i32 (...) @getchar()
%9 = icmp eq i32 %8, 10
br i1 %9, label %10, label %5
10: ; preds = %5, %2
ret i32 0
}
unsigned long *foo(unsigned long *x) { return x + (1 + *x); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rcx
add    $0x1,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    (%rdi),%rax
lea    (%rdi,%rax,8),%rax
add    $0x8,%rax
ret

LLVM IR (-O0):
define i64* @foo(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
%6 = add i64 1, %5
%7 = getelementptr inbounds i64, i64* %3, i64 %6
ret i64* %7
}

LLVM IR (-O2):
define i64* @foo(i64* %0) {
%2 = load i64, i64* %0
%3 = add i64 %2, 1
%4 = getelementptr inbounds i64, i64* %0, i64 %3
ret i64* %4
}
/* Variables and functions */
int core7_safe(char const *);
int U_EMRSETWINDOWEXTEX_safe(const char *record) {
  return (core7_safe(record));
}


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

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

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

LLVM IR (-O2):
define i32 @U_EMRSETWINDOWEXTEX_safe(i8* %0) {
%2 = tail call i32 @core7_safe(i8* %0)
ret i32 %2
}