xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char **argv) {
  char dirname[256];
  getcwd(dirname, 256);
  printf("%s\n", dirname);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%8 = call i32 @getcwd(i8* %7, i32 256)
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @getcwd(i8* %4, i32 256)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
float lerp(float from, float to, float value) {
  return (1.f - value) * from + value * to;
}


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

x86 assembly (clang, -O2):
<lerp>:
movss  0xef8(%rip),%xmm3
subss  %xmm2,%xmm3
mulss  %xmm2,%xmm1
mulss  %xmm3,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @lerp(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* %6
%8 = fsub float 1.000000e+00, %7
%9 = load float, float* %4
%10 = load float, float* %6
%11 = load float, float* %5
%12 = fmul float %10, %11
%13 = call float @llvm.fmuladd.f32(float %8, float %9, float %12)
ret float %13
}

LLVM IR (-O2):
define float @lerp(float %0, float %1, float %2) {
%4 = fsub float 1.000000e+00, %2
%5 = fmul float %1, %2
%6 = tail call float @llvm.fmuladd.f32(float %4, float %0, float %5)
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char, unsigned char,
                          unsigned char, unsigned char, unsigned char);
void print_mac(unsigned char *mac) {
  printf("%02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2], mac[3],
         mac[4], mac[5]);
}


x86 assembly (clang, -O0):
<print_mac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%sil
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%dl
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%r8b
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%r9b
mov    -0x8(%rbp),%rax
lea    0xeb4(%rip),%rdi
movzbl %sil,%esi
movzbl %dl,%edx
movzbl %cl,%ecx
movzbl %r8b,%r8d
movzbl %r9b,%r9d
movzbl 0x5(%rax),%eax
mov    %eax,(%rsp)
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mac>:
push   %rax
movzbl (%rdi),%esi
movzbl 0x1(%rdi),%edx
movzbl 0x2(%rdi),%ecx
movzbl 0x3(%rdi),%r8d
movzbl 0x4(%rdi),%r9d
movzbl 0x5(%rdi),%eax
mov    %eax,(%rsp)
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [31 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\0A\00"
define void @print_mac(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = load i8, i8* %7
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i64 2
%11 = load i8, i8* %10
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 3
%14 = load i8, i8* %13
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 4
%17 = load i8, i8* %16
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 5
%20 = load i8, i8* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8 zeroext %5, i8 zeroext %8, i8 zeroext %11, i8 zeroext %14, i8 zeroext %17, i8 zeroext %20)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"%02x:%02x:%02x:%02x:%02x:%02x\0A\00"
define void @print_mac(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 3
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = load i8, i8* %9
%11 = getelementptr inbounds i8, i8* %0, i64 5
%12 = load i8, i8* %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8 zeroext %2, i8 zeroext %4, i8 zeroext %6, i8 zeroext %8, i8 zeroext %10, i8 zeroext %12)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int strcmp(char *, char *);
int zstrcmp(const void *a_pp, const void *b_pp) {
  assert(a_pp != NULL);
  assert(b_pp != NULL);
  char *a = *(char **)a_pp;
  char *b = *(char **)b_pp;
  return strcmp(a, b);
}


x86 assembly (clang, -O0):
<zstrcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zstrcmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
mov    (%rbx),%rdi
mov    (%r14),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @zstrcmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = load i8*, i8** %4
%12 = icmp ne i8* %11, null
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i8*, i8** %3
%16 = bitcast i8* %15 to i8**
%17 = load i8*, i8** %16
store i8* %17, i8** %5
%18 = load i8*, i8** %4
%19 = bitcast i8* %18 to i8**
%20 = load i8*, i8** %19
store i8* %20, i8** %6
%21 = load i8*, i8** %5
%22 = load i8*, i8** %6
%23 = call i32 @strcmp(i8* %21, i8* %22)
ret i32 %23
}

LLVM IR (-O2):
define i32 @zstrcmp(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = icmp ne i8* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = bitcast i8* %0 to i8**
%10 = load i8*, i8** %9
%11 = bitcast i8* %1 to i8**
%12 = load i8*, i8** %11
%13 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(1) %12)
ret i32 %13
}
/* Variables and functions */
double ltlg1(double, double);
double ltlg2(double, double);
double ltlg(double a, double x) {
  if (x <= 0.0)
    return 0.0;
  if (x <= (1.0 + a))
    return ltlg1(a, x);
  return ltlg2(a, x);
}


