xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(char *);
scalar_t__ ft_strlen(char *);
char *ft_strndup(char *, scalar_t__);
char *ft_strpop(char *str) {
  char *new;
  new = ft_strndup(str, ft_strlen(str) - 1);
  free(str);
  return (new);
}


x86 assembly (clang, -O0):
<ft_strpop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <ft_strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rsi
sub    $0x1,%rsi
call   1040 <ft_strndup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @ft_strpop(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @ft_strlen(i8* %5)
%7 = sub nsw i64 %6, 1
%8 = call i8* @ft_strndup(i8* %4, i64 %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %2
%10 = call i32 @free(i8* %9)
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @ft_strpop(i8* %0) {
%2 = tail call i64 @ft_strlen(i8* %0)
%3 = add nsw i64 %2, -1
%4 = tail call i8* @ft_strndup(i8* %0, i64 %3)
%5 = tail call i32 @free(i8* %0)
ret i8* %4
}
/* Variables and functions */
int f444(int *);
int f445(int *p) { return f444(p); }


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

x86 assembly (clang, -O2):
<f445>:
jmp    1030 <f444@plt>

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

LLVM IR (-O2):
define i32 @f445(i32* %0) {
%2 = tail call i32 @f444(i32* %0)
ret i32 %2
}
unsigned long hash(unsigned char *str) {
  unsigned long hash = 5381;
  int c;
  while (c = *str++)
    hash = ((hash << 5) + hash) + c;
  return hash;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1505,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     114a <hash+0x4a>
mov    -0x10(%rbp),%rax
shl    $0x5,%rax
add    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112c <hash+0x2c>
add    $0x1,%rdi
mov    $0x1505,%eax
nop
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movzbl %cl,%eax
add    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
ret
mov    $0x1505,%eax
ret

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

LLVM IR (-O2):
define i64 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = phi i64 [ %11, %4 ], [ 5381, %1 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = mul i64 %7, 33
%10 = zext i8 %5 to i64
%11 = add i64 %9, %10
%12 = load i8, i8* %8
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 5381, %1 ], [ %11, %4 ]
ret i64 %15
}
int emq_version(void) { return (1 * 10 + 3); }


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

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

LLVM IR (-O0):
define i32 @emq_version() {
ret i32 13
}

LLVM IR (-O2):
define i32 @emq_version() {
ret i32 13
}
float rectangle(float x, float y) { return (2 * x + 2 * y); }


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

x86 assembly (clang, -O2):
<rectangle>:
addss  %xmm1,%xmm1
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @rectangle(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 2.000000e+00, %6
%8 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %5, float %7)
ret float %8
}

LLVM IR (-O2):
define float @rectangle(float %0, float %1) {
%3 = fmul float %1, 2.000000e+00
%4 = tail call float @llvm.fmuladd.f32(float %0, float 2.000000e+00, float %3)
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void liblist_list_free_free(void *data) { free(data); }


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

x86 assembly (clang, -O2):
<liblist_list_free_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @liblist_list_free_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
float atan_f(float x) {
  float xabs = (x < 0 ? -x : x);
  return (0.78539816339f * x - x * (xabs - 1) * (0.2447f + 0.0663f * xabs));
}


x86 assembly (clang, -O0):
<atan_f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x4(%rbp),%xmm0
jbe    1132 <atan_f+0x32>
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
jmp    113c <atan_f+0x3c>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  0xeaf(%rip),%xmm3
subss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movss  -0x8(%rbp),%xmm2
movss  0xe92(%rip),%xmm3
mulss  %xmm3,%xmm2
movss  0xe8a(%rip),%xmm3
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  0xe65(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<atan_f>:
movaps 0xef9(%rip),%xmm1
xorps  %xmm0,%xmm1
xorps  %xmm2,%xmm2
movaps %xmm0,%xmm3
cmpltss %xmm2,%xmm3
andps  %xmm3,%xmm1
andnps %xmm0,%xmm3
orps   %xmm1,%xmm3
movss  0xeea(%rip),%xmm1
addss  %xmm3,%xmm1
mulss  0xee2(%rip),%xmm3
addss  0xede(%rip),%xmm3
mulss  %xmm0,%xmm1
mulss  %xmm3,%xmm1
mulss  0xed2(%rip),%xmm0
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @atan_f(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fcmp olt float %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load float, float* %2
%8 = fneg float %7
br label %11
9: ; preds = %1
%10 = load float, float* %2
br label %11
11: ; preds = %9, %6
%12 = phi float [ %8, %6 ], [ %10, %9 ]
store float %12, float* %3
%13 = load float, float* %2
%14 = load float, float* %2
%15 = load float, float* %3
%16 = fsub float %15, 1.000000e+00
%17 = fmul float %14, %16
%18 = load float, float* %3
%19 = call float @llvm.fmuladd.f32(float 0x3FB0F90960000000, float %18, float 0x3FCF525460000000)
%20 = fmul float %17, %19
%21 = fneg float %20
%22 = call float @llvm.fmuladd.f32(float 0x3FE921FB60000000, float %13, float %21)
ret float %22
}

LLVM IR (-O2):
define float @atan_f(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
%5 = fadd float %4, -1.000000e+00
%6 = tail call float @llvm.fmuladd.f32(float %4, float 0x3FB0F90960000000, float 0x3FCF525460000000)
%7 = fneg float %5
%8 = fmul float %7, %0
%9 = fmul float %6, %8
%10 = tail call float @llvm.fmuladd.f32(float %0, float 0x3FE921FB60000000, float %9)
ret float %10
}
/* Variables and functions */
int smbw_fcntl(int, int, long);
scalar_t__ smbw_fd(int);
int stub1(int, int, long);
int fcntlx(int fd, int cmd, long arg, int (*f)(int, int, long)) {
  if (smbw_fd(fd)) {
    return smbw_fcntl(fd, cmd, arg);
  }
  return (*f)(fd, cmd, arg);
}


x86 assembly (clang, -O0):
<fcntlx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <smbw_fd@plt>
cmp    $0x0,%rax
je     115f <fcntlx+0x3f>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <smbw_fcntl@plt>
mov    %eax,-0x4(%rbp)
jmp    1172 <fcntlx+0x52>
mov    -0x20(%rbp),%rax
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   *%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcntlx>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
call   1040 <smbw_fd@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14,%rdx
test   %rax,%rax
je     1151 <fcntlx+0x31>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <smbw_fcntl@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    *%rax

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

LLVM IR (-O2):
define i32 @fcntlx(i32 %0, i32 %1, i64 %2, i32 (i32, i32, i64)* nocapture %3) {
%5 = tail call i64 @smbw_fd(i32 %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @smbw_fcntl(i32 %0, i32 %1, i64 %2)
br label %11
9: ; preds = %4
%10 = tail call i32 %3(i32 %0, i32 %1, i64 %2)
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %8, %7 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
float fmaf(float, float, float);
float fnms32(float x, float y, float z) { return fmaf(x, y, -z); }


x86 assembly (clang, -O0):
<fnms32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
call   1030 <fmaf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnms32>:
xorps  0xee9(%rip),%xmm2
jmp    1030 <fmaf@plt>

LLVM IR (-O0):
define float @fnms32(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %6
%10 = fneg float %9
%11 = call float @llvm.fma.f32(float %7, float %8, float %10)
ret float %11
}

LLVM IR (-O2):
define float @fnms32(float %0, float %1, float %2) {
%4 = fneg float %2
%5 = tail call float @llvm.fma.f32(float %0, float %1, float %4)
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ InitBase();
int main() { InitBase(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @InitBase()
ret i32 0
}
int test_imm_0Eint16_reg(short val) {
  return ((val) & (0x0E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_0Eint16_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, 14
%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_0Eint16_reg(i16 signext %0) {
%2 = and i16 %0, 14
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void benchmark_in_situ_free(char *data) { free(data); }


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

x86 assembly (clang, -O2):
<benchmark_in_situ_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @benchmark_in_situ_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
int get_severity(int prival) { return prival & 0x7; }


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

x86 assembly (clang, -O2):
<get_severity>:
mov    %edi,%eax
and    $0x7,%eax
ret

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

LLVM IR (-O2):
define i32 @get_severity(i32 %0) {
%2 = and i32 %0, 7
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint32_t;

/* Variables and functions */
uint32_t read32(volatile void *addr) { return *(volatile uint32_t *)addr; }


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

x86 assembly (clang, -O2):
<read32>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @read32(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load volatile i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @read32(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = load volatile i32, i32* %2
ret i32 %3
}
int make_operations(int val1, int val2, int (*func)(int, int)) {
  return (*func)(val1, val2);
}


x86 assembly (clang, -O0):
<make_operations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_operations>:
jmp    *%rdx

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

LLVM IR (-O2):
define i32 @make_operations(i32 %0, i32 %1, i32 (i32, i32)* nocapture %2) {
%4 = tail call i32 %2(i32 %0, i32 %1)
ret i32 %4
}
void translate_range(file, a, b, aptr, bptr) struct file_data const *file;
int a, b;
int *aptr, *bptr;
{
  *aptr = translate_line_number(file, a - 1) + 1;
  *bptr = translate_line_number(file, b + 1) - 1;
}


x86 assembly (clang, -O0):
<translate_range>:
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    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
mov    $0x0,%al
call   1030 <translate_line_number@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x1,%esi
mov    $0x0,%al
call   1030 <translate_line_number@plt>
mov    %eax,%ecx
sub    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<translate_range>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%r15
mov    %edx,%ebp
mov    %rdi,%rbx
add    $0xffffffff,%esi
xor    %eax,%eax
call   1030 <translate_line_number@plt>
add    $0x1,%eax
mov    %eax,(%r15)
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <translate_line_number@plt>
add    $0xffffffff,%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.file_data = type opaque
define void @translate_range(%struct.file_data* %0, i32 %1, i32 %2, i32* %3, i32* %4) {
%6 = alloca %struct.file_data*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
store %struct.file_data* %0, %struct.file_data** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load %struct.file_data*, %struct.file_data** %6
%12 = load i32, i32* %7
%13 = sub nsw i32 %12, 1
%14 = call i32 (%struct.file_data*, i32, ...) bitcast (i32 (...)* @translate_line_number to i32 (%struct.file_data*, i32, ...)*)(%struct.file_data* %11, i32 %13)
%15 = add nsw i32 %14, 1
%16 = load i32*, i32** %9
store i32 %15, i32* %16
%17 = load %struct.file_data*, %struct.file_data** %6
%18 = load i32, i32* %8
%19 = add nsw i32 %18, 1
%20 = call i32 (%struct.file_data*, i32, ...) bitcast (i32 (...)* @translate_line_number to i32 (%struct.file_data*, i32, ...)*)(%struct.file_data* %17, i32 %19)
%21 = sub nsw i32 %20, 1
%22 = load i32*, i32** %10
store i32 %21, i32* %22
ret void
}

LLVM IR (-O2):
%struct.file_data = type opaque
define void @translate_range(%struct.file_data* %0, i32 %1, i32 %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = add nsw i32 %1, -1
%7 = tail call i32 (%struct.file_data*, i32, ...) bitcast (i32 (...)* @translate_line_number to i32 (%struct.file_data*, i32, ...)*)(%struct.file_data* %0, i32 %6)
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = add nsw i32 %2, 1
%10 = tail call i32 (%struct.file_data*, i32, ...) bitcast (i32 (...)* @translate_line_number to i32 (%struct.file_data*, i32, ...)*)(%struct.file_data* %0, i32 %9)
%11 = add nsw i32 %10, -1
store i32 %11, i32* %4
ret void
}
void org_trifort_threadfence_block() {}


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

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

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

LLVM IR (-O2):
define void @org_trifort_threadfence_block() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void fld_preg32_qword(int reg32) {
  put8(0xDD);
  put8(reg32);
}


x86 assembly (clang, -O0):
<fld_preg32_qword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xdd,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%edi
call   1030 <put8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fld_preg32_qword>:
push   %rbx
mov    %edi,%ebx
mov    $0xdd,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @fld_preg32_qword(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 221)
%4 = load i32, i32* %2
%5 = call i32 @put8(i32 %4)
ret void
}

LLVM IR (-O2):
define void @fld_preg32_qword(i32 %0) {
%2 = tail call i32 @put8(i32 221)
%3 = tail call i32 @put8(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ input_load(char *);
int /*<<< orphan*/ input_read();
int /*<<< orphan*/ printf(char *);
void parse_args(int argc, char *argv[]) {
  if (argc == 1) {
    input_read();
  } else if (argc == 2) {
    input_load(argv[1]);
    input_read();
  } else {
    printf("Usage: qshell [FILE]\n");
  }
}


x86 assembly (clang, -O0):
<parse_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1155 <parse_args+0x25>
mov    $0x0,%al
call   1050 <input_read@plt>
jmp    1189 <parse_args+0x59>
cmpl   $0x2,-0x4(%rbp)
jne    1178 <parse_args+0x48>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <input_load@plt>
mov    $0x0,%al
call   1050 <input_read@plt>
jmp    1184 <parse_args+0x54>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    1189 <parse_args+0x59>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_args>:
cmp    $0x2,%edi
je     1141 <parse_args+0x11>
cmp    $0x1,%edi
jne    1153 <parse_args+0x23>
xor    %eax,%eax
jmp    1050 <input_read@plt>
push   %rax
mov    0x8(%rsi),%rdi
call   1040 <input_load@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <input_read@plt>
lea    0xea6(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Usage: qshell [FILE]\0A\00"
define void @parse_args(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 (...) @input_read()
br label %21
9: ; preds = %2
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i8**, i8*** %4
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @input_load(i8* %15)
%17 = call i32 (...) @input_read()
br label %20
18: ; preds = %9
%19 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %12
br label %21
21: ; preds = %20, %7
ret void
}

LLVM IR (-O2):
@str = [21 x i8] c"Usage: qshell [FILE]\00"
define void @parse_args(i32 %0, i8** nocapture %1) {
switch i32 %0, label %10 [
i32 1, label %3
i32 2, label %5
]
3: ; preds = %2
%4 = tail call i32 (...) @input_read()
br label %12
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @input_load(i8* %7)
%9 = tail call i32 (...) @input_read()
br label %12
10: ; preds = %2
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %5, %10, %3
ret void
}
/* Variables and functions */
double pow(double, double);
double OP_Exp(double op1, double op2) { return pow(op1, op2); }


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

x86 assembly (clang, -O2):
<OP_Exp>:
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @OP_Exp(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 = load double, double* %4
%7 = call double @pow(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @OP_Exp(double %0, double %1) {
%3 = tail call double @pow(double %0, double %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main() {
  fprintf(stderr, "This programe only provide some basic funcs to other "
                  "programs used for test in this test-dir.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [95 x i8] c"This programe only provide some basic funcs to other programs used for test in this test-dir.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [95 x i8] c"This programe only provide some basic funcs to other programs used for test in this test-dir.\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int exact_min_minus_min_linear_CAF(int x) {
  int size1[1];
  int y = 28;
  if (x < 5)
    y = x + 10;
  if (y > 28) {
    size1[-1] = 0;
  }
  return y;
}


x86 assembly (clang, -O0):
<exact_min_minus_min_linear_CAF>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1c,-0xc(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    1121 <exact_min_minus_min_linear_CAF+0x21>
mov    -0x4(%rbp),%eax
add    $0xa,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x1c,-0xc(%rbp)
jle    1132 <exact_min_minus_min_linear_CAF+0x32>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_min_minus_min_linear_CAF>:
lea    0xa(%rdi),%ecx
cmp    $0x5,%edi
mov    $0x1c,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @exact_min_minus_min_linear_CAF(i32 %0) {
%2 = alloca i32
%3 = alloca [1 x i32]
%4 = alloca i32
store i32 %0, i32* %2
store i32 28, i32* %4
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 10
store i32 %9, i32* %4
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 28
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = getelementptr inbounds [1 x i32], [1 x i32]* %3, i64 0, i64 -1
store i32 0, i32* %14
br label %15
15: ; preds = %13, %10
%16 = load i32, i32* %4
ret i32 %16
}

LLVM IR (-O2):
define i32 @exact_min_minus_min_linear_CAF(i32 %0) {
%2 = icmp slt i32 %0, 5
%3 = add nsw i32 %0, 10
%4 = select i1 %2, i32 %3, i32 28
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  assert(1);
  assert(2 == 3);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
%2 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
int bits(int64_t n) {
  int i;
  if (n < 0)
    n *= -1;
  for (i = 0; n > (int64_t)1 << i; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    111c <bits+0x1c>
imul   $0xffffffffffffffff,-0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
cmp    %rcx,%rax
jle    1151 <bits+0x51>
jmp    1143 <bits+0x43>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <bits+0x23>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    $0x1,%edx
shl    %cl,%rdx
add    $0x1,%rcx
cmp    %rdx,%rax
jg     1110 <bits+0x10>
add    $0xffffffff,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @bits(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
br label %3
3: ; preds = %3, %1
%4 = phi i64 [ %7, %3 ], [ 0, %1 ]
%5 = shl nuw i64 1, %4
%6 = icmp sgt i64 %2, %5
%7 = add nuw i64 %4, 1
br i1 %6, label %3, label %8
8: ; preds = %3
%9 = trunc i64 %4 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float, int);
int main() {
  typedef union {
    float lemon;
    int lime_pieces;
  } lemon_lime;
  typedef struct {
    float tequila;
    float cointreau;
    lemon_lime citrus;
  } margarita;
  margarita m = {2.0, 1.0, .citrus.lemon = 2};
  printf("%2.1f measures of tequila\n%2.1f measures of cointreau\n%2.1f "
         "measures of juice\n",
         m.tequila, m.cointreau, m.citrus.lemon);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
cvttss2si -0x8(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movss  0xee0(%rip),%xmm0
movss  0xedc(%rip),%xmm1
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.margarita = type { float, float, %union.lemon_lime }
%union.lemon_lime = type { float }
@__const.main.m = %struct.margarita { float 2.000000e+00, float 1.000000e+00, %union.lemon_lime { float 2.000000e+00 } }
@.str = [79 x i8] c"%2.1f measures of tequila\0A%2.1f measures of cointreau\0A%2.1f measures of juice\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.margarita
store i32 0, i32* %1
%3 = bitcast %struct.margarita* %2 to i8*
%4 = getelementptr inbounds %struct.margarita, %struct.margarita* %2, i32 0, i32 0
%5 = load float, float* %4
%6 = getelementptr inbounds %struct.margarita, %struct.margarita* %2, i32 0, i32 1
%7 = load float, float* %6
%8 = getelementptr inbounds %struct.margarita, %struct.margarita* %2, i32 0, i32 2
%9 = bitcast %union.lemon_lime* %8 to float*
%10 = load float, float* %9
%11 = fptosi float %10 to i32
%12 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), float %5, float %7, i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [79 x i8] c"%2.1f measures of tequila\0A%2.1f measures of cointreau\0A%2.1f measures of juice\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), float 2.000000e+00, float 1.000000e+00, i32 2)
ret i32 0
}
/* Variables and functions */
float sxnoise_2d(float, float, int);
float unsalt_2d_noise(float x, float y) { return sxnoise_2d(x, y, 7); }


x86 assembly (clang, -O0):
<unsalt_2d_noise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mov    $0x7,%edi
call   1030 <sxnoise_2d@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsalt_2d_noise>:
mov    $0x7,%edi
jmp    1030 <sxnoise_2d@plt>

LLVM IR (-O0):
define float @unsalt_2d_noise(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 = call float @sxnoise_2d(float %5, float %6, i32 7)
ret float %7
}

LLVM IR (-O2):
define float @unsalt_2d_noise(float %0, float %1) {
%3 = tail call float @sxnoise_2d(float %0, float %1, i32 7)
ret float %3
}
unsigned int decode_artnet_uint8(unsigned char *data) {
  return *(unsigned char *)data;
}


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

x86 assembly (clang, -O2):
<decode_artnet_uint8>:
movzbl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @decode_artnet_uint8(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @decode_artnet_uint8(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
ret i32 %3
}
/* Variables and functions */
int vdrive_bam_get_disk_id(unsigned int, unsigned char *);
int file_system_bam_get_disk_id(unsigned int unit, unsigned char *id) {
  return vdrive_bam_get_disk_id(unit, id);
}


x86 assembly (clang, -O0):
<file_system_bam_get_disk_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <vdrive_bam_get_disk_id@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_system_bam_get_disk_id>:
jmp    1030 <vdrive_bam_get_disk_id@plt>

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

LLVM IR (-O2):
define i32 @file_system_bam_get_disk_id(i32 %0, i8* %1) {
%3 = tail call i32 @vdrive_bam_get_disk_id(i32 %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ DMX_SET_BUFFER_SIZE;
int ioctl(int, int /*<<< orphan*/, int);
int dvbdemux_set_buffer(int fd, int bufsize) {
  return ioctl(fd, DMX_SET_BUFFER_SIZE, bufsize);
}


x86 assembly (clang, -O0):
<dvbdemux_set_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%edx
call   1030 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvbdemux_set_buffer>:
mov    %esi,%edx
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
jmp    1030 <ioctl@plt>

LLVM IR (-O0):
@DMX_SET_BUFFER_SIZE = global i32 0
define i32 @dvbdemux_set_buffer(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* @DMX_SET_BUFFER_SIZE
%7 = load i32, i32* %4
%8 = call i32 @ioctl(i32 %5, i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@DMX_SET_BUFFER_SIZE = global i32 0
define i32 @dvbdemux_set_buffer(i32 %0, i32 %1) {
%3 = load i32, i32* @DMX_SET_BUFFER_SIZE
%4 = tail call i32 @ioctl(i32 %0, i32 %3, i32 %1)
ret i32 %4
}
/* Variables and functions */
bool xorg(bool s, bool c) { return (s ^ c); }


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

x86 assembly (clang, -O2):
<xorg>:
mov    %edi,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @xorg(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 = xor i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @xorg(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t co_read16p(void const *ptr16) {
  uint16_t value = ((uint8_t *)ptr16)[0] | ((uint8_t *)ptr16)[1] << 8;
  return value;
}


x86 assembly (clang, -O0):
<co_read16p>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
mov    0x4(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<co_read16p>:
mov    0x4(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @co_read16p(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32, i32* %6
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = shl i32 %11, 8
%13 = or i32 %7, %12
store i32 %13, i32* %3
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @co_read16p(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
ret i32 %8
}
char *funcToStr(void *value) {
  (void)(value);
  return (char *)"[placeholder]";
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"[placeholder]\00"
define i8* @funcToStr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [14 x i8] c"[placeholder]\00"
define i8* @funcToStr(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EPERM;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ printf_verbose(char *);
int settimeofday(const struct timeval *tv, const void *tz) {
  printf_verbose("settimeofday(...) = BLOCKED;");
  errno = EPERM;
  return -1;
}


x86 assembly (clang, -O0):
<settimeofday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
call   1030 <printf_verbose@plt>
mov    0x2e9d(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea4(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<settimeofday>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf_verbose@plt>
mov    0x2eac(%rip),%rax
mov    (%rax),%eax
mov    0x2eb3(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [29 x i8] c"settimeofday(...) = BLOCKED;\00"
@EPERM = global i32 0
@errno = global i32 0
define i32 @settimeofday(%struct.timeval* %0, i8* %1) {
%3 = alloca %struct.timeval*
%4 = alloca i8*
store %struct.timeval* %0, %struct.timeval** %3
store i8* %1, i8** %4
%5 = call i32 @printf_verbose(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EPERM
store i32 %6, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str = [29 x i8] c"settimeofday(...) = BLOCKED;\00"
@EPERM = global i32 0
@errno = global i32 0
define i32 @settimeofday(%struct.timeval* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @printf_verbose(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EPERM
store i32 %4, i32* @errno
ret i32 -1
}
void g_cclosure_marshal_VOID__INT() {}


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

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

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

LLVM IR (-O2):
define void @g_cclosure_marshal_VOID__INT() {
ret void
}
/* Variables and functions */
double sin(double);
double cos(double x) { return sin(1.5707963267948966192313216916398 - x); }


x86 assembly (clang, -O0):
<cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos>:
movsd  0xee8(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    1030 <sin@plt>

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

LLVM IR (-O2):
define double @cos(double %0) {
%2 = fsub double 0x3FF921FB54442D18, %0
%3 = tail call double @sin(double %2)
ret double %3
}
void farpokeb(unsigned int sel, void *off, unsigned char v) {
  __asm__("push %%fs\n\t"
          "mov  %0, %%fs\n\t"
          "movb %2, %%fs:(%1)\n\t"
          "pop %%fs"
          :
          : "g"(sel), "r"(off), "r"(v));
}


x86 assembly (clang, -O0):
<farpokeb>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    -0x11(%rbp),%cl
mov    %edx,-0x18(%rbp)
push   %fs
mov    -0x18(%rbp),%fs
mov    %cl,%fs:(%rax)
pop    %fs
pop    %rbp
ret

x86 assembly (clang, -O2):
<farpokeb>:
mov    %edi,-0x4(%rsp)
push   %fs
mov    -0x4(%rsp),%fs
mov    %dl,%fs:(%rsi)
pop    %fs
ret

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

LLVM IR (-O2):
define void @farpokeb(i32 %0, i8* %1, i8 zeroext %2) {
tail call void asm sideeffect "push %fs\0A\09mov $0, %fs\0A\09movb $2, %fs:($1)\0A\09pop %fs", "imr,r,r,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i8 %2)
ret void
}
void mysub(int n, double *x, double *y) { return; }


x86 assembly (clang, -O0):
<mysub>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @mysub(i32 %0, double* %1, double* %2) {
%4 = alloca i32
%5 = alloca double*
%6 = alloca double*
store i32 %0, i32* %4
store double* %1, double** %5
store double* %2, double** %6
ret void
}

LLVM IR (-O2):
define void @mysub(i32 %0, double* nocapture %1, double* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ brc(int, char);
void ich(int pn) { brc(pn, '@'); }


x86 assembly (clang, -O0):
<ich>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x40,%esi
call   1030 <brc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ich>:
mov    $0x40,%esi
jmp    1030 <brc@plt>

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

LLVM IR (-O2):
define void @ich(i32 %0) {
%2 = tail call i32 @brc(i32 %0, i8 signext 64)
ret void
}
/* Variables and functions */
double frexpf(double, int *);
double frexp(double value, int *pExponent) { return frexpf(value, pExponent); }


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

x86 assembly (clang, -O2):
<frexp>:
jmp    1030 <frexpf@plt>

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

LLVM IR (-O2):
define double @frexp(double %0, i32* nocapture %1) {
%3 = tail call double @frexpf(double %0, i32* %1)
ret double %3
}
int test_imm_2Dint8_reg(signed char val) {
  return ((val) & (-0x2D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_2Dint8_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, -45
%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_2Dint8_reg(i8 signext %0) {
%2 = and i8 %0, -45
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t gf_mul(uint8_t a, uint8_t b) {
  int sum_log;
  while (b) {
    if (b & 1) {
      sum_log ^= a;
    }
    a = (a << 1) ^ (a & 0x80 ? 0x1d : 0);
    b >>= 1;
  }
  return sum_log;
}


x86 assembly (clang, -O0):
<gf_mul>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     115b <gf_mul+0x5b>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     112c <gf_mul+0x2c>
mov    -0x4(%rbp),%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    -0x4(%rbp),%esi
and    $0x80,%esi
xor    %ecx,%ecx
mov    $0x1d,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
xor    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110a <gf_mul+0xa>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf_mul>:
test   %esi,%esi
je     1133 <gf_mul+0x33>
mov    %esi,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %esi,%edx
and    $0x1,%edx
neg    %edx
and    %edi,%edx
xor    %edx,%eax
lea    (%rdi,%rdi,1),%edx
movsbl %dil,%edi
shr    $0x7,%edi
and    $0x1d,%edi
xor    %edx,%edi
sar    %ecx
cmp    $0x1,%esi
mov    %ecx,%esi
ja     1110 <gf_mul+0x10>
ret

LLVM IR (-O0):
define i32 @gf_mul(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %28
9: ; preds = %6
%10 = load i32, i32* %4
%11 = and i32 %10, 1
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = xor i32 %15, %14
store i32 %16, i32* %5
br label %17
17: ; preds = %13, %9
%18 = load i32, i32* %3
%19 = shl i32 %18, 1
%20 = load i32, i32* %3
%21 = and i32 %20, 128
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 29, i32 0
%25 = xor i32 %19, %24
store i32 %25, i32* %3
%26 = load i32, i32* %4
%27 = ashr i32 %26, 1
store i32 %27, i32* %4
br label %6
28: ; preds = %6
%29 = load i32, i32* %5
ret i32 %29
}

LLVM IR (-O2):
define i32 @gf_mul(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %19, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %11, %4 ], [ undef, %2 ]
%6 = phi i32 [ %17, %4 ], [ %1, %2 ]
%7 = phi i32 [ %16, %4 ], [ %0, %2 ]
%8 = and i32 %6, 1
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 0, i32 %7
%11 = xor i32 %10, %5
%12 = shl i32 %7, 1
%13 = and i32 %7, 128
%14 = icmp eq i32 %13, 0
%15 = select i1 %14, i32 0, i32 29
%16 = xor i32 %15, %12
%17 = ashr i32 %6, 1
%18 = icmp ult i32 %6, 2
br i1 %18, label %19, label %4
19: ; preds = %4, %2
%20 = phi i32 [ undef, %2 ], [ %11, %4 ]
ret i32 %20
}