xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/, int, ...);
void defFileName(char *title, uint8_t num) {
  if ((num / 10) == 0) {
    sprintf(title, "%i%i%i.jpg", 0, 0, num);
  } else {
    sprintf(title, "%i%i.jpg", 0, num);
  }
  return;
}


x86 assembly (clang, -O0):
<defFileName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
jne    1152 <defFileName+0x42>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%r8d
lea    0xebe(%rip),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
mov    $0x0,%al
call   1030 <sprintf@plt>
jmp    1169 <defFileName+0x59>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0xea2(%rip),%rsi
xor    %edx,%edx
mov    $0x0,%al
call   1030 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<defFileName>:
mov    %esi,%r8d
lea    0x9(%r8),%eax
cmp    $0x12,%eax
ja     112e <defFileName+0x1e>
lea    0xedd(%rip),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %eax,%eax
jmp    1030 <sprintf@plt>
lea    0xecd(%rip),%rsi
xor    %edx,%edx
mov    %r8d,%ecx
xor    %eax,%eax
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%i%i%i.jpg\00"
@.str.1 = [9 x i8] c"%i%i.jpg\00"
define void @defFileName(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sdiv i32 %5, 10
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 %10)
br label %16
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %14)
br label %16
16: ; preds = %12, %8
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%i%i%i.jpg\00"
@.str.1 = [9 x i8] c"%i%i.jpg\00"
define void @defFileName(i8* nocapture writeonly %0, i32 %1) {
%3 = add i32 %1, 9
%4 = icmp ult i32 %3, 19
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 0, i32 0, i32 %1)
br label %9
7: ; preds = %2
%8 = tail call i32 (i8*, i8*, i32, i32, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 %1)
br label %9
9: ; preds = %7, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ free(char *);
char *get_data_str();
int /*<<< orphan*/ send_int_to_srv(int);
void update_error() {
  char *err;
  send_int_to_srv(0x1e);
  err = get_data_str();
  error(err);
  free(err);
}


x86 assembly (clang, -O0):
<update_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1e,%edi
call   1040 <send_int_to_srv@plt>
mov    $0x0,%al
call   1060 <get_data_str@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <error@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_error>:
push   %rbx
mov    $0x1e,%edi
call   1040 <send_int_to_srv@plt>
xor    %eax,%eax
call   1060 <get_data_str@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <error@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @update_error() {
%1 = alloca i8*
%2 = call i32 @send_int_to_srv(i32 30)
%3 = call i8* (...) @get_data_str()
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @error(i8* %4)
%6 = load i8*, i8** %1
%7 = call i32 @free(i8* %6)
ret void
}

LLVM IR (-O2):
define void @update_error() {
%1 = tail call i32 @send_int_to_srv(i32 30)
%2 = tail call i8* (...) @get_data_str()
%3 = tail call i32 @error(i8* %2)
%4 = tail call i32 @free(i8* %2)
ret void
}
void v3d_(vec) double vec[3];
{
  float v[3];
  v[0] = vec[0];
  v[1] = vec[1];
  v[2] = vec[2];
  vcall(v, 3);
}


x86 assembly (clang, -O0):
<v3d_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1030 <vcall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v3d_>:
sub    $0x18,%rsp
movsd  (%rdi),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0xc(%rsp)
movsd  0x8(%rdi),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
movsd  0x10(%rdi),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1030 <vcall@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @v3d_(double* %0) {
%2 = alloca double*
%3 = alloca [3 x float]
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = fptrunc double %6 to float
%8 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
store float %7, float* %8
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = fptrunc double %11 to float
%13 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 1
store float %12, float* %13
%14 = load double*, double** %2
%15 = getelementptr inbounds double, double* %14, i64 2
%16 = load double, double* %15
%17 = fptrunc double %16 to float
%18 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 2
store float %17, float* %18
%19 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%20 = call i32 (float*, i32, ...) bitcast (i32 (...)* @vcall to i32 (float*, i32, ...)*)(float* %19, i32 3)
ret void
}

