xunge/DecIR huggingface dataset:
/* Type definitions */
struct city {
  int dummy;
};

/* Variables and functions */
scalar_t__ city_got_building(struct city *, int);
int /*<<< orphan*/ is_wonder(int);
int can_sell_building(struct city *pcity, int id) {
  return (city_got_building(pcity, id) ? (!is_wonder(id)) : 0);
}


x86 assembly (clang, -O0):
<can_sell_building>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <city_got_building@plt>
cmp    $0x0,%rax
je     1162 <can_sell_building+0x42>
mov    -0xc(%rbp),%edi
call   1030 <is_wonder@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
jmp    116c <can_sell_building+0x4c>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    116c <can_sell_building+0x4c>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<can_sell_building>:
push   %rbx
mov    %esi,%ebx
call   1040 <city_got_building@plt>
test   %rax,%rax
je     113f <can_sell_building+0x1f>
mov    %ebx,%edi
call   1030 <is_wonder@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.city = type { i32 }
define i32 @can_sell_building(%struct.city* %0, i32 %1) {
%3 = alloca %struct.city*
%4 = alloca i32
store %struct.city* %0, %struct.city** %3
store i32 %1, i32* %4
%5 = load %struct.city*, %struct.city** %3
%6 = load i32, i32* %4
%7 = call i64 @city_got_building(%struct.city* %5, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @is_wonder(i32 %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
br label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %9
%17 = phi i32 [ %14, %9 ], [ 0, %15 ]
ret i32 %17
}

LLVM IR (-O2):
%struct.city = type { i32 }
define i32 @can_sell_building(%struct.city* %0, i32 %1) {
%3 = tail call i64 @city_got_building(%struct.city* %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = tail call i32 @is_wonder(i32 %1)
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %2, %5
%10 = phi i32 [ %8, %5 ], [ 0, %2 ]
ret i32 %10
}
double interpolation(double x, double x0, double y0, double dy0, double x1,
                     double y1, double dy1) {
  return y0 + (y1 - y0) * (x - x0) / (x1 - x0);
}


x86 assembly (clang, -O0):
<interpolation>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  -0x28(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpolation>:
subsd  %xmm2,%xmm5
subsd  %xmm1,%xmm0
mulsd  %xmm5,%xmm0
subsd  %xmm1,%xmm4
divsd  %xmm4,%xmm0
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @interpolation(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
%15 = load double, double* %10
%16 = load double, double* %13
%17 = load double, double* %10
%18 = fsub double %16, %17
%19 = load double, double* %8
%20 = load double, double* %9
%21 = fsub double %19, %20
%22 = fmul double %18, %21
%23 = load double, double* %12
%24 = load double, double* %9
%25 = fsub double %23, %24
%26 = fdiv double %22, %25
%27 = fadd double %15, %26
ret double %27
}

LLVM IR (-O2):
define double @interpolation(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = fsub double %5, %2
%9 = fsub double %0, %1
%10 = fmul double %9, %8
%11 = fsub double %4, %1
%12 = fdiv double %10, %11
%13 = fadd double %12, %2
ret double %13
}
XInstallColormap() {}


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

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

LLVM IR (-O0):
define i32 @XInstallColormap() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XInstallColormap() {
ret i32 undef
}
__attribute__((always_)) void __DMB(void) {}


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

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

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

LLVM IR (-O2):
define void @__DMB() {
ret void
}
void ab5500_fg_reinit(void) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @ab5500_fg_reinit() {
ret void
}
int nanosleep$UNIX2003(int val) { return usleep(val); }


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

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

LLVM IR (-O0):
define i32 @"nanosleep$UNIX2003"(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @usleep to i32 (i32, ...)*)(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @"nanosleep$UNIX2003"(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @usleep to i32 (i32, ...)*)(i32 %0)
ret i32 %2
}
/* Variables and functions */
int strlen(char *);
char *filename_non_directory(char *pathname) {
  register char *filename = pathname + strlen(pathname);
  if ((0))
    pathname += 2;
  while (filename > pathname && !((filename[-1]) == '/'))
    filename--;
  return filename;
}


x86 assembly (clang, -O0):
<filename_non_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x19(%rbp)
jbe    1163 <filename_non_directory+0x53>
mov    -0x10(%rbp),%rax
movsbl -0x1(%rax),%eax
cmp    $0x2f,%eax
sete   %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1173 <filename_non_directory+0x63>
jmp    1184 <filename_non_directory+0x74>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    113d <filename_non_directory+0x2d>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filename_non_directory>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
movslq %eax,%rcx
add    %rbx,%rcx
nop
mov    %rcx,%rax
cmp    %rbx,%rcx
jbe    1132 <filename_non_directory+0x22>
lea    -0x1(%rax),%rcx
cmpb   $0x2f,-0x1(%rax)
jne    1120 <filename_non_directory+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @filename_non_directory(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
br label %5
5: ; preds = %8, %1
%6 = phi i8* [ %4, %1 ], [ %9, %8 ]
%7 = icmp ugt i8* %6, %0
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = getelementptr inbounds i8, i8* %6, i64 -1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 47
br i1 %11, label %12, label %5
12: ; preds = %5, %8
ret i8* %6
}
const char *psk_key_exchange_mode_name(unsigned code) {
  switch (code) {
  default:
    return "UNKNOWN_PSK_EXCHANGE_MODE";
    break;
  case 0x0000:
    return "PSK_KE";
    break;
  case 0x0001:
    return "PSK_DHE_KE";
    break;
  }
}


x86 assembly (clang, -O0):
<psk_key_exchange_mode_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     113b <psk_key_exchange_mode_name+0x3b>
jmp    111a <psk_key_exchange_mode_name+0x1a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     114b <psk_key_exchange_mode_name+0x4b>
jmp    112b <psk_key_exchange_mode_name+0x2b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <psk_key_exchange_mode_name+0x56>
lea    0xed8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <psk_key_exchange_mode_name+0x56>
lea    0xecf(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<psk_key_exchange_mode_name>:
cmp    $0x1,%edi
lea    0xf17(%rip),%rax
lea    0xeef(%rip),%rcx
cmove  %rax,%rcx
test   %edi,%edi
lea    0xefc(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [26 x i8] c"UNKNOWN_PSK_EXCHANGE_MODE\00"
@.str.1 = [7 x i8] c"PSK_KE\00"
@.str.2 = [11 x i8] c"PSK_DHE_KE\00"
define i8* @psk_key_exchange_mode_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %5 [
i32 0, label %6
i32 1, label %7
]
5: ; preds = %1
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [26 x i8] c"UNKNOWN_PSK_EXCHANGE_MODE\00"
@.str.1 = [7 x i8] c"PSK_KE\00"
@.str.2 = [11 x i8] c"PSK_DHE_KE\00"
define i8* @psk_key_exchange_mode_name(i32 %0) {
%2 = icmp eq i32 %0, 1
%3 = select i1 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0)
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ _SC_NPROCESSORS_ONLN;
int sysconf(int /*<<< orphan*/);
int get_number_of_cores() { return sysconf(_SC_NPROCESSORS_ONLN); }


x86 assembly (clang, -O0):
<get_number_of_cores>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_number_of_cores>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sysconf@plt>

LLVM IR (-O0):
@_SC_NPROCESSORS_ONLN = global i32 0
define i32 @get_number_of_cores() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = call i32 @sysconf(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@_SC_NPROCESSORS_ONLN = global i32 0
define i32 @get_number_of_cores() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = tail call i32 @sysconf(i32 %1)
ret i32 %2
}
void touch(char *p, char *end, int range) {
  char *tmp = p;
  while (range > 0 && (tmp < end)) {
    *tmp = 0;
    tmp += 4096;
    range -= 4096;
  }
}


x86 assembly (clang, -O0):
<touch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x14(%rbp)
mov    %al,-0x21(%rbp)
jle    1134 <touch+0x34>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
setb   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1144 <touch+0x44>
jmp    1169 <touch+0x69>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1000,%rax
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1000,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <touch+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch>:
test   %edx,%edx
jle    1134 <touch+0x34>
cmp    %rsi,%rdi
jae    1134 <touch+0x34>
add    $0x1000,%rdi
movb   $0x0,-0x1000(%rdi)
cmp    $0x1001,%edx
jb     1134 <touch+0x34>
add    $0xfffff000,%edx
lea    0x1000(%rdi),%rax
cmp    %rsi,%rdi
mov    %rax,%rdi
jb     1110 <touch+0x10>
ret

LLVM IR (-O0):
define void @touch(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
store i8* %8, i8** %7
br label %9
9: ; preds = %18, %3
%10 = load i32, i32* %6
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i8*, i8** %7
%14 = load i8*, i8** %5
%15 = icmp ult i8* %13, %14
br label %16
16: ; preds = %12, %9
%17 = phi i1 [ false, %9 ], [ %15, %12 ]
br i1 %17, label %18, label %24
18: ; preds = %16
%19 = load i8*, i8** %7
store i8 0, i8* %19
%20 = load i8*, i8** %7
%21 = getelementptr inbounds i8, i8* %20, i64 4096
store i8* %21, i8** %7
%22 = load i32, i32* %6
%23 = sub nsw i32 %22, 4096
store i32 %23, i32* %6
br label %9
24: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @touch(i8* writeonly %0, i8* readnone %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
%5 = icmp ult i8* %0, %1
%6 = and i1 %4, %5
br i1 %6, label %7, label %15
7: ; preds = %3, %7
%8 = phi i8* [ %10, %7 ], [ %0, %3 ]
%9 = phi i32 [ %11, %7 ], [ %2, %3 ]
store i8 0, i8* %8
%10 = getelementptr inbounds i8, i8* %8, i64 4096
%11 = add nsw i32 %9, -4096
%12 = icmp ugt i32 %9, 4096
%13 = icmp ult i8* %10, %1
%14 = select i1 %12, i1 %13, i1 false
br i1 %14, label %7, label %15
15: ; preds = %7, %3
ret void
}
/* Variables and functions */
int hxd2i(char const);
int hex2(const char *s) { return 16 * hxd2i(*s) + hxd2i(s[1]); }


x86 assembly (clang, -O0):
<hex2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <hxd2i@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <hxd2i@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hex2>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <hxd2i@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
movsbl 0x1(%rbx),%edi
call   1030 <hxd2i@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hex2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = call i32 @hxd2i(i8 signext %4)
%6 = mul nsw i32 16, %5
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %8
%10 = call i32 @hxd2i(i8 signext %9)
%11 = add nsw i32 %6, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @hex2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @hxd2i(i8 signext %2)
%4 = shl nsw i32 %3, 4
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @hxd2i(i8 signext %6)
%8 = add nsw i32 %7, %4
ret i32 %8
}
int test_imm_E6uint8_mem(unsigned char *val) {
  return ((*val) & (-0xE6 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E6uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 26
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int const);
void int2str(char *str, const int *number) { sprintf(str, "%d", *number); }


x86 assembly (clang, -O0):
<int2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xecf(%rip),%rsi
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int2str>:
mov    (%rsi),%edx
lea    0xee7(%rip),%rsi
jmp    1030 <sprintf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @int2str(i8* nocapture writeonly %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
int test_imm_DCuint32_reg(unsigned int val) {
  return ((val) & (0xDC << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DCuint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xdc,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_DCuint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 220
%5 = icmp ne i32 %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_DCuint32_reg(i32 %0) {
%2 = and i32 %0, 220
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int rand();
void main(void) {
  int X = 0;
  int N = rand();
  if (N < 0) {
    N = 0;
  }
  while (X < N) {
    X++;
  }
  assert(X - N == 0);
  assert(X == N);
  if (X == N) {
    N = 8;
  } else {
    N = 42;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    114a <main+0x2a>
movl   $0x0,-0x8(%rbp)
jmp    114f <main+0x2f>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1169 <main+0x49>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114f <main+0x2f>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11aa <main+0x8a>
movl   $0x8,-0x8(%rbp)
jmp    11b1 <main+0x91>
movl   $0x2a,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @rand()
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 0, i32* %2
br label %7
7: ; preds = %6, %0
br label %8
8: ; preds = %12, %7
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %8
15: ; preds = %8
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = sub nsw i32 %16, %17
%19 = icmp eq i32 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = icmp eq i32 %22, %23
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i32, i32* %1
%28 = load i32, i32* %2
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %31
30: ; preds = %15
store i32 8, i32* %2
br label %32
31: ; preds = %15
store i32 42, i32* %2
br label %32
32: ; preds = %31, %30
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @rand()
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
ret void
}
void ff_hevc_put_hevc_epel_v32_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_epel_v32_10_sse4() {
ret void
}
void gdk_drawable_get_depth() {}


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

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

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

LLVM IR (-O2):
define void @gdk_drawable_get_depth() {
ret void
}
char set_bit(char b, int pos, int bit) {
  int mask = ~(1 << pos);
  int ret = 0;
  bit = bit ? 1 : 0;
  ret = b & mask;
  ret |= bit << pos;
  return ret;
}


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0xc(%rbp)
movsbl -0x1(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
mov    %esi,%ecx
xor    %eax,%eax
test   %edx,%edx
setne  %al
btr    %esi,%edi
shl    %cl,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @set_bit(i8 signext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %5
%10 = shl i32 1, %9
%11 = xor i32 %10, -1
store i32 %11, i32* %7
store i32 0, i32* %8
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 0
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 1, i32 0
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = load i32, i32* %7
%19 = and i32 %17, %18
store i32 %19, i32* %8
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = shl i32 %20, %21
%23 = load i32, i32* %8
%24 = or i32 %23, %22
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = trunc i32 %25 to i8
ret i8 %26
}

LLVM IR (-O2):
define signext i8 @set_bit(i8 signext %0, i32 %1, i32 %2) {
%4 = shl nuw i32 1, %1
%5 = xor i32 %4, -1
%6 = icmp ne i32 %2, 0
%7 = zext i1 %6 to i32
%8 = zext i8 %0 to i32
%9 = and i32 %5, %8
%10 = shl nuw i32 %7, %1
%11 = or i32 %10, %9
%12 = trunc i32 %11 to i8
ret i8 %12
}
/* Variables and functions */
int /*<<< orphan*/ find_prepare_index();
int /*<<< orphan*/ image_event_loop();
int main(int argc, char *argv[]) {
  find_prepare_index();
  image_event_loop();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @find_prepare_index()
%4 = tail call i32 (...) @image_event_loop()
ret i32 0
}
/* Type definitions */
struct onak_dbctx {
  int dummy;
};

/* Variables and functions */
bool keyd_starttrans(struct onak_dbctx *dbctx) { return true; }


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

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

LLVM IR (-O0):
%struct.onak_dbctx = type { i32 }
define i32 @keyd_starttrans(%struct.onak_dbctx* %0) {
%2 = alloca %struct.onak_dbctx*
store %struct.onak_dbctx* %0, %struct.onak_dbctx** %2
ret i32 1
}

LLVM IR (-O2):
%struct.onak_dbctx = type { i32 }
define i32 @keyd_starttrans(%struct.onak_dbctx* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int atoi(char *);
int cpu_count();
char *getenv(char *);
int thread_count() {
  char *e = getenv("STRM_THREAD_MAX");
  int n;
  if (e) {
    n = atoi(e);
    if (n > 0)
      return n;
  }
  return cpu_count();
}


x86 assembly (clang, -O0):
<thread_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1179 <thread_count+0x49>
mov    -0x10(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    1174 <thread_count+0x44>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1183 <thread_count+0x53>
jmp    1179 <thread_count+0x49>
mov    $0x0,%al
call   1040 <cpu_count@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_count>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1150 <thread_count+0x20>
mov    %rax,%rdi
call   1050 <atoi@plt>
test   %eax,%eax
jle    1150 <thread_count+0x20>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
jmp    1040 <cpu_count@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"STRM_THREAD_MAX\00"
define i32 @thread_count() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %15
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i32 @atoi(i8* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = load i32, i32* %3
store i32 %13, i32* %1
br label %17
14: ; preds = %7
br label %15
15: ; preds = %14, %0
%16 = call i32 (...) @cpu_count()
store i32 %16, i32* %1
br label %17
17: ; preds = %15, %12
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@.str = [16 x i8] c"STRM_THREAD_MAX\00"
define i32 @thread_count() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @atoi(i8* %1)
%5 = icmp sgt i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3, %0
%7 = tail call i32 (...) @cpu_count()
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ %7, %6 ], [ %4, %3 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
int /*<<< orphan*/ BPF_MAP_GET_NEXT_ID;
int bpf_obj_get_next_id(int /*<<< orphan*/, int /*<<< orphan*/ *,
                        int /*<<< orphan*/);
int bpf_map_get_next_id(__u32 start_id, __u32 *next_id) {
  return bpf_obj_get_next_id(start_id, next_id, BPF_MAP_GET_NEXT_ID);
}


x86 assembly (clang, -O0):
<bpf_map_get_next_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    0x2ecb(%rip),%rax
mov    (%rax),%edx
call   1030 <bpf_obj_get_next_id@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bpf_map_get_next_id>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%edx
jmp    1030 <bpf_obj_get_next_id@plt>

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

LLVM IR (-O2):
@BPF_MAP_GET_NEXT_ID = global i32 0
define i32 @bpf_map_get_next_id(i32 %0, i32* %1) {
%3 = load i32, i32* @BPF_MAP_GET_NEXT_ID
%4 = tail call i32 @bpf_obj_get_next_id(i32 %0, i32* %1, i32 %3)
ret i32 %4
}
/* Variables and functions */
scalar_t__ islower(int);
int toupper(int c) {
  if (islower(c))
    return (c - 'a' + 'A');
  else
    return c;
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     113e <toupper+0x2e>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1144 <toupper+0x34>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
push   %rbx
mov    %edi,%ebx
call   1030 <islower@plt>
lea    -0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @toupper(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @islower(i32 %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 97
%10 = add nsw i32 %9, 65
store i32 %10, i32* %2
br label %13
11: ; preds = %1
%12 = load i32, i32* %3
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = tail call i64 @islower(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
int ft_strlenchr(char const *s, char c, int i) {
  int n;
  n = 0;
  while (s[i] != c && s[i] != '\0') {
    i++;
    n++;
  }
  return (i);
}


x86 assembly (clang, -O0):
<ft_strlenchr>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
movsbl -0x9(%rbp),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x15(%rbp)
je     114a <ft_strlenchr+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    115a <ft_strlenchr+0x5a>
jmp    1171 <ft_strlenchr+0x71>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1118 <ft_strlenchr+0x18>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strlenchr>:
movslq %edx,%rcx
lea    -0x1(%rcx),%eax
add    %rcx,%rdi
nopl   0x0(%rax)
movzbl (%rdi),%ecx
add    $0x1,%eax
cmp    %sil,%cl
je     1123 <ft_strlenchr+0x23>
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <ft_strlenchr+0x10>
ret

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

LLVM IR (-O2):
define i32 @ft_strlenchr(i8* nocapture %0, i8 signext %1, i32 %2) {
%4 = sext i32 %2 to i64
br label %5
5: ; preds = %5, %3
%6 = phi i64 [ %12, %5 ], [ %4, %3 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, %1
%10 = icmp eq i8 %8, 0
%11 = or i1 %9, %10
%12 = add i64 %6, 1
br i1 %11, label %13, label %5
13: ; preds = %5
%14 = trunc i64 %6 to i32
ret i32 %14
}
/* Variables and functions */
int s(int);
int x() { return s(0) == 1 && s(1) == 0 && s(2) == 1; }


x86 assembly (clang, -O0):
<x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <s@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
mov    %al,-0x1(%rbp)
jne    115c <x+0x4c>
mov    $0x1,%edi
call   1030 <s@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1(%rbp)
jne    115c <x+0x4c>
mov    $0x2,%edi
call   1030 <s@plt>
cmp    $0x1,%eax
sete   %al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x>:
push   %rbx
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <s@plt>
cmp    $0x1,%eax
jne    113f <x+0x2f>
mov    $0x1,%edi
call   1030 <s@plt>
test   %eax,%eax
jne    113f <x+0x2f>
mov    $0x2,%edi
call   1030 <s@plt>
xor    %ebx,%ebx
cmp    $0x1,%eax
sete   %bl
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @x() {
%1 = call i32 @s(i32 0)
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %9
3: ; preds = %0
%4 = call i32 @s(i32 1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = call i32 @s(i32 2)
%8 = icmp eq i32 %7, 1
br label %9
9: ; preds = %6, %3, %0
%10 = phi i1 [ false, %3 ], [ false, %0 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @x() {
%1 = tail call i32 @s(i32 0)
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %10
3: ; preds = %0
%4 = tail call i32 @s(i32 1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i32 @s(i32 2)
%8 = icmp eq i32 %7, 1
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %6, %3, %0
%11 = phi i32 [ 0, %3 ], [ 0, %0 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int func(int);
int main() {
  int i;
  i = func(10);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @func(i32 10)
ret i32 0
}
/* Variables and functions */
unsigned long long abs64_entry(long long);
unsigned long long llabs(long long i) { return abs64_entry(i); }


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

x86 assembly (clang, -O2):
<llabs>:
jmp    1030 <abs64_entry@plt>

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

LLVM IR (-O2):
define i64 @llabs(i64 %0) {
%2 = tail call i64 @abs64_entry(i64 %0)
ret i64 %2
}
int fun919() { return 919; }


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

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

LLVM IR (-O0):
define i32 @fun919() {
ret i32 919
}

LLVM IR (-O2):
define i32 @fun919() {
ret i32 919
}
/* Variables and functions */
int /*<<< orphan*/ qprintf(char *, int);
int q_LoadCalendarFromRTC(int hex) {
  qprintf("*** "
          "LoadCalendarFromRTC"
          "(%x)\n",
          hex);
  return 0;
}


x86 assembly (clang, -O0):
<q_LoadCalendarFromRTC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <qprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q_LoadCalendarFromRTC>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <qprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"*** LoadCalendarFromRTC(%x)\0A\00"
define i32 @q_LoadCalendarFromRTC(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @qprintf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"*** LoadCalendarFromRTC(%x)\0A\00"
define i32 @q_LoadCalendarFromRTC(i32 %0) {
%2 = tail call i32 @qprintf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ f1(int, int *, int);
void call_f1(int *p) { f1(-1, p, -1); }


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

x86 assembly (clang, -O2):
<call_f1>:
mov    %rdi,%rsi
mov    $0xffffffff,%edi
mov    $0xffffffff,%edx
jmp    1030 <f1@plt>

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

LLVM IR (-O2):
define void @call_f1(i32* %0) {
%2 = tail call i32 @f1(i32 -1, i32* %0, i32 -1)
ret void
}
int also_before(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @also_before() {
ret i32 2
}

LLVM IR (-O2):
define i32 @also_before() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_helloworld() { printf("Hello, World\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Hello, World\00"
define void @print_helloworld() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct box {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ copy_struct(struct box *, struct box *);
void copy_box(struct box *dst, struct box *src) { copy_struct(dst, src); }


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

x86 assembly (clang, -O2):
<copy_box>:
jmp    1030 <copy_struct@plt>

LLVM IR (-O0):
%struct.box = type { i32 }
define void @copy_box(%struct.box* %0, %struct.box* %1) {
%3 = alloca %struct.box*
%4 = alloca %struct.box*
store %struct.box* %0, %struct.box** %3
store %struct.box* %1, %struct.box** %4
%5 = load %struct.box*, %struct.box** %3
%6 = load %struct.box*, %struct.box** %4
%7 = call i32 @copy_struct(%struct.box* %5, %struct.box* %6)
ret void
}

LLVM IR (-O2):
%struct.box = type { i32 }
define void @copy_box(%struct.box* %0, %struct.box* %1) {
%3 = tail call i32 @copy_struct(%struct.box* %0, %struct.box* %1)
ret void
}
/* Type definitions */
struct group {
  char *gr_name;
};
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
struct group *getgrgid(int /*<<< orphan*/);
char *gid_name(gid_t gid) {
  struct group *gr = getgrgid(gid);
  return (gr != 0) ? gr->gr_name : 0;
}


x86 assembly (clang, -O0):
<gid_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <getgrgid@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1142 <gid_name+0x32>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    114d <gid_name+0x3d>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    114d <gid_name+0x3d>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gid_name>:
push   %rax
call   1030 <getgrgid@plt>
test   %rax,%rax
je     1120 <gid_name+0x10>
mov    (%rax),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.group = type { i8* }
define i8* @gid_name(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.group*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call %struct.group* @getgrgid(i32 %4)
store %struct.group* %5, %struct.group** %3
%6 = load %struct.group*, %struct.group** %3
%7 = icmp ne %struct.group* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load %struct.group*, %struct.group** %3
%10 = getelementptr inbounds %struct.group, %struct.group* %9, i32 0, i32 0
%11 = load i8*, i8** %10
br label %13
12: ; preds = %1
br label %13
13: ; preds = %12, %8
%14 = phi i8* [ %11, %8 ], [ null, %12 ]
ret i8* %14
}

LLVM IR (-O2):
%struct.group = type { i8* }
define i8* @gid_name(i32 %0) {
%2 = tail call %struct.group* @getgrgid(i32 %0)
%3 = icmp eq %struct.group* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = getelementptr inbounds %struct.group, %struct.group* %2, i64 0, i32 0
%6 = load i8*, i8** %5
br label %7
7: ; preds = %1, %4
%8 = phi i8* [ %6, %4 ], [ null, %1 ]
ret i8* %8
}
fun(int foo, int bar) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fun(i32 %0, i32 %1) {
ret i32 0
}
__attribute__((weak, used)) void __cxa_pure_virtual(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<__cxa_pure_virtual>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <__cxa_pure_virtual+0x9>
jmp    1109 <__cxa_pure_virtual+0x9>

x86 assembly (clang, -O2):
<__cxa_pure_virtual>:
jmp    1100 <__cxa_pure_virtual>

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @__cxa_pure_virtual to i8*)], section "llvm.metadata"
define weak void @__cxa_pure_virtual() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @__cxa_pure_virtual to i8*)], section "llvm.metadata"
define weak void @__cxa_pure_virtual() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(void) {
  fprintf(stderr, "[CRASH_TEST] Causing crash in untrusted code...\n");
  *(volatile int *)0 = 0;
  fprintf(stderr, "[CRASH_TEST] FAIL: Survived crash attempt\n");
  return 1;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,0x0
mov    (%rbx),%edi
lea    0xef7(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [49 x i8] c"[CRASH_TEST] Causing crash in untrusted code...\0A\00"
@.str.1 = [43 x i8] c"[CRASH_TEST] FAIL: Survived crash attempt\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store volatile i32 0, i32* null
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [49 x i8] c"[CRASH_TEST] Causing crash in untrusted code...\0A\00"
@.str.1 = [43 x i8] c"[CRASH_TEST] FAIL: Survived crash attempt\0A\00"
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store volatile i32 0, i32* null
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
uint16_t u4_12_from_float(float f) {
  static const float scale = (float)(1 << 12);
  static const float limpos = 0xffff / (float)(1 << 12);
  if (f <= 0.) {
    return 0;
  } else if (f >= limpos) {
    return 0xffff;
  }
  return f * scale + 0.5;
}


x86 assembly (clang, -O0):
<u4_12_from_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jb     112b <u4_12_from_float+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    1176 <u4_12_from_float+0x76>
movss  -0x8(%rbp),%xmm0
movss  0xec8(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     114d <u4_12_from_float+0x4d>
movl   $0xffff,-0x4(%rbp)
jmp    1176 <u4_12_from_float+0x76>
jmp    1152 <u4_12_from_float+0x52>
movss  0xeaa(%rip),%xmm0
mulss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9d(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<u4_12_from_float>:
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jae    1130 <u4_12_from_float+0x30>
mov    $0xffff,%eax
ucomiss 0xeea(%rip),%xmm0
jae    1130 <u4_12_from_float+0x30>
mulss  0xee4(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xedc(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
@u4_12_from_float.scale = internal constant float 4.096000e+03
@u4_12_from_float.limpos = internal constant float 0x402FFFE000000000
define i32 @u4_12_from_float(float %0) {
%2 = alloca i32
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp ole double %5, 0.000000e+00
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %19
8: ; preds = %1
%9 = load float, float* %3
%10 = fcmp oge float %9, 0x402FFFE000000000
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 65535, i32* %2
br label %19
12: ; preds = %8
br label %13
13: ; preds = %12
%14 = load float, float* %3
%15 = fmul float %14, 4.096000e+03
%16 = fpext float %15 to double
%17 = fadd double %16, 5.000000e-01
%18 = fptosi double %17 to i32
store i32 %18, i32* %2
br label %19
19: ; preds = %13, %11, %7
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
define i32 @u4_12_from_float(float %0) {
%2 = fcmp ugt float %0, 0.000000e+00
br i1 %2, label %3, label %10
3: ; preds = %1
%4 = fcmp ult float %0, 0x402FFFE000000000
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = fmul float %0, 4.096000e+03
%7 = fpext float %6 to double
%8 = fadd double %7, 5.000000e-01
%9 = fptosi double %8 to i32
br label %10
10: ; preds = %3, %1, %5
%11 = phi i32 [ %9, %5 ], [ 0, %1 ], [ 65535, %3 ]
ret i32 %11
}