x86 assembly (clang, -O0):
<ltlg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     114d <ltlg+0x2d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1196 <ltlg+0x76>
movsd  -0x18(%rbp),%xmm1
movsd  0xea6(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1182 <ltlg+0x62>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <ltlg1@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1196 <ltlg+0x76>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1040 <ltlg2@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltlg>:
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jae    1141 <ltlg+0x21>
movsd  0xece(%rip),%xmm2
addsd  %xmm0,%xmm2
ucomisd %xmm1,%xmm2
jae    1145 <ltlg+0x25>
jmp    1040 <ltlg2@plt>
xorps  %xmm0,%xmm0
ret
jmp    1030 <ltlg1@plt>

LLVM IR (-O0):
define double @ltlg(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %5
%7 = fcmp ole double %6, 0.000000e+00
br i1 %7, label %8, label %9
8: ; preds = %2
store double 0.000000e+00, double* %3
br label %22
9: ; preds = %2
%10 = load double, double* %5
%11 = load double, double* %4
%12 = fadd double 1.000000e+00, %11
%13 = fcmp ole double %10, %12
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load double, double* %4
%16 = load double, double* %5
%17 = call double @ltlg1(double %15, double %16)
store double %17, double* %3
br label %22
18: ; preds = %9
%19 = load double, double* %4
%20 = load double, double* %5
%21 = call double @ltlg2(double %19, double %20)
store double %21, double* %3
br label %22
22: ; preds = %18, %14, %8
%23 = load double, double* %3
ret double %23
}

LLVM IR (-O2):
define double @ltlg(double %0, double %1) {
%3 = fcmp ugt double %1, 0.000000e+00
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = fadd double %0, 1.000000e+00
%6 = fcmp ult double %5, %1
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call double @ltlg1(double %0, double %1)
br label %11
9: ; preds = %4
%10 = tail call double @ltlg2(double %0, double %1)
br label %11
11: ; preds = %2, %9, %7
%12 = phi double [ %8, %7 ], [ %10, %9 ], [ 0.000000e+00, %2 ]
ret double %12
}
int detectOp(char *tk) {
  if (*tk == 42 || *tk == 43 || *tk == 45)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<detectOp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
je     1138 <detectOp+0x38>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     1138 <detectOp+0x38>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1144 <detectOp+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <detectOp+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<detectOp>:
mov    (%rdi),%cl
add    $0xd6,%cl
xor    %eax,%eax
cmp    $0x3,%cl
ja     111a <detectOp+0x1a>
movsbq %cl,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @detectOp(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 42
br i1 %7, label %18, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 43
br i1 %12, label %18, label %13
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 45
br i1 %17, label %18, label %19
18: ; preds = %13, %8, %1
store i32 1, i32* %2
br label %20
19: ; preds = %13
store i32 0, i32* %2
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@switch.table.detectOp = [4 x i32] [i32 1, i32 1, i32 0, i32 1]
define i32 @detectOp(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -42
%4 = icmp ult i8 %3, 4
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i8 %3 to i64
%7 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.detectOp, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ %8, %5 ], [ 0, %1 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ print_int(char);
int /*<<< orphan*/ print_string(char *);
void bar(char a) {
  print_int(a);
  print_string("\n");
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1040 <print_int@plt>
lea    0xec2(%rip),%rdi
call   1030 <print_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
call   1040 <print_int@plt>
lea    0xed3(%rip),%rdi
pop    %rax
jmp    1030 <print_string@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @bar(i8 signext %0) {
%2 = tail call i32 @print_int(i8 signext %0)
%3 = tail call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ whitelist_load();
int /*<<< orphan*/ whitelist_quit();
void whitelist_modified(void) {
  whitelist_quit();
  whitelist_load();
}


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

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

LLVM IR (-O0):
define void @whitelist_modified() {
%1 = call i32 (...) @whitelist_quit()
%2 = call i32 (...) @whitelist_load()
ret void
}

LLVM IR (-O2):
define void @whitelist_modified() {
%1 = tail call i32 (...) @whitelist_quit()
%2 = tail call i32 (...) @whitelist_load()
ret void
}
/* Variables and functions */
bool is_relpath(const char *path) { return (path[0] == '/') ? false : true; }


x86 assembly (clang, -O0):
<is_relpath>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x2f,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_relpath>:
xor    %eax,%eax
cmpb   $0x2f,(%rdi)
setne  %al
ret

LLVM IR (-O0):
define i32 @is_relpath(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 47
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 0, i32 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @is_relpath(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp ne i8 %2, 47
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
scalar_t__ _syscall5(int, void *, void *, void *, void *, void *);
int errno;
int umount2(const char *target, int flags) {
  int ret = (int)_syscall5(74, (void *)target, (void *)flags, ((void *)0),
                           ((void *)0), ((void *)0));
  if (ret < 0) {
    errno = -ret;
    return -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<umount2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rdx
mov    $0x4a,%edi
xor    %eax,%eax
mov    %eax,%r9d
mov    %r9,%rcx
mov    %r9,%r8
call   1030 <_syscall5@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1163 <umount2+0x53>
xor    %ecx,%ecx
sub    -0x18(%rbp),%ecx
mov    0x2e8b(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <umount2+0x59>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umount2>:
push   %rax
mov    %rdi,%rax
movslq %esi,%rdx
mov    $0x4a,%edi
mov    %rax,%rsi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <_syscall5@plt>
test   %eax,%eax
js     1132 <umount2+0x22>
pop    %rcx
ret
neg    %eax
mov    0x2ea5(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @umount2(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = call i64 @_syscall5(i32 74, i8* %7, i8* %10, i8* null, i8* null, i8* null)
%12 = trunc i64 %11 to i32
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* %6
%17 = sub nsw i32 0, %16
store i32 %17, i32* @errno
store i32 -1, i32* %3
br label %20
18: ; preds = %2
%19 = load i32, i32* %6
store i32 %19, i32* %3
br label %20
20: ; preds = %18, %15
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @umount2(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = inttoptr i64 %3 to i8*
%5 = tail call i64 @_syscall5(i32 74, i8* %0, i8* %4, i8* null, i8* null, i8* null)
%6 = trunc i64 %5 to i32
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = sub nsw i32 0, %6
store i32 %9, i32* @errno
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ -1, %8 ], [ %6, %2 ]
ret i32 %11
}
float vec3_norm2(const float a[3]) { return vec3_dot(a, a); }


x86 assembly (clang, -O0):
<vec3_norm2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <vec3_dot@plt>
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3_norm2>:
push   %rax
mov    %rdi,%rsi
xor    %eax,%eax
call   1030 <vec3_dot@plt>
cvtsi2ss %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @vec3_norm2(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = load float*, float** %2
%5 = call i32 (float*, float*, ...) bitcast (i32 (...)* @vec3_dot to i32 (float*, float*, ...)*)(float* %3, float* %4)
%6 = sitofp i32 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @vec3_norm2(float* %0) {
%2 = tail call i32 (float*, float*, ...) bitcast (i32 (...)* @vec3_dot to i32 (float*, float*, ...)*)(float* %0, float* %0)
%3 = sitofp i32 %2 to float
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void printError(void) {
  char error_message[30] = "An error has occurred\n";
  write(STDERR_FILENO, error_message, strlen(error_message));
}


x86 assembly (clang, -O0):
<printError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec9(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xec3(%rip),%ax
mov    %ax,-0x4(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printError>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movups 0xee0(%rip),%xmm0
movups %xmm0,0xe(%rsp)
movaps 0xec6(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%ebx
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.printError.error_message = [30 x i8] c"An error has occurred\0A\00\00\00\00\00\00\00\00"
@STDERR_FILENO = global i32 0
define void @printError() {
%1 = alloca [30 x i8]
%2 = bitcast [30 x i8]* %1 to i8*
%3 = load i32, i32* @STDERR_FILENO
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%6 = call i32 @strlen(i8* %5)
%7 = call i32 @write(i32 %3, i8* %4, i32 %6)
ret void
}

LLVM IR (-O2):
@__const.printError.error_message = [30 x i8] c"An error has occurred\0A\00\00\00\00\00\00\00\00"
@STDERR_FILENO = global i32 0
define void @printError() {
%1 = alloca [30 x i8]
%2 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @STDERR_FILENO
%4 = call i32 @strlen(i8* %2)
%5 = call i32 @write(i32 %3, i8* %2, i32 %4)
ret void
}
int test_imm_DCuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xDC << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_DCuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 220
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double log(double);
double _debug_log(double x) { return log(x); }


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

x86 assembly (clang, -O2):
<_debug_log>:
jmp    1030 <log@plt>

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

LLVM IR (-O2):
define double @_debug_log(double %0) {
%2 = tail call double @log(double %0)
ret double %2
}
void msm_pm_write_boot_vector(unsigned int cpu, unsigned long address) {}


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

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

LLVM IR (-O0):
define void @msm_pm_write_boot_vector(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
define void @msm_pm_write_boot_vector(i32 %0, i64 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ svga_writew_common(int /*<<< orphan*/, int /*<<< orphan*/,
                                      int, void *);
void svga_writew_linear(uint32_t addr, uint16_t val, void *p) {
  svga_writew_common(addr, val, 1, p);
}


x86 assembly (clang, -O0):
<svga_writew_linear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
call   1030 <svga_writew_common@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svga_writew_linear>:
mov    %rdx,%rcx
mov    $0x1,%edx
jmp    1030 <svga_writew_common@plt>

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

LLVM IR (-O2):
define void @svga_writew_linear(i32 %0, i32 %1, i8* %2) {
%4 = tail call i32 @svga_writew_common(i32 %0, i32 %1, i32 1, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ turnOffLed(int);
void turnOffLight2(void) { turnOffLed(4); }


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

x86 assembly (clang, -O2):
<turnOffLight2>:
mov    $0x4,%edi
jmp    1030 <turnOffLed@plt>

LLVM IR (-O0):
define void @turnOffLight2() {
%1 = call i32 @turnOffLed(i32 4)
ret void
}

LLVM IR (-O2):
define void @turnOffLight2() {
%1 = tail call i32 @turnOffLed(i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hello World!");
  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 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void rewrite_ip6_addr(struct netutil_ip6hdr *ip6hr, unsigned char new_addr,
                      int is_src) {}


x86 assembly (clang, -O0):
<rewrite_ip6_addr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.netutil_ip6hdr = type opaque
define void @rewrite_ip6_addr(%struct.netutil_ip6hdr* %0, i8 zeroext %1, i32 %2) {
%4 = alloca %struct.netutil_ip6hdr*
%5 = alloca i8
%6 = alloca i32
store %struct.netutil_ip6hdr* %0, %struct.netutil_ip6hdr** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
ret void
}

LLVM IR (-O2):
%struct.netutil_ip6hdr = type opaque
define void @rewrite_ip6_addr(%struct.netutil_ip6hdr* nocapture %0, i8 zeroext %1, i32 %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
int __sprintf2(char *buff, const char *fmt) {
  strcpy(buff, fmt);
  return strlen(fmt);
}


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

x86 assembly (clang, -O2):
<__sprintf2>:
push   %rbx
mov    %rsi,%rbx
call   1030 <strcpy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <strlen@plt>

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

LLVM IR (-O2):
define i32 @__sprintf2(i8* %0, i8* %1) {
%3 = tail call i32 @strcpy(i8* %0, i8* %1)
%4 = tail call i32 @strlen(i8* %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int, void *);
void __handler__(const char *fn, int line, void *ud) {
  printf("custom handler:\n"
         "%s:%d:%p\n",
         fn, line, ud);
}


x86 assembly (clang, -O0):
<__handler__>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__handler__>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"custom handler:\0A%s:%d:%p\0A\00"
define void @__handler__(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"custom handler:\0A%s:%d:%p\0A\00"
define void @__handler__(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
ret void
}
unsigned long long int endTimer(void) {
  unsigned a, d;
  __asm__ volatile("RDTSCP\n\t"
                   "mov %%edx, %0\n\t"
                   "mov %%eax,%1\n\t"
                   "CPUID\n\t"
                   : "=r"(d), "=r"(a)::"%rax", "%rbx", "%rcx", "%rdx");
  return ((unsigned long long)a) | (((unsigned long long)d) << 32);
  ;
}


x86 assembly (clang, -O0):
<endTimer>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
rdtscp
mov    %edx,%esi
mov    %eax,%edi
cpuid
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%eax
mov    %ecx,-0x10(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x20,%rcx
or     %rcx,%rax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<endTimer>:
push   %rbx
rdtscp
mov    %edx,%esi
mov    %eax,%edi
cpuid
mov    %edi,%eax
shl    $0x20,%rsi
or     %rax,%rsi
mov    %rsi,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @endTimer() {
%1 = alloca i32
%2 = alloca i32
%3 = call { i32, i32 } asm sideeffect "RDTSCP\0A\09mov %edx, $0\0A\09mov %eax,$1\0A\09CPUID\0A\09", "=r,=r,~{rax},~{rbx},~{rcx},~{rdx},~{dirflag},~{fpsr},~{flags}"()
%4 = extractvalue { i32, i32 } %3, 0
%5 = extractvalue { i32, i32 } %3, 1
store i32 %4, i32* %2
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = shl i64 %9, 32
%11 = or i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @endTimer() {
%1 = tail call { i32, i32 } asm sideeffect "RDTSCP\0A\09mov %edx, $0\0A\09mov %eax,$1\0A\09CPUID\0A\09", "=r,=r,~{rax},~{rbx},~{rcx},~{rdx},~{dirflag},~{fpsr},~{flags}"()
%2 = extractvalue { i32, i32 } %1, 0
%3 = extractvalue { i32, i32 } %1, 1
%4 = zext i32 %3 to i64
%5 = zext i32 %2 to i64
%6 = shl nuw i64 %5, 32
%7 = or i64 %6, %4
ret i64 %7
}
int main() {
  extern char xyz[sizeof(double) == 8 ? 1 : -1];
  double abc[] = {
      (double)3.80279098314984902657e+35,  (double)0.0,
      (double)-1.37384666579378297437e+38, (double)0.0,
      (double)3.53802595280598432000e+18,  (double)0.0,
      (double)1.77977764695171661377e+10,  (double)0.0,
      (double)-5.22995989424860458374e+10, (double)0.0,
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x50,%edx
call   1030 <memset@plt>
movsd  0xee9(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xed4(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xebf(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xeaa(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe95(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x double]
store i32 0, i32* %1
%3 = bitcast [10 x double]* %2 to i8*
%4 = bitcast i8* %3 to [10 x double]*
%5 = getelementptr inbounds [10 x double], [10 x double]* %4, i32 0, i32 0
store double 0x47524F4D41435358, double* %5
%6 = getelementptr inbounds [10 x double], [10 x double]* %4, i32 0, i32 2
store double 0xC7D9D6D4C1C3E2E7, double* %6
%7 = getelementptr inbounds [10 x double], [10 x double]* %4, i32 0, i32 4
store double 0x43C88CCBEDED8E8C, double* %7
%8 = getelementptr inbounds [10 x double], [10 x double]* %4, i32 0, i32 6
store double 0x4210935211561194, double* %8
%9 = getelementptr inbounds [10 x double], [10 x double]* %4, i32 0, i32 8
store double 0xC2285A9918BCF8DB, double* %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void X509at_add1_attr_by_OBJ(void) {}


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

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

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

LLVM IR (-O2):
define void @X509at_add1_attr_by_OBJ() {
ret void
}
/* Variables and functions */
int count_bits(char one_or_zero, char *binary_number_string) {
  char *p = NULL;
  int num_found = 0;
  for (p = binary_number_string; *p; p++)
    if (one_or_zero == *p)
      ++num_found;
  return num_found;
}


x86 assembly (clang, -O0):
<count_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1164 <count_bits+0x64>
movsbl -0x1(%rbp),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    114e <count_bits+0x4e>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1153 <count_bits+0x53>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1125 <count_bits+0x25>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_bits>:
mov    (%rsi),%cl
test   %cl,%cl
je     1126 <count_bits+0x26>
add    $0x1,%rsi
xor    %eax,%eax
nopl   0x0(%rax)
xor    %edx,%edx
cmp    %dil,%cl
sete   %dl
add    %edx,%eax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <count_bits+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @count_bits(i8 signext %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i32 [ %11, %5 ], [ 0, %2 ]
%8 = phi i8* [ %12, %5 ], [ %1, %2 ]
%9 = icmp eq i8 %6, %0
%10 = zext i1 %9 to i32
%11 = add nuw nsw i32 %7, %10
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %11, %5 ]
ret i32 %16
}
/* Type definitions */
struct sockaddr_in {
  int sin_port;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ cli_addr;

/* Variables and functions */
int /*<<< orphan*/ getpeername(int, struct sockaddr *, void *);
int clientport(int fd) {
  struct sockaddr_in cli_addr;
  int len;
  len = sizeof(cli_addr);
  getpeername(fd, (struct sockaddr *)&cli_addr, (void *)&len);
  return cli_addr.sin_port;
}


x86 assembly (clang, -O0):
<clientport>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <getpeername@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clientport>:
push   %rax
movl   $0x4,0x4(%rsp)
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1030 <getpeername@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @clientport(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %4
%5 = load i32, i32* %2
%6 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%7 = bitcast i32* %4 to i8*
%8 = call i32 @getpeername(i32 %5, %struct.sockaddr* %6, i8* %7)
%9 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
define i32 @clientport(i32 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = bitcast %struct.sockaddr_in* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%7 = call i32 @getpeername(i32 %0, %struct.sockaddr* %6, i8* %5)
%8 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%9 = load i32, i32* %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void print_usage(void) { fprintf(stdout, "Usage: kju\n"); }


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [12 x i8] c"Usage: kju\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [12 x i8] c"Usage: kju\0A\00"
define void @print_usage() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isspace(char);
char *get_end_of_arg(char *buffer) {
  while (buffer[0] != 0 && !isspace(buffer[0] & 0xFF)) {
    buffer++;
  }
  return buffer;
}


x86 assembly (clang, -O0):
<get_end_of_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1150 <get_end_of_arg+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
movsbl %al,%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1160 <get_end_of_arg+0x50>
jmp    1171 <get_end_of_arg+0x61>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <get_end_of_arg+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_end_of_arg>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1138 <get_end_of_arg+0x28>
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
jne    1138 <get_end_of_arg+0x28>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <get_end_of_arg+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

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


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

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

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

LLVM IR (-O2):
define void @gdk_keyval_convert_case() {
ret void
}
char *strcpy(char *restrict to, const char *restrict from) {
  char *save = to;
  for (; (*to = *from); ++from, ++to)
    ;
  return (save);
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     114a <strcpy+0x4a>
jmp    112d <strcpy+0x2d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,(%rdi)
test   %cl,%cl
je     111f <strcpy+0x1f>
mov    $0x1,%ecx
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

LLVM IR (-O0):
define i8* @strcpy(i8* noalias %0, i8* noalias %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 = %13, %2
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = load i8*, i8** %3
store i8 %9, i8* %10
%11 = icmp ne i8 %9, 0
br i1 %11, label %12, label %18
12: ; preds = %7
br label %13
13: ; preds = %12
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
br label %7
18: ; preds = %7
%19 = load i8*, i8** %5
ret i8* %19
}

LLVM IR (-O2):
define i8* @strcpy(i8* noalias returned writeonly %0, i8* noalias nocapture %1) {
%3 = load i8, i8* %1
store i8 %3, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %9, %5 ], [ %0, %2 ]
%7 = phi i8* [ %8, %5 ], [ %1, %2 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, char *);
scalar_t__ stackguard_get_ra();
scalar_t__ stackguard_pop();
int /*<<< orphan*/ stackguard_push(void *);
int /*<<< orphan*/ stackguard_set_ra(void *);
int dangerous(void) {
  char array[10];
  void *return_address;
  {
    return_address = (void *)stackguard_get_ra();
    stackguard_push(return_address);
    scanf("%s", array);
    {
      return_address = (void *)stackguard_pop();
      stackguard_set_ra(return_address);
      return (0);
    }
  }
}


x86 assembly (clang, -O0):
<dangerous>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <stackguard_get_ra@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <stackguard_push@plt>
lea    -0xa(%rbp),%rsi
lea    0xe89(%rip),%rdi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1070 <stackguard_pop@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <stackguard_set_ra@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dangerous>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <stackguard_get_ra@plt>
mov    %rax,%rdi
call   1060 <stackguard_push@plt>
lea    0xe96(%rip),%rdi
lea    0xe(%rsp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1070 <stackguard_pop@plt>
mov    %rax,%rdi
call   1030 <stackguard_set_ra@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @dangerous() {
%1 = alloca [10 x i8]
%2 = alloca i8*
%3 = call i64 (...) @stackguard_get_ra()
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @stackguard_push(i8* %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = call i64 (...) @stackguard_pop()
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @stackguard_set_ra(i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @dangerous() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i64 (...) @stackguard_get_ra()
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @stackguard_push(i8* %4)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%7 = call i64 (...) @stackguard_pop()
%8 = inttoptr i64 %7 to i8*
%9 = call i32 @stackguard_set_ra(i8* %8)
ret i32 0
}
/* Variables and functions */
int errGen(int);
int target(int fd) {
  int rc = errGen(fd);
  if (rc == 1)
    return (-1);
  if (rc != 0)
    return rc;
  return 5;
}


x86 assembly (clang, -O0):
<target>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <errGen@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    113c <target+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1158 <target+0x48>
cmpl   $0x0,-0xc(%rbp)
je     1151 <target+0x41>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <target+0x48>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target>:
push   %rax
call   1030 <errGen@plt>
test   %eax,%eax
je     1128 <target+0x18>
mov    $0xffffffff,%ecx
cmp    $0x1,%eax
je     112d <target+0x1d>
mov    %eax,%ecx
jmp    112d <target+0x1d>
mov    $0x5,%ecx
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @target(i32 %0) {
%2 = tail call i32 @errGen(i32 %0)
switch i32 %2, label %3 [
i32 1, label %5
i32 0, label %4
]
3: ; preds = %1
br label %5
4: ; preds = %1
br label %5
5: ; preds = %1, %4, %3
%6 = phi i32 [ %2, %3 ], [ 5, %4 ], [ -1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fork();
int /*<<< orphan*/ printf(char *, int);
void signal_handler(int sign) {
  printf("Signal caught %d\n", sign);
  fork();
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <fork@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <fork@plt>

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

LLVM IR (-O2):
@.str = [18 x i8] c"Signal caught %d\0A\00"
define void @signal_handler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @fork()
ret void
}