xunge/DecIR huggingface dataset:
void kgsl_ptpool_destroy(struct kgsl_ptpool *pool) {}


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

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

LLVM IR (-O0):
%struct.kgsl_ptpool = type opaque
define void @kgsl_ptpool_destroy(%struct.kgsl_ptpool* %0) {
%2 = alloca %struct.kgsl_ptpool*
store %struct.kgsl_ptpool* %0, %struct.kgsl_ptpool** %2
ret void
}

LLVM IR (-O2):
%struct.kgsl_ptpool = type opaque
define void @kgsl_ptpool_destroy(%struct.kgsl_ptpool* nocapture %0) {
ret void
}
int fun1102() { return 1102; }


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

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

LLVM IR (-O0):
define i32 @fun1102() {
ret i32 1102
}

LLVM IR (-O2):
define i32 @fun1102() {
ret i32 1102
}
/* Variables and functions */
double pow(double, float);
float convertMidiToFreq(float midivalue) {
  return 440.0 * pow(2.0, (midivalue - 69.f) * 1.f / 12.f);
}


x86 assembly (clang, -O0):
<convertMidiToFreq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm1
movss  0xeee(%rip),%xmm0
subss  %xmm0,%xmm1
movss  0xede(%rip),%xmm0
mulss  %xmm0,%xmm1
movss  0xece(%rip),%xmm0
divss  %xmm0,%xmm1
movsd  0xeba(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xea2(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertMidiToFreq>:
push   %rax
movaps %xmm0,%xmm1
addss  0xee4(%rip),%xmm1
divss  0xee0(%rip),%xmm1
movsd  0xedc(%rip),%xmm0
call   1030 <pow@plt>
mulsd  0xed7(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @convertMidiToFreq(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fsub float %3, 6.900000e+01
%5 = fmul float %4, 1.000000e+00
%6 = fdiv float %5, 1.200000e+01
%7 = call double @pow(double 2.000000e+00, float %6)
%8 = fmul double 4.400000e+02, %7
%9 = fptrunc double %8 to float
ret float %9
}

LLVM IR (-O2):
define float @convertMidiToFreq(float %0) {
%2 = fadd float %0, -6.900000e+01
%3 = fdiv float %2, 1.200000e+01
%4 = tail call double @pow(double 2.000000e+00, float %3)
%5 = fmul double %4, 4.400000e+02
%6 = fptrunc double %5 to float
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ print(int, int, int, int, int);
int main(void) {
  print(97, 98, 99, 100, 101);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x61,%edi
mov    $0x62,%esi
mov    $0x63,%edx
mov    $0x64,%ecx
mov    $0x65,%r8d
call   1030 <print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x61,%edi
mov    $0x62,%esi
mov    $0x63,%edx
mov    $0x64,%ecx
mov    $0x65,%r8d
call   1030 <print@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @print(i32 97, i32 98, i32 99, i32 100, i32 101)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print(i32 97, i32 98, i32 99, i32 100, i32 101)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ io_wait();
int /*<<< orphan*/ outw(unsigned short, int);
void outw_p(unsigned short value, int port) {
  outw(value, port);
  io_wait();
}


x86 assembly (clang, -O0):
<outw_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x8(%rbp),%esi
movzwl %ax,%edi
call   1040 <outw@plt>
mov    $0x0,%al
call   1030 <io_wait@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outw_p>:
push   %rax
call   1040 <outw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <io_wait@plt>

LLVM IR (-O0):
define void @outw_p(i16 zeroext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i16, i16* %3
%6 = load i32, i32* %4
%7 = call i32 @outw(i16 zeroext %5, i32 %6)
%8 = call i32 (...) @io_wait()
ret void
}

LLVM IR (-O2):
define void @outw_p(i16 zeroext %0, i32 %1) {
%3 = tail call i32 @outw(i16 zeroext %0, i32 %1)
%4 = tail call i32 (...) @io_wait()
ret void
}
int test_imm_0Auint32_mem(unsigned int *val) {
  return ((*val) & (0x0A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Auint32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0xa,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_0Auint32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 10
%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_0Auint32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 10
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_get_temp_dir() {
  printf("NOT IMPLEMENTED:"
         "pa_get_temp_dir"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"NOT IMPLEMENTED:pa_get_temp_dir\0A\00"
define i32 @pa_get_temp_dir() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [32 x i8] c"NOT IMPLEMENTED:pa_get_temp_dir\00"
define i32 @pa_get_temp_dir() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
struct dos_file_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dos_unix_path(int, int);
struct dos_file_list *find_first_file(int /*<<< orphan*/);
struct dos_file_list *dos_find_first_file(int addr) {
  return find_first_file(dos_unix_path(addr, 1));
}


x86 assembly (clang, -O0):
<dos_find_first_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1040 <dos_unix_path@plt>
mov    %eax,%edi
call   1030 <find_first_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dos_find_first_file>:
push   %rax
mov    $0x1,%esi
call   1040 <dos_unix_path@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <find_first_file@plt>

LLVM IR (-O0):
%struct.dos_file_list = type { i32 }
define %struct.dos_file_list* @dos_find_first_file(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @dos_unix_path(i32 %3, i32 1)
%5 = call %struct.dos_file_list* @find_first_file(i32 %4)
ret %struct.dos_file_list* %5
}

LLVM IR (-O2):
%struct.dos_file_list = type { i32 }
define %struct.dos_file_list* @dos_find_first_file(i32 %0) {
%2 = tail call i32 @dos_unix_path(i32 %0, i32 1)
%3 = tail call %struct.dos_file_list* @find_first_file(i32 %2)
ret %struct.dos_file_list* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("This test is not relevant on this platform\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [44 x i8] c"This test is not relevant on this platform\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [43 x i8] c"This test is not relevant on this platform\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void I2CNACKPositionConfig(unsigned long ulBase, unsigned long ulNACKPosition) {
  ;

  ;
  (*((volatile unsigned long *)(ulBase + 0x00000000))) &= ~0x00000800;
  (*((volatile unsigned long *)(ulBase + 0x00000000))) |= ulNACKPosition;
}


x86 assembly (clang, -O0):
<I2CNACKPositionConfig>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
and    $0xfffffffffffff7ff,%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
or     %rdx,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2CNACKPositionConfig>:
andq   $0xfffffffffffff7ff,(%rdi)
or     %rsi,(%rdi)
ret

LLVM IR (-O0):
define void @I2CNACKPositionConfig(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = add i64 %5, 0
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -2049
store volatile i64 %9, i64* %7
%10 = load i64, i64* %4
%11 = load i64, i64* %3
%12 = add i64 %11, 0
%13 = inttoptr i64 %12 to i64*
%14 = load volatile i64, i64* %13
%15 = or i64 %14, %10
store volatile i64 %15, i64* %13
ret void
}

LLVM IR (-O2):
define void @I2CNACKPositionConfig(i64 %0, i64 %1) {
%3 = inttoptr i64 %0 to i64*
%4 = load volatile i64, i64* %3
%5 = and i64 %4, -2049
store volatile i64 %5, i64* %3
%6 = load volatile i64, i64* %3
%7 = or i64 %6, %1
store volatile i64 %7, i64* %3
ret void
}
unsigned int to_intconvertor(unsigned char array[]) {
  unsigned int n;
  n = array[0];
  n <<= 8;
  n |= array[1];
  return n;
}


x86 assembly (clang, -O0):
<to_intconvertor>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_intconvertor>:
movzwl (%rdi),%eax
shl    $0x10,%eax
bswap  %eax
ret

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

LLVM IR (-O2):
define i32 @to_intconvertor(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = or i32 %4, %7
ret i32 %8
}
float det22(float a, float b, float c, float d) { return a * d - b * c; }


x86 assembly (clang, -O0):
<det22>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<det22>:
mulss  %xmm2,%xmm1
mulss  %xmm3,%xmm0
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @det22(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %8
%11 = load float, float* %6
%12 = load float, float* %7
%13 = fmul float %11, %12
%14 = fneg float %13
%15 = call float @llvm.fmuladd.f32(float %9, float %10, float %14)
ret float %15
}

LLVM IR (-O2):
define float @det22(float %0, float %1, float %2, float %3) {
%5 = fneg float %1
%6 = fmul float %5, %2
%7 = tail call float @llvm.fmuladd.f32(float %0, float %3, float %6)
ret float %7
}
/* Variables and functions */
unsigned char *strnchr(unsigned char *s, size_t len, unsigned char c) {
  while (len && *s++ != c)
    --len;
  return len ? s : NULL;
}


x86 assembly (clang, -O0):
<strnchr>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x12(%rbp)
je     113f <strnchr+0x3f>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
movzbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    114f <strnchr+0x4f>
jmp    1160 <strnchr+0x60>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1111 <strnchr+0x11>
cmpq   $0x0,-0x10(%rbp)
je     1178 <strnchr+0x78>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1183 <strnchr+0x83>
xor    %eax,%eax
mov    %rax,-0x20(%rbp)
jmp    1183 <strnchr+0x83>
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnchr>:
test   %rsi,%rsi
je     1122 <strnchr+0x22>
mov    %rdi,%rax
add    $0x1,%rax
nopl   0x0(%rax)
cmp    %dl,-0x1(%rax)
je     1124 <strnchr+0x24>
add    $0xffffffffffffffff,%rsi
add    $0x1,%rax
test   %rsi,%rsi
jne    1110 <strnchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strnchr(i8* %0, i64 %1, i8 zeroext %2) {
%4 = icmp eq i64 %1, 0
br i1 %4, label %14, label %7
5: ; preds = %7
%6 = icmp eq i64 %13, 0
br i1 %6, label %14, label %7
7: ; preds = %3, %5
%8 = phi i8* [ %10, %5 ], [ %0, %3 ]
%9 = phi i64 [ %13, %5 ], [ %1, %3 ]
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, %2
%13 = add i64 %9, -1
br i1 %12, label %14, label %5
14: ; preds = %7, %5, %3
%15 = phi i8* [ null, %3 ], [ null, %5 ], [ %10, %7 ]
ret i8* %15
}
/* Variables and functions */
int /*<<< orphan*/ ft_putendl(char *);
int /*<<< orphan*/ ft_putstr(char *);
void unknow_cmd(char *str) {
  ft_putstr("msh: Unknown command '");
  ft_putstr(str);
  ft_putendl("'");
}


x86 assembly (clang, -O0):
<unknow_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <ft_putstr@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ft_putstr@plt>
lea    0xecd(%rip),%rdi
call   1030 <ft_putendl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unknow_cmd>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1040 <ft_putstr@plt>
mov    %rbx,%rdi
call   1040 <ft_putstr@plt>
lea    0xed6(%rip),%rdi
pop    %rbx
jmp    1030 <ft_putendl@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"msh: Unknown command '\00"
@.str.1 = [2 x i8] c"'\00"
define void @unknow_cmd(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @ft_putstr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @ft_putstr(i8* %4)
%6 = call i32 @ft_putendl(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"msh: Unknown command '\00"
@.str.1 = [2 x i8] c"'\00"
define void @unknow_cmd(i8* %0) {
%2 = tail call i32 @ft_putstr(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @ft_putstr(i8* %0)
%4 = tail call i32 @ft_putendl(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int soma(x, y)
int x;
int y;
{ return x + y; }


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

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

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

LLVM IR (-O2):
define i32 @soma(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
struct bufferevent {
  int dummy;
};

/* Variables and functions */
short BEV_EVENT_ERROR;
int /*<<< orphan*/ bufferevent_free(struct bufferevent *);
int /*<<< orphan*/ perror(char *);
void errorcb(struct bufferevent *bev, short error, void *ctx) {
  if (error & BEV_EVENT_ERROR) {
    perror("error:");
  }
  bufferevent_free(bev);
}


x86 assembly (clang, -O0):
<errorcb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %rdx,-0x18(%rbp)
movswl -0xa(%rbp),%eax
mov    0x2eae(%rip),%rcx
movswl (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     115c <errorcb+0x3c>
lea    0xea9(%rip),%rdi
call   1040 <perror@plt>
mov    -0x8(%rbp),%rdi
call   1030 <bufferevent_free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<errorcb>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ec5(%rip),%rax
test   %si,(%rax)
jne    1139 <errorcb+0x19>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <bufferevent_free@plt>
lea    0xec0(%rip),%rdi
call   1040 <perror@plt>
jmp    1130 <errorcb+0x10>

LLVM IR (-O0):
%struct.bufferevent = type { i32 }
@BEV_EVENT_ERROR = global i16 0
@.str = [7 x i8] c"error:\00"
define void @errorcb(%struct.bufferevent* %0, i16 signext %1, i8* %2) {
%4 = alloca %struct.bufferevent*
%5 = alloca i16
%6 = alloca i8*
store %struct.bufferevent* %0, %struct.bufferevent** %4
store i16 %1, i16* %5
store i8* %2, i8** %6
%7 = load i16, i16* %5
%8 = sext i16 %7 to i32
%9 = load i16, i16* @BEV_EVENT_ERROR
%10 = sext i16 %9 to i32
%11 = and i32 %8, %10
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %3
%16 = load %struct.bufferevent*, %struct.bufferevent** %4
%17 = call i32 @bufferevent_free(%struct.bufferevent* %16)
ret void
}

LLVM IR (-O2):
%struct.bufferevent = type { i32 }
@BEV_EVENT_ERROR = global i16 0
@.str = [7 x i8] c"error:\00"
define void @errorcb(%struct.bufferevent* %0, i16 signext %1, i8* nocapture readnone %2) {
%4 = load i16, i16* @BEV_EVENT_ERROR
%5 = and i16 %4, %1
%6 = icmp eq i16 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %3
%10 = tail call i32 @bufferevent_free(%struct.bufferevent* %0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t si_reg(uint32_t address) { return (address & 0xffff) >> 2; }


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

x86 assembly (clang, -O2):
<si_reg>:
mov    %edi,%eax
shr    $0x2,%eax
and    $0x3fff,%eax
ret

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

LLVM IR (-O2):
define i32 @si_reg(i32 %0) {
%2 = lshr i32 %0, 2
%3 = and i32 %2, 16383
ret i32 %3
}
/* Variables and functions */
int int_size_is_32();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("int size is 32: %d\n", int_size_is_32());
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <int_size_is_32@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"int size is 32: %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @int_size_is_32()
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"int size is 32: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @int_size_is_32()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
unsigned long long int bar(unsigned long long int x) {
  x >>= sizeof(long long int) * 8 - 1;
  if (x != 0 && x != 1)
    link_error();
  return x;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x3f,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1145 <bar+0x35>
cmpq   $0x1,-0x8(%rbp)
je     1145 <bar+0x35>
mov    $0x0,%al
call   1030 <link_error@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbx
mov    %rdi,%rbx
shr    $0x3f,%rbx
test   %rdi,%rdi
jns    1129 <bar+0x19>
test   %rbx,%rbx
jne    1129 <bar+0x19>
xor    %eax,%eax
call   1030 <link_error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @bar(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 63
store i64 %4, i64* %2
%5 = load i64, i64* %2
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i64, i64* %2
%9 = icmp ne i64 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (...) @link_error()
br label %12
12: ; preds = %10, %7, %1
%13 = load i64, i64* %2
ret i64 %13
}

LLVM IR (-O2):
define i64 @bar(i64 %0) {
%2 = lshr i64 %0, 63
%3 = icmp slt i64 %0, 0
%4 = icmp ne i64 %2, 1
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 (...) @link_error()
br label %8
8: ; preds = %6, %1
ret i64 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
size_t wcsnlen(int /*<<< orphan*/ const *, size_t);
int /*<<< orphan*/ wmemcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                           size_t);
int /*<<< orphan*/ wmemset(int /*<<< orphan*/ *, int /*<<< orphan*/, size_t);
wchar_t *wcpncpy(wchar_t *restrict whither, const wchar_t *restrict whence,
                 size_t maxlen) {
  size_t n = wcsnlen(whence, maxlen);
  wmemcpy(whither, whence, n);
  wmemset(whither + n, 0, maxlen - n);
  return whither + n;
}


x86 assembly (clang, -O0):
<wcpncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <wcsnlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <wmemcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rdx
sub    -0x20(%rbp),%rdx
xor    %esi,%esi
call   1040 <wmemset@plt>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wcpncpy>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1050 <wcsnlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1030 <wmemcpy@plt>
lea    (%r15,%rbx,4),%r14
sub    %rbx,%r12
mov    %r14,%rdi
xor    %esi,%esi
mov    %r12,%rdx
call   1040 <wmemset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32* @wcpncpy(i32* noalias %0, i32* noalias %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%8 = load i32*, i32** %5
%9 = load i64, i64* %6
%10 = call i64 @wcsnlen(i32* %8, i64 %9)
store i64 %10, i64* %7
%11 = load i32*, i32** %4
%12 = load i32*, i32** %5
%13 = load i64, i64* %7
%14 = call i32 @wmemcpy(i32* %11, i32* %12, i64 %13)
%15 = load i32*, i32** %4
%16 = load i64, i64* %7
%17 = getelementptr inbounds i32, i32* %15, i64 %16
%18 = load i64, i64* %6
%19 = load i64, i64* %7
%20 = sub i64 %18, %19
%21 = call i32 @wmemset(i32* %17, i32 0, i64 %20)
%22 = load i32*, i32** %4
%23 = load i64, i64* %7
%24 = getelementptr inbounds i32, i32* %22, i64 %23
ret i32* %24
}

LLVM IR (-O2):
define i32* @wcpncpy(i32* noalias %0, i32* noalias %1, i64 %2) {
%4 = tail call i64 @wcsnlen(i32* %1, i64 %2)
%5 = tail call i32 @wmemcpy(i32* %0, i32* %1, i64 %4)
%6 = getelementptr inbounds i32, i32* %0, i64 %4
%7 = sub i64 %2, %4
%8 = tail call i32 @wmemset(i32* %6, i32 0, i64 %7)
ret i32* %6
}
/* Variables and functions */
int /*<<< orphan*/ free(struct foo *);
scalar_t__ malloc(size_t);
int main() {
  struct foo {
    int zoo;
    int bar[10];
    float baz;
  };
  struct foo *k =
      (struct foo *)malloc(((size_t) & (((struct foo *)0)->bar[4])));
  k->bar[1] = 9;
  free(k);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
add    $0x14,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x9,0x8(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x14,%edi
call   1040 <malloc@plt>
movl   $0x9,0x8(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.foo = type { i32, [10 x i32], float }
%struct.foo.0 = type opaque
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.foo*
store i32 0, i32* %1
%3 = call i64 @malloc(i64 ptrtoint (i32* getelementptr inbounds (%struct.foo, %struct.foo* null, i32 0, i32 1, i64 4) to i64))
%4 = inttoptr i64 %3 to %struct.foo*
store %struct.foo* %4, %struct.foo** %2
%5 = load %struct.foo*, %struct.foo** %2
%6 = getelementptr inbounds %struct.foo, %struct.foo* %5, i32 0, i32 1
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %6, i64 0, i64 1
store i32 9, i32* %7
%8 = load %struct.foo*, %struct.foo** %2
%9 = bitcast %struct.foo* %8 to %struct.foo.0*
%10 = call i32 @free(%struct.foo.0* %9)
ret i32 0
}

LLVM IR (-O2):
%struct.foo = type { i32, [10 x i32], float }
%struct.foo.0 = type opaque
define i32 @main() {
%1 = tail call i64 @malloc(i64 20)
%2 = inttoptr i64 %1 to %struct.foo*
%3 = getelementptr inbounds %struct.foo, %struct.foo* %2, i64 0, i32 1, i64 1
store i32 9, i32* %3
%4 = inttoptr i64 %1 to %struct.foo.0*
%5 = tail call i32 @free(%struct.foo.0* %4)
ret i32 0
}
void dv3_mult(double *a, double *b) {
  a[0] += b[0];
  a[1] += b[1];
  a[2] += b[2];
}


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

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

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

LLVM IR (-O2):
define void @dv3_mult(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = load double, double* %0
%5 = fadd double %3, %4
store double %5, double* %0
%6 = getelementptr inbounds double, double* %1, i64 1
%7 = load double, double* %6
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = fadd double %7, %9
store double %10, double* %8
%11 = getelementptr inbounds double, double* %1, i64 2
%12 = load double, double* %11
%13 = getelementptr inbounds double, double* %0, i64 2
%14 = load double, double* %13
%15 = fadd double %12, %14
store double %15, double* %13
ret void
}
void pm8921_bms_start_ocv_updates(void) {}


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

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

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

LLVM IR (-O2):
define void @pm8921_bms_start_ocv_updates() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ check1();
int /*<<< orphan*/ check2();
int main() {
  check1();
  check2();
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @check1()
%2 = tail call i32 (...) @check2()
ret i32 0
}
/* Type definitions */
struct flock {
  scalar_t__ l_len;
  scalar_t__ l_start;
  int /*<<< orphan*/ l_whence;
  int /*<<< orphan*/ l_type;
};

/* Variables and functions */
int /*<<< orphan*/ F_RDLCK;
int /*<<< orphan*/ F_SETLKW;
int /*<<< orphan*/ SEEK_SET;
int fcntl(int, int /*<<< orphan*/, struct flock *);
int read_lock(int fd) {
  struct flock lock;
  lock.l_type = F_RDLCK;
  lock.l_whence = SEEK_SET;
  lock.l_start = 0;
  lock.l_len = 0;
  return fcntl(fd, F_SETLKW, &lock);
}


x86 assembly (clang, -O0):
<read_lock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ea6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
lea    -0x20(%rbp),%rdx
call   1030 <fcntl@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_lock>:
sub    $0x18,%rsp
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
mov    0x2eb0(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
call   1030 <fcntl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.flock = type { i64, i64, i32, i32 }
@F_RDLCK = global i32 0
@SEEK_SET = global i32 0
@F_SETLKW = global i32 0
define i32 @read_lock(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.flock
store i32 %0, i32* %2
%4 = load i32, i32* @F_RDLCK
%5 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 3
store i32 %4, i32* %5
%6 = load i32, i32* @SEEK_SET
%7 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 2
store i32 %6, i32* %7
%8 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 1
store i64 0, i64* %8
%9 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 0
store i64 0, i64* %9
%10 = load i32, i32* %2
%11 = load i32, i32* @F_SETLKW
%12 = call i32 @fcntl(i32 %10, i32 %11, %struct.flock* %3)
ret i32 %12
}

LLVM IR (-O2):
%struct.flock = type { i64, i64, i32, i32 }
@F_RDLCK = global i32 0
@SEEK_SET = global i32 0
@F_SETLKW = global i32 0
define i32 @read_lock(i32 %0) {
%2 = alloca %struct.flock
%3 = bitcast %struct.flock* %2 to i8*
%4 = load i32, i32* @F_RDLCK
%5 = getelementptr inbounds %struct.flock, %struct.flock* %2, i64 0, i32 3
store i32 %4, i32* %5
%6 = load i32, i32* @SEEK_SET
%7 = getelementptr inbounds %struct.flock, %struct.flock* %2, i64 0, i32 2
store i32 %6, i32* %7
%8 = bitcast %struct.flock* %2 to i8*
%9 = load i32, i32* @F_SETLKW
%10 = call i32 @fcntl(i32 %0, i32 %9, %struct.flock* %2)
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ BUG_ON(int);
int lt_param_idx(int link_bw) {
  int idx;
  switch (link_bw) {
  case 6:
    idx = 0;
    break;
  case 10:
    idx = 1;
    break;
  case 20:
    idx = 2;
    break;
  default:
    BUG_ON(1);
  }
  return idx;
}


x86 assembly (clang, -O0):
<lt_param_idx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x6,%eax
je     1151 <lt_param_idx+0x41>
jmp    112f <lt_param_idx+0x1f>
mov    -0xc(%rbp),%eax
sub    $0xa,%eax
je     115d <lt_param_idx+0x4d>
jmp    1140 <lt_param_idx+0x30>
mov    -0xc(%rbp),%eax
sub    $0x14,%eax
je     1169 <lt_param_idx+0x59>
jmp    1175 <lt_param_idx+0x65>
movl   $0x0,-0x8(%rbp)
jmp    117f <lt_param_idx+0x6f>
movl   $0x1,-0x8(%rbp)
jmp    117f <lt_param_idx+0x6f>
movl   $0x2,-0x8(%rbp)
jmp    117f <lt_param_idx+0x6f>
mov    $0x1,%edi
call   1030 <BUG_ON@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lt_param_idx>:
cmp    $0x6,%edi
je     1125 <lt_param_idx+0x15>
cmp    $0x14,%edi
je     1128 <lt_param_idx+0x18>
cmp    $0xa,%edi
jne    112e <lt_param_idx+0x1e>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret
mov    $0x2,%eax
ret
push   %rax
mov    $0x1,%edi
call   1030 <BUG_ON@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @lt_param_idx(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %8 [
i32 6, label %5
i32 10, label %6
i32 20, label %7
]
5: ; preds = %1
store i32 0, i32* %3
br label %10
6: ; preds = %1
store i32 1, i32* %3
br label %10
7: ; preds = %1
store i32 2, i32* %3
br label %10
8: ; preds = %1
%9 = call i32 @BUG_ON(i32 1)
br label %10
10: ; preds = %8, %7, %6, %5
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @lt_param_idx(i32 %0) {
switch i32 %0, label %4 [
i32 6, label %6
i32 10, label %2
i32 20, label %3
]
2: ; preds = %1
br label %6
3: ; preds = %1
br label %6
4: ; preds = %1
%5 = tail call i32 @BUG_ON(i32 1)
br label %6
6: ; preds = %1, %4, %3, %2
%7 = phi i32 [ undef, %4 ], [ 2, %3 ], [ 1, %2 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
char *strcat(char *destination, const char *source) {
  char *dst = destination;
  while (*dst)
    dst++;
  strcpy(dst, source);
  return destination;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <strcat+0x36>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <strcat+0x18>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rdi
nopl   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi)
lea    0x1(%rdi),%rdi
jne    1120 <strcat+0x10>
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %4, i8* %1)
ret i8* %0
}
void av_stream_get_end_pts() {}


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

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

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

LLVM IR (-O2):
define void @av_stream_get_end_pts() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("%d", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
double M_PI_4;
double exp(double);
double pow(double, double);
double f(double t) { return pow(M_PI_4 * t, M_PI_4) * exp(-M_PI_4 * t); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    0x2eb4(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    0x2ea4(%rip),%rax
movsd  (%rax),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
mov    0x2e8f(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
sub    $0x10,%rsp
movapd %xmm0,%xmm2
movsd  %xmm0,(%rsp)
mov    0x2eb3(%rip),%rbx
movsd  (%rbx),%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm2,%xmm0
call   1040 <pow@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rbx),%xmm0
xorpd  0xea8(%rip),%xmm0
mulsd  (%rsp),%xmm0
call   1030 <exp@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI_4 = global double 0.000000e+00
define double @f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* @M_PI_4
%4 = load double, double* %2
%5 = fmul double %3, %4
%6 = load double, double* @M_PI_4
%7 = call double @pow(double %5, double %6)
%8 = load double, double* @M_PI_4
%9 = fneg double %8
%10 = load double, double* %2
%11 = fmul double %9, %10
%12 = call double @exp(double %11)
%13 = fmul double %7, %12
ret double %13
}

LLVM IR (-O2):
@M_PI_4 = global double 0.000000e+00
define double @f(double %0) {
%2 = load double, double* @M_PI_4
%3 = fmul double %2, %0
%4 = tail call double @pow(double %3, double %2)
%5 = load double, double* @M_PI_4
%6 = fneg double %5
%7 = fmul double %6, %0
%8 = tail call double @exp(double %7)
%9 = fmul double %4, %8
ret double %9
}
/* Variables and functions */
int /*<<< orphan*/ clearfiles(char *, char *);
void removetags(void) { clearfiles("iptraf", "/var/lock/iptraf-ng"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"iptraf\00"
@.str.1 = [20 x i8] c"/var/lock/iptraf-ng\00"
define void @removetags() {
%1 = call i32 @clearfiles(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"iptraf\00"
@.str.1 = [20 x i8] c"/var/lock/iptraf-ng\00"
define void @removetags() {
%1 = tail call i32 @clearfiles(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void free_filelist(char **filelist, int count) {
  int i;
  for (i = 0; i < count; i++)
    free(filelist[i]);
  free(filelist);
}


x86 assembly (clang, -O0):
<free_filelist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_filelist+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_filelist+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_filelist>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_filelist+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_filelist+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_filelist(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
tail call void @free(i8* %9)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = bitcast i8** %0 to i8*
tail call void @free(i8* %13)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
};
typedef int in_addr_t;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ __ipparse(struct sockaddr_in *, int /*<<< orphan*/, char const *);
in_addr_t inet_addr(const char *p) {
  struct sockaddr_in sin;
  if (__ipparse(&sin, AF_INET, p) < 0)
    return -1;
  return sin.sin_addr.s_addr;
}


x86 assembly (clang, -O0):
<inet_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
call   1030 <__ipparse@plt>
cmp    $0x0,%rax
jge    1148 <inet_addr+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <inet_addr+0x3e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inet_addr>:
push   %rax
mov    %rdi,%rdx
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdi
call   1030 <__ipparse@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
js     1135 <inet_addr+0x25>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@AF_INET = global i32 0
define i32 @inet_addr(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.sockaddr_in
store i8* %0, i8** %3
%5 = load i32, i32* @AF_INET
%6 = load i8*, i8** %3
%7 = call i64 @__ipparse(%struct.sockaddr_in* %4, i32 %5, i8* %6)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 -1, i32* %2
br label %14
10: ; preds = %1
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i32 0, i32 0
%12 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %11, i32 0, i32 0
%13 = load i32, i32* %12
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@AF_INET = global i32 0
define i32 @inet_addr(i8* %0) {
%2 = alloca %struct.sockaddr_in
%3 = bitcast %struct.sockaddr_in* %2 to i8*
%4 = load i32, i32* @AF_INET
%5 = call i64 @__ipparse(%struct.sockaddr_in* %2, i32 %4, i8* %0)
%6 = icmp slt i64 %5, 0
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0, i32 0
%8 = load i32, i32* %7
%9 = select i1 %6, i32 -1, i32 %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ my_external_task(int, char *);
void my_task_that_invokes_task_cpu(int x, char *y) { my_external_task(x, y); }


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

x86 assembly (clang, -O2):
<my_task_that_invokes_task_cpu>:
jmp    1030 <my_external_task@plt>

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

LLVM IR (-O2):
define void @my_task_that_invokes_task_cpu(i32 %0, i8* %1) {
%3 = tail call i32 @my_external_task(i32 %0, i8* %1)
ret void
}