xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int clamp_s16(int);
void mix_samples(int16_t *y, int16_t x, int16_t hgain) {
  *y = clamp_s16(*y + ((x * hgain + 0x4000) >> 15));
}


x86 assembly (clang, -O0):
<mix_samples>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
add    $0x4000,%eax
sar    $0xf,%eax
add    %eax,%edi
call   1030 <clamp_s16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mix_samples>:
push   %rbx
mov    %rdi,%rbx
imul   %edx,%esi
lea    0x4000(%rsi),%edi
sar    $0xf,%edi
add    (%rbx),%edi
call   1030 <clamp_s16@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @mix_samples(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = mul nsw i32 %9, %10
%12 = add nsw i32 %11, 16384
%13 = ashr i32 %12, 15
%14 = add nsw i32 %8, %13
%15 = call i32 @clamp_s16(i32 %14)
%16 = load i32*, i32** %4
store i32 %15, i32* %16
ret void
}

LLVM IR (-O2):
define void @mix_samples(i32* nocapture %0, i32 %1, i32 %2) {
%4 = load i32, i32* %0
%5 = mul nsw i32 %2, %1
%6 = add nsw i32 %5, 16384
%7 = ashr i32 %6, 15
%8 = add nsw i32 %4, %7
%9 = tail call i32 @clamp_s16(i32 %8)
store i32 %9, i32* %0
ret void
}
/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
scalar_t__ htonl(int /*<<< orphan*/);
uint64_t htonll(uint64_t x) {
  return (uint64_t)htonl((uint32_t)(x >> 32)) |
         (uint64_t)htonl((uint32_t)(x & 0xffffffff)) << 32;
}


