xunge/DecIR huggingface dataset:
int assemble4be(char *p) {
  return (p[3] | (p[2] << 8) | (p[1] << 16) | (p[0] << 24));
}


x86 assembly (clang, -O0):
<assemble4be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x3(%rax),%eax
mov    -0x8(%rbp),%rcx
movsbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assemble4be>:
movsbl 0x3(%rdi),%eax
movsbl 0x2(%rdi),%ecx
shl    $0x8,%ecx
or     %eax,%ecx
movsbl 0x1(%rdi),%edx
shl    $0x10,%edx
movzbl (%rdi),%eax
shl    $0x18,%eax
or     %edx,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @assemble4be(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = shl i32 %16, 16
%18 = or i32 %12, %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = shl i32 %22, 24
%24 = or i32 %18, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @assemble4be(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = shl nsw i32 %7, 8
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = shl nsw i32 %12, 16
%14 = or i32 %9, %13
%15 = load i8, i8* %0
%16 = zext i8 %15 to i32
%17 = shl nuw i32 %16, 24
%18 = or i32 %14, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void SignalHandler(int signal) { printf("Signal: %d\n", signal); }


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"Signal: %d\0A\00"
define void @SignalHandler(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
double d_abs(double *x) {
  if (*x >= 0.0)
    return (*x);
  return (-*x);
}


x86 assembly (clang, -O0):
<d_abs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     112f <d_abs+0x2f>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1153 <d_abs+0x53>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_abs>:
movsd  (%rdi),%xmm1
movapd 0xef4(%rip),%xmm2
xorpd  %xmm1,%xmm2
xorpd  %xmm0,%xmm0
cmpnlesd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @d_abs(double* %0) {
%2 = alloca double
%3 = alloca double*
store double* %0, double** %3
%4 = load double*, double** %3
%5 = load double, double* %4
%6 = fcmp oge double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load double*, double** %3
%9 = load double, double* %8
store double %9, double* %2
br label %14
10: ; preds = %1
%11 = load double*, double** %3
%12 = load double, double* %11
%13 = fneg double %12
store double %13, double* %2
br label %14
14: ; preds = %10, %7
%15 = load double, double* %2
ret double %15
}

LLVM IR (-O2):
define double @d_abs(double* nocapture %0) {
%2 = load double, double* %0
%3 = fcmp ult double %2, 0.000000e+00
%4 = fneg double %2
%5 = select i1 %3, double %4, double %2
ret double %5
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
double floor(double);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double Now(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return floor(tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0);
}


x86 assembly (clang, -O0):
<Now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xeb9(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xead(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <floor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Now>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm1
movsd  0xec2(%rip),%xmm0
divsd  %xmm0,%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
jmp    1040 <floor@plt>

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @Now() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = fdiv double %6, 1.000000e+03
%8 = call double @llvm.fmuladd.f64(double %4, double 1.000000e+03, double %7)
%9 = call double @llvm.floor.f64(double %8)
ret double %9
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @Now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+03
%9 = tail call double @llvm.fmuladd.f64(double %5, double 1.000000e+03, double %8)
%10 = tail call double @llvm.floor.f64(double %9)
ret double %10
}
int isascii(int c) { return ((unsigned char)(c) <= 0x7f); }


x86 assembly (clang, -O0):
<isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movzbl %al,%eax
cmp    $0x7f,%eax
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isascii>:
xor    %eax,%eax
test   $0x80,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isascii(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = zext i8 %4 to i32
%6 = icmp sle i32 %5, 127
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @isascii(i32 %0) {
%2 = lshr i32 %0, 7
%3 = and i32 %2, 1
%4 = xor i32 %3, 1
ret i32 %4
}
void pmp_set_address(unsigned addr) {
  while (*(volatile unsigned *)(0xBF800000 + (0x7010)) & 0x8000)
    ;
  *(volatile unsigned *)(0xBF800000 + (0x7020)) = addr;
}


x86 assembly (clang, -O0):
<pmp_set_address>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xbf807010,%eax
mov    (%rax),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1121 <pmp_set_address+0x21>
jmp    1107 <pmp_set_address+0x7>
mov    -0x4(%rbp),%ecx
mov    $0xbf807020,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmp_set_address>:
mov    $0xbf807010,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testl  $0x8000,(%rax)
jne    1110 <pmp_set_address+0x10>
mov    %edi,0x10(%rax)
ret

LLVM IR (-O0):
define void @pmp_set_address(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load volatile i32, i32* inttoptr (i64 3212865552 to i32*)
%5 = and i32 %4, 32768
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load i32, i32* %2
store volatile i32 %9, i32* inttoptr (i64 3212865568 to i32*)
ret void
}

LLVM IR (-O2):
define void @pmp_set_address(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 3212865552 to i32*)
%4 = and i32 %3, 32768
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
store volatile i32 %0, i32* inttoptr (i64 3212865568 to i32*)
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int celcon_copy_into_standard_systems_container(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(99, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<celcon_copy_into_standard_systems_container>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x63,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<celcon_copy_into_standard_systems_container>:
mov    $0x63,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

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

LLVM IR (-O2):
define i32 @celcon_copy_into_standard_systems_container() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 99, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
int func(void) {
  int *foo = (void *)0x1234;
  *foo = 0x12345;
  return 0;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1234,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x12345,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
movl   $0x12345,0x1234
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @func() {
%1 = alloca i32*
store i32* inttoptr (i64 4660 to i32*), i32** %1
%2 = load i32*, i32** %1
store i32 74565, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @func() {
store i32 74565, i32* inttoptr (i64 4660 to i32*)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void option2() { printf("You have selected option 2\n"); }


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

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

LLVM IR (-O0):
@.str = [28 x i8] c"You have selected option 2\0A\00"
define void @option2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"You have selected option 2\00"
define void @option2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int check_number(char const *, char const *);
scalar_t__ errno;
scalar_t__ strtoul(char const *, char **, int);
bool parse_uint(const char **string, unsigned int *result) {
  errno = 0;
  const char *start = *string;
  char *end;
  *result = (unsigned int)strtoul(start, &end, 10);
  *string = end;
  return check_number(start, *string);
}


x86 assembly (clang, -O0):
<parse_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
call   1030 <check_number@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_uint>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2eaa(%rip),%rax
movq   $0x0,(%rax)
mov    (%rdi),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %eax,(%r14)
mov    0x8(%rsp),%rsi
mov    %rsi,(%r15)
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <check_number@plt>

LLVM IR (-O0):
@errno = global i64 0
define i32 @parse_uint(i8** %0, i32* %1) {
%3 = alloca i8**
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i8** %0, i8*** %3
store i32* %1, i32** %4
store i64 0, i64* @errno
%7 = load i8**, i8*** %3
%8 = load i8*, i8** %7
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = call i64 @strtoul(i8* %9, i8** %6, i32 10)
%11 = trunc i64 %10 to i32
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = load i8*, i8** %6
%14 = load i8**, i8*** %3
store i8* %13, i8** %14
%15 = load i8*, i8** %5
%16 = load i8**, i8*** %3
%17 = load i8*, i8** %16
%18 = call i32 @check_number(i8* %15, i8* %17)
ret i32 %18
}

LLVM IR (-O2):
@errno = global i64 0
define i32 @parse_uint(i8** nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca i8*
store i64 0, i64* @errno
%4 = load i8*, i8** %0
%5 = bitcast i8** %3 to i8*
%6 = call i64 @strtoul(i8* %4, i8** %3, i32 10)
%7 = trunc i64 %6 to i32
store i32 %7, i32* %1
%8 = load i8*, i8** %3
store i8* %8, i8** %0
%9 = tail call i32 @check_number(i8* %4, i8* %8)
ret i32 %9
}
/* Variables and functions */
scalar_t__ inrange(char, char, char);
char lch(char ch) {
  register char lch;
  lch = ch;
  if (inrange(ch, 'A', 'Z'))
    lch = ch | 0x20;
  return lch;
}


x86 assembly (clang, -O0):
<lch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x2(%rbp)
mov    $0x41,%esi
mov    $0x5a,%edx
movsbl -0x1(%rbp),%edi
call   1030 <inrange@plt>
cmp    $0x0,%rax
je     114b <lch+0x3b>
movsbl -0x1(%rbp),%eax
or     $0x20,%eax
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lch>:
push   %rbx
mov    %edi,%ebx
mov    $0x41,%esi
mov    $0x5a,%edx
call   1030 <inrange@plt>
mov    %ebx,%ecx
or     $0x20,%cl
test   %rax,%rax
movzbl %cl,%eax
cmove  %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @lch(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
store i8 %4, i8* %3
%5 = load i8, i8* %2
%6 = call i64 @inrange(i8 signext %5, i8 signext 65, i8 signext 90)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = or i32 %10, 32
%12 = trunc i32 %11 to i8
store i8 %12, i8* %3
br label %13
13: ; preds = %8, %1
%14 = load i8, i8* %3
ret i8 %14
}

LLVM IR (-O2):
define signext i8 @lch(i8 signext %0) {
%2 = tail call i64 @inrange(i8 signext %0, i8 signext 65, i8 signext 90)
%3 = icmp eq i64 %2, 0
%4 = or i8 %0, 32
%5 = select i1 %3, i8 %0, i8 %4
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, ...);
int writeValueToFile(char *, char *);
int exportPin(unsigned int pin) {
  char fullPath[250];
  char fullValue[4];
  sprintf(fullPath, "/sys/class/gpio/export");
  sprintf(fullValue, "%u", pin);
  return writeValueToFile(fullPath, fullValue);
}


x86 assembly (clang, -O0):
<exportPin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x100(%rbp),%rdi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    -0x104(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec3(%rip),%rsi
mov    $0x0,%al
call   1030 <sprintf@plt>
lea    -0x100(%rbp),%rdi
lea    -0x104(%rbp),%rsi
call   1040 <writeValueToFile@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exportPin>:
push   %rbx
sub    $0x110,%rsp
mov    %edi,%edx
movups 0xecf(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x74726f7078652f,%rax
mov    %rax,0x1f(%rsp)
lea    0xecb(%rip),%rsi
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sprintf@plt>
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
call   1040 <writeValueToFile@plt>
add    $0x110,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"/sys/class/gpio/export\00"
@.str.1 = [3 x i8] c"%u\00"
define i32 @exportPin(i32 %0) {
%2 = alloca i32
%3 = alloca [250 x i8]
%4 = alloca [4 x i8]
store i32 %0, i32* %2
%5 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%8 = load i32, i32* %2
%9 = call i32 (i8*, i8*, ...) @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [250 x i8], [250 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%12 = call i32 @writeValueToFile(i8* %10, i8* %11)
ret i32 %12
}

LLVM IR (-O2):
@.str = [23 x i8] c"/sys/class/gpio/export\00"
@.str.1 = [3 x i8] c"%u\00"
define i32 @exportPin(i32 %0) {
%2 = alloca [250 x i8]
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [250 x i8], [250 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%6 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%7 = call i32 @writeValueToFile(i8* %4, i8* %5)
ret i32 %7
}
/* Variables and functions */
int guild_check_conflict(int, int, int);
int mapif_parse_GuildCheck(int fd, int guild_id, int account_id, int char_id) {
  return guild_check_conflict(guild_id, account_id, char_id);
}


x86 assembly (clang, -O0):
<mapif_parse_GuildCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <guild_check_conflict@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapif_parse_GuildCheck>:
mov    %esi,%edi
mov    %edx,%esi
mov    %ecx,%edx
jmp    1030 <guild_check_conflict@plt>

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

LLVM IR (-O2):
define i32 @mapif_parse_GuildCheck(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @guild_check_conflict(i32 %1, i32 %2, i32 %3)
ret i32 %5
}
/* Variables and functions */
int test_if9(void) {
  if (0 + 1)
    return 'i';
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @test_if9() {
ret i32 105
}

LLVM IR (-O2):
define i32 @test_if9() {
ret i32 105
}
int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offset,
                  int len) {
  return 0;
}


x86 assembly (clang, -O0):
<dbg_leb_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.ubifs_info = type opaque
define i32 @dbg_leb_write(%struct.ubifs_info* %0, i32 %1, i8* %2, i32 %3, i32 %4) {
%6 = alloca %struct.ubifs_info*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store %struct.ubifs_info* %0, %struct.ubifs_info** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret i32 0
}

LLVM IR (-O2):
%struct.ubifs_info = type opaque
define i32 @dbg_leb_write(%struct.ubifs_info* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i32 %3, i32 %4) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_p384_to_bytes(uintptr_t, uintptr_t);
void fiat_p384_to_bytes(uint8_t out1[48], const uint64_t arg1[6]) {
  internal_fiat_p384_to_bytes((uintptr_t)out1, (uintptr_t)arg1);
}


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

x86 assembly (clang, -O2):
<fiat_p384_to_bytes>:
jmp    1030 <internal_fiat_p384_to_bytes@plt>

LLVM IR (-O0):
define void @fiat_p384_to_bytes(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 = ptrtoint i32* %5 to i64
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = call i32 @internal_fiat_p384_to_bytes(i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fiat_p384_to_bytes(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = tail call i32 @internal_fiat_p384_to_bytes(i64 %3, i64 %4)
ret void
}
unsigned char accessDictionaryError(unsigned short index,
                                    unsigned char subIndex,
                                    unsigned long sizeDataDict,
                                    unsigned long sizeDataGiven,
                                    unsigned long code) {
  return 0;
}


x86 assembly (clang, -O0):
<accessDictionaryError>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%si
mov    %si,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
xor    %eax,%eax
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @accessDictionaryError(i16 zeroext %0, i8 zeroext %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i16
%7 = alloca i8
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i16 %0, i16* %6
store i8 %1, i8* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
ret i8 0
}

LLVM IR (-O2):
define zeroext i8 @accessDictionaryError(i16 zeroext %0, i8 zeroext %1, i64 %2, i64 %3, i64 %4) {
ret i8 0
}
void csv_disp_header(struct list *lst) {}


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

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

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

LLVM IR (-O2):
%struct.list = type opaque
define void @csv_disp_header(%struct.list* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void stdio_home(void) { printf("\x1b[u\x1b[K"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"\1B[u\1B[K\00"
define void @stdio_home() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\1B[u\1B[K\00"
define void @stdio_home() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) { printf("hello, danny\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"hello, danny\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
main() {
  float x = 22, y = 7;
  printf("x/y"
         "=%7.0f\n",
         x / y);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xee4(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  0xed3(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"x/y=%7.0f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
store float 2.200000e+01, float* %1
store float 7.000000e+00, float* %2
%3 = load float, float* %1
%4 = load float, float* %2
%5 = fdiv float %3, %4
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), float %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"x/y=%7.0f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), float 0x4009249240000000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dump_out_shammx(void *, unsigned int, unsigned int);
int /*<<< orphan*/ printf(char *, char *);
void dump_out_shammx_msg(const void *msg, void *buf, unsigned int size,
                         unsigned int index) {
  printf("%s : ", (char *)msg);
  dump_out_shammx(buf, size, index);
}


x86 assembly (clang, -O0):
<dump_out_shammx_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <dump_out_shammx@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_out_shammx_msg>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <dump_out_shammx@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s : \00"
define void @dump_out_shammx_msg(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 @dump_out_shammx(i8* %11, i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s : \00"
define void @dump_out_shammx_msg(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32 @dump_out_shammx(i8* %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  char *secret = getenv("SECRET_PROVISION_SECRET_STRING");
  if (secret)
    printf("--- Received secret = '%s' ---\n", secret);
  else
    printf("--- Did not receive any secret! ---\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1168 <main+0x48>
mov    -0x18(%rbp),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1176 <main+0x56>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1155 <main+0x25>
lea    0xed6(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1161 <main+0x31>
lea    0xee3(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"SECRET_PROVISION_SECRET_STRING\00"
@.str.1 = [32 x i8] c"--- Received secret = '%s' ---\0A\00"
@.str.2 = [37 x i8] c"--- Did not receive any secret! ---\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @getenv(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"SECRET_PROVISION_SECRET_STRING\00"
@.str.1 = [32 x i8] c"--- Received secret = '%s' ---\0A\00"
@str = [36 x i8] c"--- Did not receive any secret! ---\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* @getenv(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret i32 0
}
int compareInts(const void *a, const void *b) {
  return *(const int *)a - *(const int *)b;
}


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

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

LLVM IR (-O0):
define i32 @compareInts(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 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @compareInts(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
char tohex(unsigned int i) {
  static const char *alphabet = "0123456789ABCDEF";
  return alphabet[i & 0xF];
}


x86 assembly (clang, -O0):
<tohex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2f12(%rip),%rax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
mov    %ecx,%ecx
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tohex>:
and    $0xf,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@tohex.alphabet = internal global i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i32 0, i32 0)
@.str = [17 x i8] c"0123456789ABCDEF\00"
define signext i8 @tohex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i8*, i8** @tohex.alphabet
%4 = load i32, i32* %2
%5 = and i32 %4, 15
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %3, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}

LLVM IR (-O2):
@.str = [17 x i8] c"0123456789ABCDEF\00"
define signext i8 @tohex(i32 %0) {
%2 = and i32 %0, 15
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds [17 x i8], [17 x i8]* @.str, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
int strsplit_length(char **strv) {
  int count = 0;
  while (*strv++ != NULL)
    count++;
  return count;
}


x86 assembly (clang, -O0):
<strsplit_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
cmpq   $0x0,(%rax)
je     1136 <strsplit_length+0x36>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strsplit_length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strsplit_length>:
cmpq   $0x0,(%rdi)
je     111d <strsplit_length+0x1d>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <strsplit_length+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @strsplit_length(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
store i8** %0, i8*** %2
store i32 0, i32* %3
br label %4
4: ; preds = %9, %1
%5 = load i8**, i8*** %2
%6 = getelementptr inbounds i8*, i8** %5, i32 1
store i8** %6, i8*** %2
%7 = load i8*, i8** %5
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @strsplit_length(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8** [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8*, i8** %7
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
char *getFromBuffer(char *, char const *, int, int *, char *);
char *getFromContent(char *pContentPtr, const char *pField, int *pReturnSize) {
  return getFromBuffer(pContentPtr, pField, 1, pReturnSize, "\r\n");
}


x86 assembly (clang, -O0):
<getFromContent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
lea    0xec4(%rip),%r8
call   1030 <getFromBuffer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getFromContent>:
mov    %rdx,%rcx
lea    0xee6(%rip),%r8
mov    $0x1,%edx
jmp    1030 <getFromBuffer@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
define i8* @getFromContent(i8* %0, i8* %1, i32* %2) {
%4 = tail call i8* @getFromBuffer(i8* %0, i8* %1, i32 1, i32* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ mycall();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int i = 0;
  printf("World before the syscall! :)\n");
  printf("Increasing system time...\n");
  for (i = 1; i < 100000000; i++)
    ;
  printf("\n\nSystem call sys_hello returned %ld\n", mycall());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x5f5e100,-0x8(%rbp)
jge    1179 <main+0x59>
jmp    116b <main+0x4b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1159 <main+0x39>
mov    $0x0,%al
call   1030 <mycall@plt>
mov    %eax,%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [30 x i8] c"World before the syscall! :)\0A\00"
@.str.1 = [27 x i8] c"Increasing system time...\0A\00"
@.str.2 = [38 x i8] c"\0A\0ASystem call sys_hello returned %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %2
br label %5
5: ; preds = %9, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 100000000
br i1 %7, label %8, label %12
8: ; preds = %5
br label %9
9: ; preds = %8
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %5
12: ; preds = %5
%13 = call i32 (...) @mycall()
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %13)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [38 x i8] c"\0A\0ASystem call sys_hello returned %ld\0A\00"
@str = [29 x i8] c"World before the syscall! :)\00"
@str.3 = [26 x i8] c"Increasing system time...\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 (...) @mycall()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float const);
void printArray(const float result[], int sRes) {
  int i;
  for (i = 0; i < sRes; i++)
    printf("%.1f ", result[i]);
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1147 <printArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movss  (%r15,%rbx,4),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printArray+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.1f \00"
define void @printArray(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load float*, float** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds float, float* %11, i64 %13
%15 = load float, float* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.1f \00"
define void @printArray(float* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds float, float* %0, i64 %7
%9 = load float, float* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), float %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
void caller_2_2_2_2_2_2_1() {}


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

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

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

LLVM IR (-O2):
define void @caller_2_2_2_2_2_2_1() {
ret void
}
short ShortNoSwap(short s) { return s; }


x86 assembly (clang, -O0):
<ShortNoSwap>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @ShortNoSwap(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
ret i16 %3
}

LLVM IR (-O2):
define signext i16 @ShortNoSwap(i16 returned signext %0) {
ret i16 %0
}
/* Variables and functions */
int align(int, int);
int word_align(int bytes) { return align(bytes, sizeof(void *)); }


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

x86 assembly (clang, -O2):
<word_align>:
mov    $0x8,%esi
jmp    1030 <align@plt>

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

LLVM IR (-O2):
define i32 @word_align(i32 %0) {
%2 = tail call i32 @align(i32 %0, i32 8)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ enomem();
void *realloc(void *, size_t);
void *bmake_realloc(void *ptr, size_t size) {
  if ((ptr = realloc(ptr, size)) == NULL)
    enomem();
  return (ptr);
}


x86 assembly (clang, -O0):
<bmake_realloc>:
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   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
jne    1152 <bmake_realloc+0x32>
mov    $0x0,%al
call   1030 <enomem@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bmake_realloc>:
push   %rbx
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <bmake_realloc+0x15>
xor    %eax,%eax
call   1030 <enomem@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @bmake_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @enomem()
br label %11
11: ; preds = %9, %2
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
define noalias i8* @bmake_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (...) @enomem()
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void m_free(void *buffer) { free(buffer); }


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

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

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

LLVM IR (-O2):
define void @m_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ openlog(char const *, int, int);
void log_open(const char *id, int opt, int facility) {
  openlog(id, opt, facility);
}


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

x86 assembly (clang, -O2):
<log_open>:
jmp    1030 <openlog@plt>

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

LLVM IR (-O2):
define void @log_open(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @openlog(i8* %0, i32 %1, i32 %2)
ret void
}
long double lldet2(long double a, long double b, long double c, long double d) {
  return a * d - b * c;
}


x86 assembly (clang, -O0):
<lldet2>:
push   %rbp
mov    %rsp,%rbp
fldt   0x40(%rbp)
fldt   0x30(%rbp)
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fstpt  -0x30(%rbp)
fstpt  -0x40(%rbp)
fldt   -0x10(%rbp)
fldt   -0x40(%rbp)
fldt   -0x20(%rbp)
fldt   -0x30(%rbp)
fmulp  %st,%st(1)
fxch   %st(2)
fmulp  %st,%st(1)
fsubp  %st,%st(1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lldet2>:
fldt   0x38(%rsp)
fldt   0x8(%rsp)
fmulp  %st,%st(1)
fldt   0x28(%rsp)
fldt   0x18(%rsp)
fmulp  %st,%st(1)
fsubrp %st,%st(1)
ret

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

LLVM IR (-O2):
define x86_fp80 @lldet2(x86_fp80 %0, x86_fp80 %1, x86_fp80 %2, x86_fp80 %3) {
%5 = fneg x86_fp80 %1
%6 = fmul x86_fp80 %5, %2
%7 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %0, x86_fp80 %3, x86_fp80 %6)
ret x86_fp80 %7
}