LLVM IR (-O2):
define void @v3d_(double* nocapture %0) {
%2 = alloca [3 x float]
%3 = bitcast [3 x float]* %2 to i8*
%4 = load double, double* %0
%5 = fptrunc double %4 to float
%6 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 0
store float %5, float* %6
%7 = getelementptr inbounds double, double* %0, i64 1
%8 = load double, double* %7
%9 = fptrunc double %8 to float
%10 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 1
store float %9, float* %10
%11 = getelementptr inbounds double, double* %0, i64 2
%12 = load double, double* %11
%13 = fptrunc double %12 to float
%14 = getelementptr inbounds [3 x float], [3 x float]* %2, i64 0, i64 2
store float %13, float* %14
%15 = call i32 (float*, i32, ...) bitcast (i32 (...)* @vcall to i32 (float*, i32, ...)*)(float* %6, i32 3)
ret void
}
/* Variables and functions */
scalar_t__ exists(char *);
const char *scan_pm_bt() {
  if (exists("/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.6/"
             "neo1973-pm-bt.0"))
    return "/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.6/"
           "neo1973-pm-bt.0";
  return NULL;
}


x86 assembly (clang, -O0):
<scan_pm_bt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <exists@plt>
cmp    $0x0,%rax
je     113e <scan_pm_bt+0x2e>
lea    0xecb(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1146 <scan_pm_bt+0x36>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_pm_bt>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <exists@plt>
test   %rax,%rax
cmovne %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [70 x i8] c"/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.6/neo1973-pm-bt.0\00"
define i8* @scan_pm_bt() {
%1 = alloca i8*
%2 = call i64 @exists(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8** %1
br label %6
5: ; preds = %0
store i8* null, i8** %1
br label %6
6: ; preds = %5, %4
%7 = load i8*, i8** %1
ret i8* %7
}

LLVM IR (-O2):
@.str = [70 x i8] c"/sys/class/i2c-adapter/i2c-0/0-0073/pcf50633-regltr.6/neo1973-pm-bt.0\00"
define i8* @scan_pm_bt() {
%1 = tail call i64 @exists(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* null, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
void outw(unsigned short value, unsigned short port) {
  __asm__ __volatile__("out"
                       "w"
                       " %"
                       "w"
                       "0,%"
                       "w"
                       "1"
                       :
                       : "a"(value), "Nd"(port));
}


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x4(%rbp),%dx
out    %ax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outw>:
mov    %esi,%edx
mov    %edi,%eax
out    %ax,(%dx)
ret

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

LLVM IR (-O2):
define void @outw(i16 zeroext %0, i16 zeroext %1) {
tail call void asm sideeffect "outw ${0:w},${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0, i16 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ flush_buffer();
int os_char_width(char);
int /*<<< orphan*/ screen_char(char);
int units_left();
void pad_status_line(int column) {
  int spaces;
  flush_buffer();
  spaces = units_left() / os_char_width(' ') - column;
  while (spaces-- > 0)
    screen_char(' ');
}


x86 assembly (clang, -O0):
<pad_status_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1060 <flush_buffer@plt>
mov    $0x0,%al
call   1030 <units_left@plt>
mov    %eax,-0xc(%rbp)
mov    $0x20,%edi
call   1050 <os_char_width@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cltd
idiv   %ecx
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
jle    1197 <pad_status_line+0x57>
mov    $0x20,%edi
call   1040 <screen_char@plt>
jmp    1174 <pad_status_line+0x34>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pad_status_line>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <flush_buffer@plt>
xor    %eax,%eax
call   1030 <units_left@plt>
mov    %eax,%ebx
mov    $0x20,%edi
call   1050 <os_char_width@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%ebx
sub    %ebp,%ebx
jle    1182 <pad_status_line+0x42>
add    $0x1,%ebx
nop
mov    $0x20,%edi
call   1040 <screen_char@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1170 <pad_status_line+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @pad_status_line(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @flush_buffer()
%5 = call i32 (...) @units_left()
%6 = call i32 @os_char_width(i8 signext 32)
%7 = sdiv i32 %5, %6
%8 = load i32, i32* %2
%9 = sub nsw i32 %7, %8
store i32 %9, i32* %3
br label %10
10: ; preds = %14, %1
%11 = load i32, i32* %3
%12 = add nsw i32 %11, -1
store i32 %12, i32* %3
%13 = icmp sgt i32 %11, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @screen_char(i8 signext 32)
br label %10
16: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @pad_status_line(i32 %0) {
%2 = tail call i32 (...) @flush_buffer()
%3 = tail call i32 (...) @units_left()
%4 = tail call i32 @os_char_width(i8 signext 32)
%5 = sdiv i32 %3, %4
%6 = sub nsw i32 %5, %0
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1, %8
%9 = phi i32 [ %10, %8 ], [ %6, %1 ]
%10 = add nsw i32 %9, -1
%11 = tail call i32 @screen_char(i8 signext 32)
%12 = icmp ugt i32 %9, 1
br i1 %12, label %8, label %13
13: ; preds = %8, %1
ret void
}
/* Variables and functions */
scalar_t__ isspace(char);
void parser_skip_whitespace(char **cur) {
  for (; isspace(**cur); (*cur)++) {
  }
}


x86 assembly (clang, -O0):
<parser_skip_whitespace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     114d <parser_skip_whitespace+0x3d>
jmp    113a <parser_skip_whitespace+0x2a>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
jmp    111c <parser_skip_whitespace+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parser_skip_whitespace>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rax
movsbl (%rax),%edi
nopw   0x0(%rax,%rax,1)
call   1030 <isspace@plt>
test   %rax,%rax
je     113a <parser_skip_whitespace+0x2a>
mov    (%rbx),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rbx)
movsbl 0x1(%rax),%edi
jmp    1120 <parser_skip_whitespace+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @parser_skip_whitespace(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = tail call i64 @isspace(i8 signext %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1, %6
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
%9 = load i8, i8* %8
%10 = tail call i64 @isspace(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %6
12: ; preds = %6, %1
ret void
}
/* Variables and functions */
int itoa(int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, int);
main() {
  char test[1000];
  int a = 1234;
  int i;
  i = itoa(a, test, 0);
  printf("%s %d\n", test, i);
  a = -9582;
  i = itoa(a, test, 0);
  printf("%s %d\n", test, i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
movl   $0x4d2,-0x3f4(%rbp)
mov    -0x3f4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
xor    %edx,%edx
call   1040 <itoa@plt>
mov    %eax,-0x3f8(%rbp)
lea    -0x3f0(%rbp),%rsi
mov    -0x3f8(%rbp),%edx
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffda92,-0x3f4(%rbp)
da ff ff
mov    -0x3f4(%rbp),%edi
lea    -0x3f0(%rbp),%rsi
xor    %edx,%edx
call   1040 <itoa@plt>
mov    %eax,-0x3f8(%rbp)
lea    -0x3f0(%rbp),%rsi
mov    -0x3f8(%rbp),%edx
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x3e8,%rsp
mov    %rsp,%rbx
mov    $0x4d2,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <itoa@plt>
lea    0xebd(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xffffda92,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <itoa@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x3e8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%s %d\0A\00"
define i32 @main() {
%1 = alloca [1000 x i8]
%2 = getelementptr inbounds [1000 x i8], [1000 x i8]* %1, i64 0, i64 0
%3 = call i32 @itoa(i32 1234, i8* %2, i32 0)
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %3)
%5 = call i32 @itoa(i32 -9582, i8* %2, i32 0)
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %5)
ret i32 0
}
void flash_lock_opt() {}


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

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

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

LLVM IR (-O2):
define void @flash_lock_opt() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ buttons_writeGpioRegister(int, int);
int buttons_init() {
  int status = 0;
  buttons_writeGpioRegister(4, 0xF);
  status = 1;
  return status;
}


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

x86 assembly (clang, -O2):
<buttons_init>:
push   %rax
mov    $0x4,%edi
mov    $0xf,%esi
call   1030 <buttons_writeGpioRegister@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @buttons_init() {
%1 = tail call i32 @buttons_writeGpioRegister(i32 4, i32 15)
ret i32 1
}
float FormatFastConverge(float compAngle, float accAngle) {
  if (compAngle > accAngle + 3.1415926f) {
    compAngle = compAngle - 6.2831853f;
  } else if (accAngle > compAngle + 3.1415926f) {
    compAngle = compAngle + 6.2831853f;
  }
  return compAngle;
}


x86 assembly (clang, -O0):
<FormatFastConverge>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xee5(%rip),%xmm1
addss  -0x8(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    1144 <FormatFastConverge+0x44>
movss  -0x4(%rbp),%xmm0
movss  0xece(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1176 <FormatFastConverge+0x76>
movss  -0x8(%rbp),%xmm0
movss  0xeaf(%rip),%xmm1
addss  -0x4(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    1171 <FormatFastConverge+0x71>
movss  0xe9d(%rip),%xmm0
addss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1176 <FormatFastConverge+0x76>
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FormatFastConverge>:
movss  0xef8(%rip),%xmm2
addss  %xmm1,%xmm2
ucomiss %xmm2,%xmm0
jbe    111a <FormatFastConverge+0x1a>
addss  0xeef(%rip),%xmm0
ret
movss  0xede(%rip),%xmm2
addss  %xmm0,%xmm2
ucomiss %xmm2,%xmm1
jbe    1133 <FormatFastConverge+0x33>
addss  0xed1(%rip),%xmm0
ret

LLVM IR (-O0):
define float @FormatFastConverge(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fadd float %6, 0x400921FB40000000
%8 = fcmp ogt float %5, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load float, float* %3
%11 = fsub float %10, 0x401921FB60000000
store float %11, float* %3
br label %21
12: ; preds = %2
%13 = load float, float* %4
%14 = load float, float* %3
%15 = fadd float %14, 0x400921FB40000000
%16 = fcmp ogt float %13, %15
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load float, float* %3
%19 = fadd float %18, 0x401921FB60000000
store float %19, float* %3
br label %20
20: ; preds = %17, %12
br label %21
21: ; preds = %20, %9
%22 = load float, float* %3
ret float %22
}

LLVM IR (-O2):
define float @FormatFastConverge(float %0, float %1) {
%3 = fadd float %1, 0x400921FB40000000
%4 = fcmp olt float %3, %0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = fadd float %0, 0xC01921FB60000000
br label %12
7: ; preds = %2
%8 = fadd float %0, 0x400921FB40000000
%9 = fcmp olt float %8, %1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = fadd float %0, 0x401921FB60000000
br label %12
12: ; preds = %7, %10, %5
%13 = phi float [ %6, %5 ], [ %11, %10 ], [ %0, %7 ]
ret float %13
}
/* Variables and functions */
int /*<<< orphan*/ TestCase01_1();
int /*<<< orphan*/ TestCase02_1();
int /*<<< orphan*/ TestCase03_1();
int /*<<< orphan*/ TestCase04_1();
int /*<<< orphan*/ TestCase05_1();
int /*<<< orphan*/ TestCase05_2();
int /*<<< orphan*/ TestCase05_3();
int main(void) {
  TestCase01_1();
  TestCase02_1();
  TestCase03_1();
  TestCase04_1();
  TestCase05_1();
  TestCase05_2();
  TestCase05_3();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <TestCase01_1@plt>
mov    $0x0,%al
call   1050 <TestCase02_1@plt>
mov    $0x0,%al
call   1090 <TestCase03_1@plt>
mov    $0x0,%al
call   1060 <TestCase04_1@plt>
mov    $0x0,%al
call   1070 <TestCase05_1@plt>
mov    $0x0,%al
call   1030 <TestCase05_2@plt>
mov    $0x0,%al
call   1080 <TestCase05_3@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <TestCase01_1@plt>
xor    %eax,%eax
call   1050 <TestCase02_1@plt>
xor    %eax,%eax
call   1090 <TestCase03_1@plt>
xor    %eax,%eax
call   1060 <TestCase04_1@plt>
xor    %eax,%eax
call   1070 <TestCase05_1@plt>
xor    %eax,%eax
call   1030 <TestCase05_2@plt>
xor    %eax,%eax
call   1080 <TestCase05_3@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @TestCase01_1()
%3 = call i32 (...) @TestCase02_1()
%4 = call i32 (...) @TestCase03_1()
%5 = call i32 (...) @TestCase04_1()
%6 = call i32 (...) @TestCase05_1()
%7 = call i32 (...) @TestCase05_2()
%8 = call i32 (...) @TestCase05_3()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @TestCase01_1()
%2 = tail call i32 (...) @TestCase02_1()
%3 = tail call i32 (...) @TestCase03_1()
%4 = tail call i32 (...) @TestCase04_1()
%5 = tail call i32 (...) @TestCase05_1()
%6 = tail call i32 (...) @TestCase05_2()
%7 = tail call i32 (...) @TestCase05_3()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ incr_thread_count();
int /*<<< orphan*/ noreturn();
void *forever_pthread(void *unused) {
  incr_thread_count();
  noreturn();
}


x86 assembly (clang, -O0):
<forever_pthread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <incr_thread_count@plt>
mov    $0x0,%al
call   1040 <noreturn@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @forever_pthread(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i32 (...) @incr_thread_count()
%5 = call i32 (...) @noreturn()
%6 = load i8*, i8** %2
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @forever_pthread(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @incr_thread_count()
%3 = tail call i32 (...) @noreturn()
ret i8* undef
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int open64(char *, int, int /*<<< orphan*/);
int creat64(char *path, mode_t mode) {
  extern int creat_bits;
  return open64(path, creat_bits, mode);
}


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

x86 assembly (clang, -O2):
<creat64>:
mov    %esi,%edx
mov    0x2ecf(%rip),%rax
mov    (%rax),%esi
jmp    1030 <open64@plt>

LLVM IR (-O0):
@creat_bits = external global i32
define i32 @creat64(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* @creat_bits
%7 = load i32, i32* %4
%8 = call i32 @open64(i8* %5, i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@creat_bits = external global i32
define i32 @creat64(i8* nocapture %0, i32 %1) {
%3 = load i32, i32* @creat_bits
%4 = tail call i32 @open64(i8* %0, i32 %3, i32 %1)
ret i32 %4
}
void foo_2_1_2_1_1_2_2_1_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_1_2_1_1_2_2_1_1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char const *);
void fatal_error(const char *msg) {
  perror(msg);
  exit(errno);
}


x86 assembly (clang, -O0):
<fatal_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatal_error>:
push   %rax
call   1030 <perror@plt>
mov    0x2eb3(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
define void @fatal_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = load i32, i32* @errno
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
define void @fatal_error(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = load i32, i32* @errno
%4 = tail call i32 @exit(i32 %3)
unreachable
}
void av_mediacodec_release_buffer() {}


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

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

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

LLVM IR (-O2):
define void @av_mediacodec_release_buffer() {
ret void
}
int ulaw2linear(unsigned char u_val) {
  int t;
  u_val = ~u_val;
  t = ((u_val & (0xf)) << 3) + (0x84);
  t <<= ((unsigned)u_val & (0x70)) >> (4);
  return ((u_val & (0x80)) ? ((0x84) - t) : (t - (0x84)));
}


x86 assembly (clang, -O0):
<ulaw2linear>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
shl    $0x3,%eax
add    $0x84,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%ecx
and    $0x70,%ecx
shr    $0x4,%ecx
mov    -0x8(%rbp),%eax
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     115a <ulaw2linear+0x5a>
mov    $0x84,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <ulaw2linear+0x65>
mov    -0x8(%rbp),%eax
sub    $0x84,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulaw2linear>:
not    %dil
movzbl %dil,%edx
lea    0x0(,%rdx,8),%eax
or     $0x84,%eax
movzbl %al,%eax
mov    %edx,%ecx
shr    $0x4,%cl
and    $0x7,%cl
shl    %cl,%eax
mov    $0x84,%ecx
sub    %eax,%ecx
add    $0xffffff7c,%eax
test   $0x80,%dl
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @ulaw2linear(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = xor i32 %5, -1
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 15
%11 = shl i32 %10, 3
%12 = add nsw i32 %11, 132
store i32 %12, i32* %3
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = and i32 %14, 112
%16 = lshr i32 %15, 4
%17 = load i32, i32* %3
%18 = shl i32 %17, %16
store i32 %18, i32* %3
%19 = load i8, i8* %2
%20 = zext i8 %19 to i32
%21 = and i32 %20, 128
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %1
%24 = load i32, i32* %3
%25 = sub nsw i32 132, %24
br label %29
26: ; preds = %1
%27 = load i32, i32* %3
%28 = sub nsw i32 %27, 132
br label %29
29: ; preds = %26, %23
%30 = phi i32 [ %25, %23 ], [ %28, %26 ]
ret i32 %30
}

LLVM IR (-O2):
define i32 @ulaw2linear(i8 zeroext %0) {
%2 = xor i8 %0, -1
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 3
%5 = and i32 %4, 120
%6 = or i32 %5, 132
%7 = lshr i32 %3, 4
%8 = and i32 %7, 7
%9 = shl i32 %6, %8
%10 = and i32 %3, 128
%11 = icmp eq i32 %10, 0
%12 = sub nsw i32 132, %9
%13 = add nsw i32 %9, -132
%14 = select i1 %11, i32 %13, i32 %12
ret i32 %14
}
/* Variables and functions */
double sla_epj2d_(double *);
double slaEpj2d(double epj) {
  double EPJ;
  double result;
  EPJ = epj;
  result = sla_epj2d_(&EPJ);
  return result;
}


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

x86 assembly (clang, -O2):
<slaEpj2d>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
call   1030 <sla_epj2d_@plt>
pop    %rax
ret

LLVM IR (-O0):
define double @slaEpj2d(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
store double %5, double* %3
%6 = call double @sla_epj2d_(double* %3)
store double %6, double* %4
%7 = load double, double* %4
ret double %7
}

LLVM IR (-O2):
define double @slaEpj2d(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
store double %0, double* %2
%4 = call double @sla_epj2d_(double* %2)
ret double %4
}
int test_imm_EAuint16_reg(unsigned short val) {
  return ((val) & (0xEA << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_EAuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 234
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct generator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wch(struct generator *, char);
int /*<<< orphan*/ wi(struct generator *, int);
int /*<<< orphan*/ wms(struct generator *, char *);
int /*<<< orphan*/ wnl(struct generator *);
void wgotol(struct generator *g, int n) {
  wms(g, "goto lab");
  wi(g, n);
  wch(g, ';');
  wnl(g);
}


x86 assembly (clang, -O0):
<wgotol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1060 <wms@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <wi@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3b,%esi
call   1040 <wch@plt>
mov    -0x8(%rbp),%rdi
call   1050 <wnl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wgotol>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeb1(%rip),%rsi
call   1060 <wms@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <wi@plt>
mov    %rbx,%rdi
mov    $0x3b,%esi
call   1040 <wch@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <wnl@plt>

LLVM IR (-O0):
%struct.generator = type { i32 }
@.str = [9 x i8] c"goto lab\00"
define void @wgotol(%struct.generator* %0, i32 %1) {
%3 = alloca %struct.generator*
%4 = alloca i32
store %struct.generator* %0, %struct.generator** %3
store i32 %1, i32* %4
%5 = load %struct.generator*, %struct.generator** %3
%6 = call i32 @wms(%struct.generator* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = load %struct.generator*, %struct.generator** %3
%8 = load i32, i32* %4
%9 = call i32 @wi(%struct.generator* %7, i32 %8)
%10 = load %struct.generator*, %struct.generator** %3
%11 = call i32 @wch(%struct.generator* %10, i8 signext 59)
%12 = load %struct.generator*, %struct.generator** %3
%13 = call i32 @wnl(%struct.generator* %12)
ret void
}

LLVM IR (-O2):
%struct.generator = type { i32 }
@.str = [9 x i8] c"goto lab\00"
define void @wgotol(%struct.generator* %0, i32 %1) {
%3 = tail call i32 @wms(%struct.generator* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @wi(%struct.generator* %0, i32 %1)
%5 = tail call i32 @wch(%struct.generator* %0, i8 signext 59)
%6 = tail call i32 @wnl(%struct.generator* %0)
ret void
}
int compare_ulong(const void *l1, const void *l2) {
  unsigned long a, b;
  a = (unsigned long)l1;
  b = (unsigned long)l2;
  return (a > b) - (a < b);
}


x86 assembly (clang, -O0):
<compare_ulong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x18(%rbp),%rcx
cmp    -0x20(%rbp),%rcx
setb   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_ulong>:
xor    %eax,%eax
cmp    %rsi,%rdi
seta   %al
sbb    $0x0,%eax
ret

LLVM IR (-O0):
define i32 @compare_ulong(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = ptrtoint i8* %7 to i64
store i64 %8, i64* %5
%9 = load i8*, i8** %4
%10 = ptrtoint i8* %9 to i64
store i64 %10, i64* %6
%11 = load i64, i64* %5
%12 = load i64, i64* %6
%13 = icmp ugt i64 %11, %12
%14 = zext i1 %13 to i32
%15 = load i64, i64* %5
%16 = load i64, i64* %6
%17 = icmp ult i64 %15, %16
%18 = zext i1 %17 to i32
%19 = sub nsw i32 %14, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @compare_ulong(i8* readnone %0, i8* readnone %1) {
%3 = icmp ugt i8* %0, %1
%4 = zext i1 %3 to i32
%5 = icmp ult i8* %0, %1
%6 = sext i1 %5 to i32
%7 = add nsw i32 %6, %4
ret i32 %7
}
/* Variables and functions */
scalar_t__ declare_arrayNnomemset(int, int, int, int);
char **declare_char_nomemset(int first, int second) {
  return (char **)declare_arrayNnomemset(2, sizeof(char), first, second);
}


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

x86 assembly (clang, -O2):
<declare_char_nomemset>:
mov    %esi,%ecx
mov    %edi,%edx
mov    $0x2,%edi
mov    $0x1,%esi
jmp    1030 <declare_arrayNnomemset@plt>

LLVM IR (-O0):
define i8** @declare_char_nomemset(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 = call i64 @declare_arrayNnomemset(i32 2, i32 1, i32 %5, i32 %6)
%8 = inttoptr i64 %7 to i8**
ret i8** %8
}

LLVM IR (-O2):
define i8** @declare_char_nomemset(i32 %0, i32 %1) {
%3 = tail call i64 @declare_arrayNnomemset(i32 2, i32 1, i32 %0, i32 %1)
%4 = inttoptr i64 %3 to i8**
ret i8** %4
}
unsigned long partial_str_hash(unsigned long c, unsigned long prevhash) {
  return (prevhash + (c << 4) + (c >> 4)) * 11;
}


x86 assembly (clang, -O0):
<partial_str_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%rcx
shr    $0x4,%rcx
add    %rcx,%rax
imul   $0xb,%rax,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<partial_str_hash>:
mov    %rdi,%rax
shl    $0x4,%rax
add    %rsi,%rax
shr    $0x4,%rdi
add    %rax,%rdi
lea    (%rdi,%rdi,4),%rax
lea    (%rdi,%rax,2),%rax
ret

LLVM IR (-O0):
define i64 @partial_str_hash(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64, i64* %3
%7 = shl i64 %6, 4
%8 = add i64 %5, %7
%9 = load i64, i64* %3
%10 = lshr i64 %9, 4
%11 = add i64 %8, %10
%12 = mul i64 %11, 11
ret i64 %12
}

LLVM IR (-O2):
define i64 @partial_str_hash(i64 %0, i64 %1) {
%3 = shl i64 %0, 4
%4 = add i64 %3, %1
%5 = lshr i64 %0, 4
%6 = add i64 %4, %5
%7 = mul i64 %6, 11
ret i64 %7
}
/* Variables and functions */
int dump_tree(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  if (argc != 2) {
    printf("Error: must supply a single argument\n");
    return 2;
  }
  return dump_tree(argv[1]);
}


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)
cmpl   $0x2,-0x8(%rbp)
je     1158 <main+0x38>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1168 <main+0x48>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <dump_tree@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1130 <main+0x10>
mov    0x8(%rsi),%rdi
pop    %rax
jmp    1040 <dump_tree@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Error: must supply a single argument\0A\00"
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 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %3
br label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @dump_tree(i8* %13)
store i32 %14, i32* %3
br label %15
15: ; preds = %10, %8
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@str = [37 x i8] c"Error: must supply a single argument\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %10
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @dump_tree(i8* %8)
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ 2, %4 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ execv(char *, char **);
int main(int argc, char *argv[]) {
  char *real_img = "/usr/lib/mon/mon.d/dialin.monitor";
  argv[0] = real_img;
  execv(real_img, argv);
}


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"/usr/lib/mon/mon.d/dialin.monitor\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8** %5
%6 = load i8*, i8** %5
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 0
store i8* %6, i8** %8
%9 = load i8*, i8** %5
%10 = load i8**, i8*** %4
%11 = call i32 @execv(i8* %9, i8** %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"/usr/lib/mon/mon.d/dialin.monitor\00"
define i32 @main(i32 %0, i8** %1) {
store i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8** %1
%3 = tail call i32 @execv(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8** %1)
ret i32 0
}
unsigned int urand(void) {
  return ({
    extern __typeof__(urand) module_api_urand;
    &module_api_urand;
  })();
}


x86 assembly (clang, -O0):
<urand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ed9(%rip),%rax
mov    %rax,-0x8(%rbp)
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<urand>:
jmp    1030 <module_api_urand@plt>

LLVM IR (-O0):
define i32 @urand() {
%1 = alloca i32 ()*
store i32 ()* @module_api_urand, i32 ()** %1
%2 = load i32 ()*, i32 ()** %1
%3 = call i32 %2()
ret i32 %3
}

LLVM IR (-O2):
define i32 @urand() {
%1 = tail call i32 @module_api_urand()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int check_component(int c) {
  if (c < 0 || c > 255) {
    printf("\x1b["
           "1"
           ";3"
           "1"
           "m"
           "Invalid value. Component must be inside [0-255]. "
           "Please retry.\n"
           "\x1b[0m");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_component>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1132 <check_component+0x22>
cmpl   $0xff,-0x8(%rbp)
jle    114a <check_component+0x3a>
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1151 <check_component+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_component>:
xor    %eax,%eax
cmp    $0x100,%edi
jb     1130 <check_component+0x20>
push   %rax
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [75 x i8] c"\1B[1;31mInvalid value. Component must be inside [0-255]. Please retry.\0A\1B[0m\00"
define i32 @check_component(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 255
br i1 %8, label %9, label %11
9: ; preds = %6, %1
%10 = call i32 @printf(i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %12
11: ; preds = %6
store i32 0, i32* %2
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [75 x i8] c"\1B[1;31mInvalid value. Component must be inside [0-255]. Please retry.\0A\1B[0m\00"
define i32 @check_component(i32 %0) {
%2 = icmp ugt i32 %0, 255
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 1, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ ispunct(int);
void t_ispunct_0x28() {
  Assert_real((ispunct(40)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              205, ("ispunct should be 1 for ("));
}


x86 assembly (clang, -O0):
<t_ispunct_0x28>:
push   %rbp
mov    %rsp,%rbp
mov    $0x28,%edi
call   1030 <ispunct@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0xcd,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0x28>:
push   %rax
mov    $0x28,%edi
call   1030 <ispunct@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0xcd,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 1 for (\00"
define void @t_ispunct_0x28() {
%1 = call i32 @ispunct(i32 40)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 205, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 1 for (\00"
define void @t_ispunct_0x28() {
%1 = tail call i32 @ispunct(i32 40)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 205, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, void *);
void internal_func() {
  printf("internal func location of code  : %p\n", (void *)internal_func);
  printf("internal func location of heap  : %p\n", (void *)malloc(1));
  int x = 3;
  printf("internal func location of stack : %p\n", (void *)&x);
}


x86 assembly (clang, -O0):
<internal_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
mov    0x2eaa(%rip),%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,%rsi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
movl   $0x3,-0x4(%rbp)
lea    -0x4(%rbp),%rsi
lea    0xee6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_func>:
push   %rax
lea    0xed8(%rip),%rdi
mov    0x2eb1(%rip),%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <malloc@plt>
lea    0xee1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
movl   $0x3,0x4(%rsp)
lea    0xef0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [38 x i8] c"internal func location of code : %p\0A\00"
@.str.1 = [38 x i8] c"internal func location of heap : %p\0A\00"
@.str.2 = [38 x i8] c"internal func location of stack : %p\0A\00"
define void @internal_func() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* bitcast (void ()* @internal_func to i8*))
%3 = call i64 @malloc(i32 1)
%4 = inttoptr i64 %3 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %4)
store i32 3, i32* %1
%6 = bitcast i32* %1 to i8*
%7 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"internal func location of code : %p\0A\00"
@.str.1 = [38 x i8] c"internal func location of heap : %p\0A\00"
@.str.2 = [38 x i8] c"internal func location of stack : %p\0A\00"
define void @internal_func() {
%1 = alloca i32
%2 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* bitcast (void ()* @internal_func to i8*))
%3 = tail call i64 @malloc(i32 1)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = bitcast i32* %1 to i8*
store i32 3, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret void
}