x86 assembly (clang, -O0):
<htonll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1030 <htonl@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
and    $0xffffffff,%edi
call   1030 <htonl@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%eax
mov    %ecx,%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @htonll(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 32
%5 = call i64 @htonl(i32 %4)
%6 = trunc i64 %5 to i32
%7 = load i32, i32* %2
%8 = and i32 %7, -1
%9 = call i64 @htonl(i32 %8)
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 32
%12 = or i32 %6, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @htonll(i32 %0) {
%2 = tail call i64 @htonl(i32 poison)
%3 = tail call i64 @htonl(i32 %0)
ret i32 poison
}
int costofpainting(double x) {
  int fee = 0;
  if (x > 2) {
    int i = 0;
    while (i < 3) {
      fee = fee + costofpainting(x / 3.0);
      i++;
    }
    return fee + 100;
  } else if (x > 0) {
    return 200;
  }
  return 0;
}


x86 assembly (clang, -O0):
<costofpainting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xecf(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    118e <costofpainting+0x7e>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    1180 <costofpainting+0x70>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xea9(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <costofpainting@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1142 <costofpainting+0x32>
mov    -0x14(%rbp),%eax
add    $0x64,%eax
mov    %eax,-0x4(%rbp)
jmp    11b8 <costofpainting+0xa8>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ac <costofpainting+0x9c>
movl   $0xc8,-0x4(%rbp)
jmp    11b8 <costofpainting+0xa8>
jmp    11b1 <costofpainting+0xa1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<costofpainting>:
push   %rax
ucomisd 0xee7(%rip),%xmm0
jbe    1130 <costofpainting+0x20>
divsd  0xee5(%rip),%xmm0
call   1030 <costofpainting@plt>
lea    (%rax,%rax,2),%eax
add    $0x64,%eax
pop    %rcx
ret
xor    %ecx,%ecx
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    $0xc8,%eax
cmovbe %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @costofpainting(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store double %0, double* %3
store i32 0, i32* %4
%6 = load double, double* %3
%7 = fcmp ogt double %6, 2.000000e+00
br i1 %7, label %8, label %23
8: ; preds = %1
store i32 0, i32* %5
br label %9
9: ; preds = %12, %8
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32, i32* %4
%14 = load double, double* %3
%15 = fdiv double %14, 3.000000e+00
%16 = call i32 @costofpainting(double %15)
%17 = add nsw i32 %13, %16
store i32 %17, i32* %4
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %9
20: ; preds = %9
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 100
store i32 %22, i32* %2
br label %29
23: ; preds = %1
%24 = load double, double* %3
%25 = fcmp ogt double %24, 0.000000e+00
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 200, i32* %2
br label %29
27: ; preds = %23
br label %28
28: ; preds = %27
store i32 0, i32* %2
br label %29
29: ; preds = %28, %26, %20
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @costofpainting(double %0) {
%2 = fcmp ogt double %0, 2.000000e+00
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = fdiv double %0, 3.000000e+00
%5 = tail call i32 @costofpainting(double %4)
%6 = mul i32 %5, 3
%7 = add nsw i32 %6, 100
br label %11
8: ; preds = %1
%9 = fcmp ogt double %0, 0.000000e+00
%10 = select i1 %9, i32 200, i32 0
br label %11
11: ; preds = %8, %3
%12 = phi i32 [ %7, %3 ], [ %10, %8 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ quux();
void f1() { quux(); }


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

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

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

LLVM IR (-O2):
define void @f1() {
%1 = tail call i32 (...) @quux()
ret void
}
void idle_thread_set_boot_cpu(void) {}


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

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

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

LLVM IR (-O2):
define void @idle_thread_set_boot_cpu() {
ret void
}
AX0AR1(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (((float *)10000000)[x0]) = (p1[1111111 / 4]); }


x86 assembly (clang, -O0):
<AX0AR1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movss  0x10f444(%rax),%xmm0
movslq -0x10(%rbp),%rcx
mov    $0x989680,%eax
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AX0AR1>:
movss  0x10f444(%rcx),%xmm0
movslq %edi,%rax
movss  %xmm0,0x989680(,%rax,4)
ret

LLVM IR (-O0):
define i32 @AX0AR1(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = getelementptr inbounds float, float* %16, i64 277777
%18 = load float, float* %17
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* inttoptr (i64 10000000 to float*), i64 %20
store float %18, float* %21
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @AX0AR1(double %0, double %1, i32 %2, i32 %3, float* nocapture readnone %4, float* nocapture %5) {
%7 = getelementptr inbounds float, float* %5, i64 277777
%8 = load float, float* %7
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds float, float* inttoptr (i64 10000000 to float*), i64 %9
store float %8, float* %10
ret i32 undef
}
unsigned int e8_hash_object(const void *obj) {
  unsigned R = 0;
  int K = sizeof(obj);
  unsigned char *a = (unsigned char *)&obj;
  while (K--)
    R ^= *a++;
  return R % 256;
}


x86 assembly (clang, -O0):
<e8_hash_object>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x8,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x10(%rbp)
cmp    $0x0,%eax
je     114f <e8_hash_object+0x4f>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movzbl (%rax),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    111e <e8_hash_object+0x1e>
mov    -0xc(%rbp),%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<e8_hash_object>:
mov    %edi,%eax
shr    $0x8,%eax
xor    %edi,%eax
mov    %edi,%ecx
shr    $0x10,%ecx
mov    %edi,%edx
shr    $0x18,%edx
xor    %ecx,%edx
xor    %eax,%edx
mov    %rdi,%rax
shr    $0x20,%rax
mov    %rdi,%rcx
shr    $0x28,%rcx
xor    %eax,%ecx
mov    %rdi,%rax
shr    $0x30,%rax
xor    %ecx,%eax
xor    %edx,%eax
shr    $0x38,%rdi
movzbl %al,%eax
xor    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @e8_hash_object(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = trunc i64 %2 to i32
%5 = lshr i32 %4, 8
%6 = xor i32 %5, %3
%7 = trunc i64 %2 to i32
%8 = lshr i32 %7, 16
%9 = xor i32 %6, %8
%10 = trunc i64 %2 to i32
%11 = lshr i32 %10, 24
%12 = xor i32 %9, %11
%13 = lshr i64 %2, 32
%14 = trunc i64 %13 to i32
%15 = xor i32 %12, %14
%16 = lshr i64 %2, 40
%17 = trunc i64 %16 to i32
%18 = xor i32 %15, %17
%19 = lshr i64 %2, 48
%20 = trunc i64 %19 to i32
%21 = xor i32 %18, %20
%22 = lshr i64 %2, 56
%23 = trunc i64 %22 to i32
%24 = and i32 %21, 255
%25 = xor i32 %24, %23
ret i32 %25
}
int test_imm_FDuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xFD << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_FDuint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 253
%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_FDuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 16580608
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
double pow(float, double);
float ieLinToSRGB(float f) {
  const float phi = 12.92;
  const float cutoff = 0.003130805;
  if (f <= cutoff) {
    return f * phi;
  } else {
    const float alpha = 0.055;
    const float exponent = 2.4;
    return (1.0 + alpha) * pow(f, 1.0 / exponent) - alpha;
  }
}


x86 assembly (clang, -O0):
<ieLinToSRGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  0xedf(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xece(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xec1(%rip),%xmm0
ucomiss -0x8(%rbp),%xmm0
jb     1160 <ieLinToSRGB+0x50>
movss  0xeb3(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11ad <ieLinToSRGB+0x9d>
movss  0xea4(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe93(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
movsd  0xe99(%rip),%xmm1
call   1030 <pow@plt>
movsd  0xe7c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe78(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ieLinToSRGB>:
push   %rax
movss  0xee7(%rip),%xmm1
ucomiss %xmm0,%xmm1
jae    1141 <ieLinToSRGB+0x31>
movsd  0xee2(%rip),%xmm1
call   1030 <pow@plt>
mulsd  0xedd(%rip),%xmm0
addsd  0xedd(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret
mulss  0xebb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @ieLinToSRGB(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %3
store float 0x4029D70A40000000, float* %4
store float 0x3F69A5C620000000, float* %5
%8 = load float, float* %3
%9 = fcmp ole float %8, 0x3F69A5C620000000
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load float, float* %3
%12 = fmul float %11, 0x4029D70A40000000
store float %12, float* %2
br label %18
13: ; preds = %1
store float 0x3FAC28F5C0000000, float* %6
store float 0x4003333340000000, float* %7
%14 = load float, float* %3
%15 = call double @pow(float %14, double 0x3FDAAAAA98E38E45)
%16 = call double @llvm.fmuladd.f64(double 0x3FF0E147AE000000, double %15, double 0xBFAC28F5C0000000)
%17 = fptrunc double %16 to float
store float %17, float* %2
br label %18
18: ; preds = %13, %10
%19 = load float, float* %2
ret float %19
}

LLVM IR (-O2):
define float @ieLinToSRGB(float %0) {
%2 = fcmp ugt float %0, 0x3F69A5C620000000
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = fmul float %0, 0x4029D70A40000000
br label %9
5: ; preds = %1
%6 = tail call double @pow(float %0, double 0x3FDAAAAA98E38E45)
%7 = tail call double @llvm.fmuladd.f64(double %6, double 0x3FF0E147AE000000, double 0xBFAC28F5C0000000)
%8 = fptrunc double %7 to float
br label %9
9: ; preds = %5, %3
%10 = phi float [ %4, %3 ], [ %8, %5 ]
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ use(char *);
void cmd_use(char *str) { use(str); }


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

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

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

LLVM IR (-O2):
define void @cmd_use(i8* %0) {
%2 = tail call i32 @use(i8* %0)
ret void
}
double cos(double x) {
  double xsquare = x * x;
  return 1 - xsquare / 2 + xsquare * xsquare / 24 -
         xsquare * xsquare * xsquare / 720 +
         xsquare * xsquare * xsquare * xsquare / 40320;
}


x86 assembly (clang, -O0):
<cos>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xefb(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xee7(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xec9(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xea2(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xe76(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos>:
mulsd  %xmm0,%xmm0
movsd  0xef4(%rip),%xmm2
mulsd  %xmm0,%xmm2
addsd  0xef0(%rip),%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm0,%xmm1
mulsd  %xmm3,%xmm1
divsd  0xee0(%rip),%xmm3
mulsd  %xmm1,%xmm0
unpcklpd %xmm0,%xmm1
divpd  0xee0(%rip),%xmm1
addsd  %xmm2,%xmm3
subsd  %xmm1,%xmm3
unpckhpd %xmm1,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @cos(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = fmul double %4, %5
store double %6, double* %3
%7 = load double, double* %3
%8 = fdiv double %7, 2.000000e+00
%9 = fsub double 1.000000e+00, %8
%10 = load double, double* %3
%11 = load double, double* %3
%12 = fmul double %10, %11
%13 = fdiv double %12, 2.400000e+01
%14 = fadd double %9, %13
%15 = load double, double* %3
%16 = load double, double* %3
%17 = fmul double %15, %16
%18 = load double, double* %3
%19 = fmul double %17, %18
%20 = fdiv double %19, 7.200000e+02
%21 = fsub double %14, %20
%22 = load double, double* %3
%23 = load double, double* %3
%24 = fmul double %22, %23
%25 = load double, double* %3
%26 = fmul double %24, %25
%27 = load double, double* %3
%28 = fmul double %26, %27
%29 = fdiv double %28, 4.032000e+04
%30 = fadd double %21, %29
ret double %30
}

LLVM IR (-O2):
define double @cos(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, 5.000000e-01
%4 = fsub double 1.000000e+00, %3
%5 = fmul double %2, %2
%6 = fdiv double %5, 2.400000e+01
%7 = fadd double %4, %6
%8 = fmul double %2, %5
%9 = fmul double %2, %8
%10 = insertelement <2 x double> poison, double %8, i64 0
%11 = insertelement <2 x double> %10, double %9, i64 1
%12 = fdiv <2 x double> %11, <double 7.200000e+02, double 4.032000e+04>
%13 = extractelement <2 x double> %12, i64 0
%14 = fsub double %7, %13
%15 = extractelement <2 x double> %12, i64 1
%16 = fadd double %14, %15
ret double %16
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long window;
};
typedef TYPE_1__ XConfigureRequestEvent;

/* Variables and functions */
void set_XConfigureRequestEvent_window(void *_p, unsigned long _v) {
  ((XConfigureRequestEvent *)_p)->window = (unsigned long)_v;
}


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

x86 assembly (clang, -O2):
<set_XConfigureRequestEvent_window>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XConfigureRequestEvent_window(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %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 i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XConfigureRequestEvent_window(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ init_logging();
void __attribute__((constructor)) bb_init(void) { init_logging(); }


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

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

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @bb_init, i8* null }]
define void @bb_init() {
%1 = call i32 (...) @init_logging()
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @bb_init, i8* null }]
define void @bb_init() {
%1 = tail call i32 (...) @init_logging()
ret void
}
/* Variables and functions */
char *space(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strdup(const char *s) {
  char *dup;
  dup = space(strlen(s) + 1);
  strcpy(dup, s);
  return (dup);
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1030 <space@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1030 <space@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @space(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @space(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
double poly_diff(double x) { return 3 * x * x + 1; }


x86 assembly (clang, -O0):
<poly_diff>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed9(%rip),%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<poly_diff>:
movsd  0xef8(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
addsd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @poly_diff(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 3.000000e+00, %3
%5 = load double, double* %2
%6 = call double @llvm.fmuladd.f64(double %4, double %5, double 1.000000e+00)
ret double %6
}

LLVM IR (-O2):
define double @poly_diff(double %0) {
%2 = fmul double %0, 3.000000e+00
%3 = tail call double @llvm.fmuladd.f64(double %2, double %0, double 1.000000e+00)
ret double %3
}
int test_imm_04uint8_reg(unsigned char val) {
  return ((val) & (0x04 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_04uint8_reg(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 4
%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_04uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 4
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void f3(int *a) { printf("f3: %d\n", *a); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"f3: %d\0A\00"
define void @f3(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ echo(char *);
unused() { echo("Never used!!"); }


x86 assembly (clang, -O0):
<unused>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <echo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"Never used!!\00"
define i32 @unused() {
%1 = alloca i32
%2 = call i32 @echo(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [13 x i8] c"Never used!!\00"
define i32 @unused() {
%1 = tail call i32 @echo(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void RTLatin1CalcUtf8LenEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLatin1CalcUtf8LenEx() {
ret void
}
int hextrlen(int num) {
  int len = 0;
  for (; num > 0; len++, num /= 16)
    ;
  return len;
}


x86 assembly (clang, -O0):
<hextrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1139 <hextrlen+0x39>
jmp    111d <hextrlen+0x1d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <hextrlen+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hextrlen>:
xor    %eax,%eax
test   %edi,%edi
jle    111d <hextrlen+0x1d>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
add    $0x1,%eax
shr    $0x4,%ecx
cmp    $0xf,%edi
mov    %ecx,%edi
ja     1110 <hextrlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @hextrlen(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = phi i32 [ %7, %3 ], [ %0, %1 ]
%6 = add nuw nsw i32 %4, 1
%7 = lshr i32 %5, 4
%8 = icmp ult i32 %5, 16
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %10
}
int test_imm_B7int8_reg(signed char val) {
  return ((val) & (-0xB7 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_B7int8_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, -183
%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_B7int8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -183
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int errno;
int sigtimedwait(int /*<<< orphan*/ const *, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *);
int sigwait(const sigset_t *__restrict set, int *__restrict sig) {
  int status;
  status = sigtimedwait(set, NULL, NULL);
  if (status != -1) {
    if (sig)
      *sig = status;
    return 0;
  }
  return errno;
}


x86 assembly (clang, -O0):
<sigwait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1030 <sigtimedwait@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
je     115d <sigwait+0x4d>
cmpq   $0x0,-0x18(%rbp)
je     1151 <sigwait+0x41>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1169 <sigwait+0x59>
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigwait>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
xor    %ebx,%ebx
xor    %esi,%esi
xor    %edx,%edx
call   1030 <sigtimedwait@plt>
cmp    $0xffffffff,%eax
je     1131 <sigwait+0x21>
test   %r14,%r14
je     113a <sigwait+0x2a>
mov    %eax,(%r14)
jmp    113a <sigwait+0x2a>
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@errno = global i32 0
define i32 @sigwait(i32* noalias %0, i32* noalias writeonly %1) {
%3 = tail call i32 @sigtimedwait(i32* %0, i32* null, i32* null)
%4 = icmp eq i32 %3, -1
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = icmp eq i32* %1, null
br i1 %6, label %10, label %7
7: ; preds = %5
store i32 %3, i32* %1
br label %10
8: ; preds = %2
%9 = load i32, i32* @errno
br label %10
10: ; preds = %5, %7, %8
%11 = phi i32 [ %9, %8 ], [ 0, %7 ], [ 0, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIG_DFL;
int /*<<< orphan*/ my_exit(int);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
void x_badpipe(int signum) {
  signal(SIGPIPE, SIG_DFL);
  system("xset r");
  my_exit(5);
}


x86 assembly (clang, -O0):
<x_badpipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
lea    0xea7(%rip),%rdi
call   1030 <system@plt>
mov    $0x5,%edi
call   1040 <my_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_badpipe>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
mov    0x2e97(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
lea    0xeb1(%rip),%rdi
call   1030 <system@plt>
mov    $0x5,%edi
pop    %rax
jmp    1040 <my_exit@plt>

LLVM IR (-O0):
@SIGPIPE = global i32 0
@SIG_DFL = global i32 0
@.str = [7 x i8] c"xset r\00"
define void @x_badpipe(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @SIGPIPE
%4 = load i32, i32* @SIG_DFL
%5 = call i32 @signal(i32 %3, i32 %4)
%6 = call i32 @system(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @my_exit(i32 5)
ret void
}

LLVM IR (-O2):
@SIGPIPE = global i32 0
@SIG_DFL = global i32 0
@.str = [7 x i8] c"xset r\00"
define void @x_badpipe(i32 %0) {
%2 = load i32, i32* @SIGPIPE
%3 = load i32, i32* @SIG_DFL
%4 = tail call i32 @signal(i32 %2, i32 %3)
%5 = tail call i32 @system(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @my_exit(i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void display() { printf("Change Again\n"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Change Again\0A\00"
define void @display() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"Change Again\00"
define void @display() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
int test_imm_80int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x80 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_80int64_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, 128
%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_80int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 8388608
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
size_t strcspn(char *, char *);
char *truncate_nl(char *s) {
  assert(s);
  s[strcspn(s, "\n\r")] = 0;
  return s;
}


x86 assembly (clang, -O0):
<truncate_nl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb8(%rip),%rsi
call   1030 <strcspn@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<truncate_nl>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcspn@plt>
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0A\0D\00"
define i8* @truncate_nl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @assert(i8* %3)
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = call i64 @strcspn(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0A\0D\00"
define i8* @truncate_nl(i8* returned %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i64 @strcspn(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds i8, i8* %0, i64 %3
store i8 0, i8* %4
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ invert(unsigned int, int, int);
int main(void) {
  unsigned x = 170;
  int p = 4;
  int n = 3;
  invert(x, p, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xaa,-0x8(%rbp)
movl   $0x4,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <invert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xaa,%edi
mov    $0x4,%esi
mov    $0x3,%edx
call   1030 <invert@plt>
xor    %eax,%eax
pop    %rcx
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 170, i32* %2
store i32 4, i32* %3
store i32 3, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @invert(i32 %5, i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @invert(i32 170, i32 4, i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void *getifaddrs;
int main(int argc, char *argv[]) {
  void *p;
  (void)argc;
  (void)argv;
  p = getifaddrs;
  exit(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    0x2ebb(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@getifaddrs = global i8* null
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = load i8*, i8** @getifaddrs
store i8* %9, i8** %6
%10 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@getifaddrs = global i8* null
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int any(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  char s[] = "hello, world. I love c programming!";
  char t[] = "bf";
  int val = any(s, t);
  printf("val = %d\n", val);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
mov    0xec2(%rip),%ax
mov    %ax,-0x43(%rbp)
mov    0xeba(%rip),%al
mov    %al,-0x41(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x43(%rbp),%rsi
call   1050 <any@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x21676e,0x30(%rsp)
movb   $0x0,0xe(%rsp)
movw   $0x6662,0xc(%rsp)
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1040 <any@plt>
lea    0xec1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.s = [36 x i8] c"hello, world. I love c programming!\00"
@__const.main.t = [3 x i8] c"bf\00"
@.str = [10 x i8] c"val = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [36 x i8]
%7 = alloca [3 x i8]
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [36 x i8]* %6 to i8*
%10 = bitcast [3 x i8]* %7 to i8*
%11 = getelementptr inbounds [36 x i8], [36 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%13 = call i32 @any(i8* %11, i8* %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [36 x i8] c"hello, world. I love c programming!\00"
@__const.main.t = [3 x i8] c"bf\00"
@.str = [10 x i8] c"val = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [36 x i8]
%4 = alloca [3 x i8]
%5 = getelementptr inbounds [36 x i8], [36 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%7 = call i32 @any(i8* %5, i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
int test_imm_36int16_reg(short val) {
  return ((val) & (0x36 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_36int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 54
%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_36int16_reg(i16 signext %0) {
%2 = and i16 %0, 54
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
float f(float a, float x) { return a * x * x; }


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

x86 assembly (clang, -O2):
<f>:
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @f(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fmul float %5, %6
%8 = load float, float* %4
%9 = fmul float %7, %8
ret float %9
}

LLVM IR (-O2):
define float @f(float %0, float %1) {
%3 = fmul float %0, %1
%4 = fmul float %3, %1
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMRCREATEBITMAPINDIRECT_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

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

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

LLVM IR (-O2):
define void @U_WMRCREATEBITMAPINDIRECT_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
unsigned char maximum(unsigned char v1, unsigned char v2, unsigned char v3) {
  unsigned char max = v1;
  if (v2 > max)
    max = v2;
  if (v3 > max)
    max = v3;
  return max;
}


x86 assembly (clang, -O0):
<maximum>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x4(%rbp)
movzbl -0x2(%rbp),%eax
movzbl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jle    1131 <maximum+0x31>
mov    -0x2(%rbp),%al
mov    %al,-0x4(%rbp)
movzbl -0x3(%rbp),%eax
movzbl -0x4(%rbp),%ecx
cmp    %ecx,%eax
jle    1147 <maximum+0x47>
mov    -0x3(%rbp),%al
mov    %al,-0x4(%rbp)
movzbl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<maximum>:
mov    %edi,%eax
cmp    %al,%sil
cmova  %esi,%eax
cmp    %dl,%al
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define zeroext i8 @maximum(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %4
store i8 %8, i8* %7
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = load i8, i8* %7
%12 = zext i8 %11 to i32
%13 = icmp sgt i32 %10, %12
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = load i8, i8* %5
store i8 %15, i8* %7
br label %16
16: ; preds = %14, %3
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = load i8, i8* %7
%20 = zext i8 %19 to i32
%21 = icmp sgt i32 %18, %20
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = load i8, i8* %6
store i8 %23, i8* %7
br label %24
24: ; preds = %22, %16
%25 = load i8, i8* %7
ret i8 %25
}

LLVM IR (-O2):
define zeroext i8 @maximum(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2) {
%4 = icmp ugt i8 %1, %0
%5 = select i1 %4, i8 %1, i8 %0
%6 = icmp ult i8 %5, %2
%7 = select i1 %6, i8 %2, i8 %5
ret i8 %7
}
void zomb_onvol(void *arg) {}


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

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

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

LLVM IR (-O2):
define void @zomb_onvol(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isdigit(char const);
int isnumstr(const char *str) {
  const char *p;
  for (p = str; *p; p++)
    if (!isdigit(*p))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isnumstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1168 <isnumstr+0x58>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1152 <isnumstr+0x42>
movl   $0x0,-0x4(%rbp)
jmp    116f <isnumstr+0x5f>
jmp    1157 <isnumstr+0x47>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1124 <isnumstr+0x14>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumstr>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <isnumstr+0x3b>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1149 <isnumstr+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <isnumstr+0x20>
jmp    114b <isnumstr+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isnumstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i32 @isdigit(i8 signext %8)
%11 = icmp eq i32 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %13, label %4
13: ; preds = %7, %4, %1
%14 = phi i32 [ 1, %1 ], [ 1, %4 ], [ 0, %7 ]
ret i32 %14
}