xunge/DecIR huggingface dataset:
int array_cmp(unsigned char const *arr1, unsigned char const *arr2, int len) {
  int i;
  for (i = 0; i < len; ++i) {
    if (arr1[i] != arr2[i]) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<array_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1161 <array_cmp+0x61>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     114e <array_cmp+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1168 <array_cmp+0x68>
jmp    1153 <array_cmp+0x53>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <array_cmp+0x16>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_cmp>:
mov    $0x1,%eax
test   %edx,%edx
jle    1122 <array_cmp+0x22>
mov    %edx,%r8d
xor    %edx,%edx
xchg   %ax,%ax
movzbl (%rdi,%rdx,1),%ecx
cmp    (%rsi,%rdx,1),%cl
jne    1123 <array_cmp+0x23>
add    $0x1,%rdx
cmp    %rdx,%r8
jne    1110 <array_cmp+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @array_cmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = getelementptr inbounds i8, i8* %1, i64 %10
%14 = load i8, i8* %13
%15 = icmp eq i8 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 1, %3 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %18
}
unsigned long long f(unsigned long long a) { return a & 0x300000000ull; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0x300000000,%rax
and    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movabs $0x300000000,%rax
and    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @f(i64 %0) {
%2 = and i64 %0, 12884901888
ret i64 %2
}
int do_298() { return 298; }


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

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

LLVM IR (-O0):
define i32 @do_298() {
ret i32 298
}

LLVM IR (-O2):
define i32 @do_298() {
ret i32 298
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
int strncasecmp(char *, char *, int);
void strncasecmp_1() {
  char *x = "Bcd";
  char *y = "abc";
  clang_analyzer_eval(strncasecmp(x, y, 3) == 1);
}


x86 assembly (clang, -O0):
<strncasecmp_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xeca(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncasecmp_1>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xed5(%rip),%rsi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
pop    %rax
jmp    1040 <clang_analyzer_eval@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"Bcd\00"
@.str.1 = [4 x i8] c"abc\00"
define void @strncasecmp_1() {
%1 = alloca i8*
%2 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %2
%3 = load i8*, i8** %1
%4 = load i8*, i8** %2
%5 = call i32 @strncasecmp(i8* %3, i8* %4, i32 3)
%6 = icmp eq i32 %5, 1
%7 = zext i1 %6 to i32
%8 = call i32 @clang_analyzer_eval(i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"Bcd\00"
@.str.1 = [4 x i8] c"abc\00"
define void @strncasecmp_1() {
%1 = tail call i32 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @clang_analyzer_eval(i32 %3)
ret void
}
/* Variables and functions */
scalar_t__ memchr(char const *, char, int);
int /*<<< orphan*/ printf(char *, char *, char, char *, char *);
void fig08_31() {
  const char *s = "This is a string";
  printf("%s\'%c\'%s\"%s\"\n", "The remainder of s after character ", 'r',
         " is found is ", (char *)memchr(s, 'r', 16));
}


x86 assembly (clang, -O0):
<fig08_31>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x72,%esi
mov    $0x10,%edx
call   1040 <memchr@plt>
mov    %rax,%r8
lea    0xec1(%rip),%rdi
lea    0xec8(%rip),%rsi
mov    $0x72,%edx
lea    0xee0(%rip),%rcx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig08_31>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x72,%esi
mov    $0x10,%edx
call   1040 <memchr@plt>
lea    0xed3(%rip),%rdi
lea    0xeda(%rip),%rsi
lea    0xef7(%rip),%rcx
mov    $0x72,%edx
mov    %rax,%r8
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"This is a string\00"
@.str.1 = [14 x i8] c"%s'%c'%s\22%s\22\0A\00"
@.str.2 = [36 x i8] c"The remainder of s after character \00"
@.str.3 = [14 x i8] c" is found is \00"
define void @fig08_31() {
%1 = alloca i8*
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i64 @memchr(i8* %2, i8 signext 114, i32 16)
%4 = inttoptr i64 %3 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8 signext 114, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"This is a string\00"
@.str.1 = [14 x i8] c"%s'%c'%s\22%s\22\0A\00"
@.str.2 = [36 x i8] c"The remainder of s after character \00"
@.str.3 = [14 x i8] c" is found is \00"
define void @fig08_31() {
%1 = tail call i64 @memchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8 signext 114, i32 16)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i8 signext 114, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
float flt_mul(float const, int /*<<< orphan*/);
int /*<<< orphan*/ inv(float const);
int /*<<< orphan*/ isrealf(float const);
float flt_div(const float x, const float y) {
  if (!isrealf(x) || !isrealf(y)) {
    return 0.f;
  }
  return flt_mul(x, inv(y));
}


x86 assembly (clang, -O0):
<flt_div>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <isrealf@plt>
cmp    $0x0,%eax
je     1168 <flt_div+0x38>
movss  -0xc(%rbp),%xmm0
call   1040 <isrealf@plt>
cmp    $0x0,%eax
jne    1175 <flt_div+0x45>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    119a <flt_div+0x6a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <inv@plt>
movss  -0x10(%rbp),%xmm0
mov    %eax,%edi
call   1050 <flt_mul@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flt_div>:
push   %rax
movss  %xmm1,(%rsp)
movss  %xmm0,0x4(%rsp)
call   1040 <isrealf@plt>
test   %eax,%eax
je     116b <flt_div+0x3b>
movss  (%rsp),%xmm0
call   1040 <isrealf@plt>
test   %eax,%eax
je     116b <flt_div+0x3b>
movss  (%rsp),%xmm0
call   1030 <inv@plt>
movss  0x4(%rsp),%xmm0
mov    %eax,%edi
pop    %rax
jmp    1050 <flt_mul@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @flt_div(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = call i32 @isrealf(float %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load float, float* %5
%11 = call i32 @isrealf(float %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9, %2
store float 0.000000e+00, float* %3
br label %19
14: ; preds = %9
%15 = load float, float* %4
%16 = load float, float* %5
%17 = call i32 @inv(float %16)
%18 = call float @flt_mul(float %15, i32 %17)
store float %18, float* %3
br label %19
19: ; preds = %14, %13
%20 = load float, float* %3
ret float %20
}

LLVM IR (-O2):
define float @flt_div(float %0, float %1) {
%3 = tail call i32 @isrealf(float %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = tail call i32 @isrealf(float %1)
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %5
%9 = tail call i32 @inv(float %1)
%10 = tail call float @flt_mul(float %0, i32 %9)
br label %11
11: ; preds = %2, %5, %8
%12 = phi float [ %10, %8 ], [ 0.000000e+00, %5 ], [ 0.000000e+00, %2 ]
ret float %12
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ PRIO_PROCESS;
int /*<<< orphan*/ getpid();
scalar_t__ getpriority(int /*<<< orphan*/, int /*<<< orphan*/);
int setpriority(int /*<<< orphan*/, int /*<<< orphan*/, scalar_t__);
int nice(int inc) {
  pid_t me = getpid();
  return setpriority(me, PRIO_PROCESS, getpriority(me, PRIO_PROCESS) + inc);
}


x86 assembly (clang, -O0):
<nice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2e7f(%rip),%rax
mov    (%rax),%esi
call   1030 <getpriority@plt>
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    %rax,%rdx
movslq -0x4(%rbp),%rax
add    %rax,%rdx
call   1050 <setpriority@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nice>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%ebp
mov    0x2e99(%rip),%rax
mov    (%rax),%ebx
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <getpriority@plt>
movslq %r14d,%rdx
add    %rax,%rdx
mov    %ebp,%edi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <setpriority@plt>

LLVM IR (-O0):
@PRIO_PROCESS = global i32 0
define i32 @nice(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @getpid()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = load i32, i32* @PRIO_PROCESS
%7 = load i32, i32* %3
%8 = load i32, i32* @PRIO_PROCESS
%9 = call i64 @getpriority(i32 %7, i32 %8)
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = add nsw i64 %9, %11
%13 = call i32 @setpriority(i32 %5, i32 %6, i64 %12)
ret i32 %13
}

LLVM IR (-O2):
@PRIO_PROCESS = global i32 0
define i32 @nice(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = load i32, i32* @PRIO_PROCESS
%4 = tail call i64 @getpriority(i32 %2, i32 %3)
%5 = sext i32 %0 to i64
%6 = add nsw i64 %4, %5
%7 = tail call i32 @setpriority(i32 %2, i32 %3, i64 %6)
ret i32 %7
}
double ceil(double x) {
  int ix = (int)x;
  if (x == (float)ix) {
    return ix;
  }
  return ix + 1;
}


x86 assembly (clang, -O0):
<ceil>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    113e <ceil+0x3e>
jp     113e <ceil+0x3e>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    114d <ceil+0x4d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil>:
cvttsd2si %xmm0,%eax
cvttpd2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
cvtss2sd %xmm1,%xmm1
cmpneqsd %xmm0,%xmm1
movq   %xmm1,%rcx
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
ret

LLVM IR (-O0):
define double @ceil(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
%5 = load double, double* %3
%6 = fptosi double %5 to i32
store i32 %6, i32* %4
%7 = load double, double* %3
%8 = load i32, i32* %4
%9 = sitofp i32 %8 to float
%10 = fpext float %9 to double
%11 = fcmp oeq double %7, %10
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
store double %14, double* %2
br label %19
15: ; preds = %1
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
%18 = sitofp i32 %17 to double
store double %18, double* %2
br label %19
19: ; preds = %15, %12
%20 = load double, double* %2
ret double %20
}

LLVM IR (-O2):
define double @ceil(double %0) {
%2 = fptosi double %0 to i32
%3 = sitofp i32 %2 to float
%4 = fpext float %3 to double
%5 = fcmp une double %4, %0
%6 = zext i1 %5 to i32
%7 = add nsw i32 %6, %2
%8 = sitofp i32 %7 to double
ret double %8
}
int utl_charisvalid(char c, char *valids) {
  while (*valids) {
    if (c == *valids++)
      return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<utl_charisvalid>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114a <utl_charisvalid+0x4a>
movsbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1145 <utl_charisvalid+0x45>
movl   $0x1,-0x4(%rbp)
jmp    1151 <utl_charisvalid+0x51>
jmp    110e <utl_charisvalid+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utl_charisvalid>:
movzbl (%rsi),%eax
test   %al,%al
je     1116 <utl_charisvalid+0x16>
add    $0x1,%rsi
cmp    %dil,%al
jne    1100 <utl_charisvalid>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @utl_charisvalid(i8 signext %0, i8* nocapture %1) {
br label %3
3: ; preds = %7, %2
%4 = phi i8* [ %1, %2 ], [ %8, %7 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %4, i64 1
%9 = icmp eq i8 %5, %0
br i1 %9, label %10, label %3
10: ; preds = %3, %7
%11 = phi i32 [ 1, %7 ], [ 0, %3 ]
ret i32 %11
}
extern void arch_reset(char mode) {}


x86 assembly (clang, -O0):
<arch_reset>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @arch_reset(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
ret void
}

LLVM IR (-O2):
define void @arch_reset(i8 signext %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, const char *argv[]) {
  printf("It was the best of times.\n");
  printf("It was the worst of times.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%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>
lea    0xef6(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"It was the best of times.\0A\00"
@.str.1 = [28 x i8] c"It was the worst of times.\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 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [26 x i8] c"It was the best of times.\00"
@str.2 = [27 x i8] c"It was the worst of times.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ itoa_r(int, char *);
int /*<<< orphan*/ reverse(char *, char *);
int strlen(char *);
char *itoa(int value, char *str) {
  itoa_r(value, str);
  reverse(str, str + strlen(str) - 1);
  return str;
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <itoa_r@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdi
cltq
add    %rax,%rsi
add    $0xffffffffffffffff,%rsi
call   1030 <reverse@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
push   %rbx
mov    %rsi,%rbx
call   1050 <itoa_r@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
lea    (%rbx,%rax,1),%rsi
add    $0xffffffffffffffff,%rsi
mov    %rbx,%rdi
call   1030 <reverse@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @itoa(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = call i32 @itoa_r(i32 %5, i8* %6)
%8 = load i8*, i8** %4
%9 = load i8*, i8** %4
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %9, i64 %12
%14 = getelementptr inbounds i8, i8* %13, i64 -1
%15 = call i32 @reverse(i8* %8, i8* %14)
%16 = load i8*, i8** %4
ret i8* %16
}

LLVM IR (-O2):
define i8* @itoa(i32 %0, i8* returned %1) {
%3 = tail call i32 @itoa_r(i32 %0, i8* %1)
%4 = tail call i32 @strlen(i8* %1)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %1, i64 %5
%7 = getelementptr inbounds i8, i8* %6, i64 -1
%8 = tail call i32 @reverse(i8* %1, i8* %7)
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ readFpgaGrb(int, unsigned int *);
double readStatus(int addr, double factor) {
  unsigned int tmp;
  readFpgaGrb(addr, &tmp);
  return (double)tmp * factor;
}


x86 assembly (clang, -O0):
<readStatus>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1030 <readFpgaGrb@plt>
mov    -0x14(%rbp),%eax
cvtsi2sd %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readStatus>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
lea    0xc(%rsp),%rsi
call   1030 <readFpgaGrb@plt>
mov    0xc(%rsp),%eax
cvtsi2sd %rax,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @readStatus(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
store i32 %0, i32* %3
store double %1, double* %4
%6 = load i32, i32* %3
%7 = call i32 @readFpgaGrb(i32 %6, i32* %5)
%8 = load i32, i32* %5
%9 = uitofp i32 %8 to double
%10 = load double, double* %4
%11 = fmul double %9, %10
ret double %11
}

LLVM IR (-O2):
define double @readStatus(i32 %0, double %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @readFpgaGrb(i32 %0, i32* %3)
%6 = load i32, i32* %3
%7 = uitofp i32 %6 to double
%8 = fmul double %7, %1
ret double %8
}
double Add(double a, double b) { return a + b; }


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

x86 assembly (clang, -O2):
<Add>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @Add(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @Add(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
int biosig_set_equipment(int handle, const char *equipment) { return (-1); }


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

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

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

LLVM IR (-O2):
define i32 @biosig_set_equipment(i32 %0, i8* nocapture readnone %1) {
ret i32 -1
}
void file_error(filename) char *filename;
{
  perror(filename);
  exit(1);
}


x86 assembly (clang, -O0):
<file_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<file_error>:
push   %rax
xor    %eax,%eax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @file_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %3)
unreachable
}

LLVM IR (-O2):
define void @file_error(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %0)
tail call void @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ _IO(int, int /*<<< orphan*/);
int ioctl(int, int /*<<< orphan*/, int);
int nmcadec_flush(int fd, int wait) { return ioctl(fd, _IO(0xc1, 0), wait); }


x86 assembly (clang, -O0):
<nmcadec_flush>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0xc1,%edi
xor    %esi,%esi
call   1030 <_IO@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
mov    -0x8(%rbp),%edx
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmcadec_flush>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0xc1,%edi
xor    %esi,%esi
call   1030 <_IO@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
define i32 @nmcadec_flush(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 = call i32 @_IO(i32 193, i32 0)
%7 = load i32, i32* %4
%8 = call i32 @ioctl(i32 %5, i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @nmcadec_flush(i32 %0, i32 %1) {
%3 = tail call i32 @_IO(i32 193, i32 0)
%4 = tail call i32 @ioctl(i32 %0, i32 %3, i32 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ gfx_select_alpha_region(int);
int /*<<< orphan*/ gfx_set_alpha_color_enable(int /*<<< orphan*/);
int /*<<< orphan*/ gfx_set_alpha_enable(int /*<<< orphan*/);
int /*<<< orphan*/ gfx_set_video_enable(int /*<<< orphan*/);
void sc1200_reset_video(void) {
  int i;
  gfx_set_video_enable(0);
  for (i = 2; i >= 0; i--) {
    gfx_select_alpha_region(i);
    gfx_set_alpha_enable(0);
    gfx_set_alpha_color_enable(0);
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <gfx_set_video_enable@plt>
movl   $0x2,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1184 <sc1200_reset_video+0x44>
mov    -0x4(%rbp),%edi
call   1040 <gfx_select_alpha_region@plt>
xor    %edi,%edi
call   1060 <gfx_set_alpha_enable@plt>
xor    %edi,%edi
call   1050 <gfx_set_alpha_color_enable@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1156 <sc1200_reset_video+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
xor    %edi,%edi
call   1030 <gfx_set_video_enable@plt>
mov    $0x2,%edi
call   1040 <gfx_select_alpha_region@plt>
xor    %edi,%edi
call   1060 <gfx_set_alpha_enable@plt>
xor    %edi,%edi
call   1050 <gfx_set_alpha_color_enable@plt>
mov    $0x1,%edi
call   1040 <gfx_select_alpha_region@plt>
xor    %edi,%edi
call   1060 <gfx_set_alpha_enable@plt>
xor    %edi,%edi
call   1050 <gfx_set_alpha_color_enable@plt>
xor    %edi,%edi
call   1040 <gfx_select_alpha_region@plt>
xor    %edi,%edi
call   1060 <gfx_set_alpha_enable@plt>
xor    %edi,%edi
pop    %rax
jmp    1050 <gfx_set_alpha_color_enable@plt>

LLVM IR (-O0):
define void @sc1200_reset_video() {
%1 = alloca i32
%2 = call i32 @gfx_set_video_enable(i32 0)
store i32 2, i32* %1
br label %3
3: ; preds = %11, %0
%4 = load i32, i32* %1
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = load i32, i32* %1
%8 = call i32 @gfx_select_alpha_region(i32 %7)
%9 = call i32 @gfx_set_alpha_enable(i32 0)
%10 = call i32 @gfx_set_alpha_color_enable(i32 0)
br label %11
11: ; preds = %6
%12 = load i32, i32* %1
%13 = add nsw i32 %12, -1
store i32 %13, i32* %1
br label %3
14: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @sc1200_reset_video() {
%1 = tail call i32 @gfx_set_video_enable(i32 0)
%2 = tail call i32 @gfx_select_alpha_region(i32 2)
%3 = tail call i32 @gfx_set_alpha_enable(i32 0)
%4 = tail call i32 @gfx_set_alpha_color_enable(i32 0)
%5 = tail call i32 @gfx_select_alpha_region(i32 1)
%6 = tail call i32 @gfx_set_alpha_enable(i32 0)
%7 = tail call i32 @gfx_set_alpha_color_enable(i32 0)
%8 = tail call i32 @gfx_select_alpha_region(i32 0)
%9 = tail call i32 @gfx_set_alpha_enable(i32 0)
%10 = tail call i32 @gfx_set_alpha_color_enable(i32 0)
ret void
}
/* Variables and functions */
char *nasm_skip_word(char *);
char *nasm_zap_spaces_fwd(char *);
char *nasm_trim_spaces(char *p) {
  p = nasm_zap_spaces_fwd(p);
  nasm_zap_spaces_fwd(nasm_skip_word(p));
  return p;
}


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

x86 assembly (clang, -O2):
<nasm_trim_spaces>:
push   %rbx
call   1040 <nasm_zap_spaces_fwd@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <nasm_skip_word@plt>
mov    %rax,%rdi
call   1040 <nasm_zap_spaces_fwd@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @nasm_trim_spaces(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @nasm_zap_spaces_fwd(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @nasm_skip_word(i8* %5)
%7 = call i8* @nasm_zap_spaces_fwd(i8* %6)
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
define i8* @nasm_trim_spaces(i8* %0) {
%2 = tail call i8* @nasm_zap_spaces_fwd(i8* %0)
%3 = tail call i8* @nasm_skip_word(i8* %2)
%4 = tail call i8* @nasm_zap_spaces_fwd(i8* %3)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ keybuf;
typedef int /*<<< orphan*/ bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ HEXKEYBYTES;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ xdr_opaque(int /*<<< orphan*/ *, int /*<<< orphan*/,
                              int /*<<< orphan*/);
bool_t xdr_keybuf(register XDR *xdrs, keybuf objp) {
  if (!xdr_opaque(xdrs, objp, HEXKEYBYTES))
    return (FALSE);
  return (TRUE);
}


x86 assembly (clang, -O0):
<xdr_keybuf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
call   1030 <xdr_opaque@plt>
cmp    $0x0,%eax
jne    114e <xdr_keybuf+0x3e>
mov    0x2e8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <xdr_keybuf+0x4a>
mov    0x2e93(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_keybuf>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edx
call   1030 <xdr_opaque@plt>
test   %eax,%eax
jne    112c <xdr_keybuf+0x1c>
mov    0x2ea6(%rip),%rax
jmp    1133 <xdr_keybuf+0x23>
mov    0x2eb5(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@HEXKEYBYTES = global i32 0
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_keybuf(i32* %0, i32 %1) {
%3 = load i32, i32* @HEXKEYBYTES
%4 = tail call i32 @xdr_opaque(i32* %0, i32 %1, i32 %3)
%5 = icmp eq i32 %4, 0
%6 = load i32, i32* @FALSE
%7 = load i32, i32* @TRUE
%8 = select i1 %5, i32 %6, i32 %7
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Hello, world!\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
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 = [15 x i8] c"Hello, world!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello, world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
__attribute((always_)) void print(const char *fmt, ...) {}


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

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

LLVM IR (-O0):
define void @print(i8* %0, ...) {
%2 = alloca i8*
store i8* %0, i8** %2
ret void
}

LLVM IR (-O2):
define void @print(i8* nocapture %0, ...) {
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int random_number(int min, int max) {
  static int is_seeded = 0;
  if (!is_seeded) {
    srand(time(NULL));
  }
  return (rand() % (max - min)) + min;
}


x86 assembly (clang, -O0):
<random_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,0x2ef7(%rip)
jne    115b <random_number+0x2b>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_number>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
sub    %ebp,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@random_number.is_seeded = internal global i32 0
define i32 @random_number(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* @random_number.is_seeded
%6 = icmp ne i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = call i32 @time(i32* null)
%9 = call i32 @srand(i32 %8)
br label %10
10: ; preds = %7, %2
%11 = call i32 (...) @rand()
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
%15 = srem i32 %11, %14
%16 = load i32, i32* %3
%17 = add nsw i32 %15, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @random_number(i32 %0, i32 %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = sub nsw i32 %1, %0
%7 = srem i32 %5, %6
%8 = add nsw i32 %7, %0
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ MAX7219WriteByte(int /*<<< orphan*/, int, int);
int MAX7219Init() {
  MAX7219WriteByte(0, 0x09, 0x00);
  MAX7219WriteByte(0, 0x0a, 0x03);
  MAX7219WriteByte(0, 0x0b, 0x07);
  MAX7219WriteByte(0, 0x0c, 0x01);
  MAX7219WriteByte(0, 0x0f, 0x00);
  return 0;
}


x86 assembly (clang, -O0):
<MAX7219Init>:
push   %rbp
mov    %rsp,%rbp
xor    %edx,%edx
mov    $0x9,%esi
mov    %edx,%edi
call   1030 <MAX7219WriteByte@plt>
xor    %edi,%edi
mov    $0xa,%esi
mov    $0x3,%edx
call   1030 <MAX7219WriteByte@plt>
xor    %edi,%edi
mov    $0xb,%esi
mov    $0x7,%edx
call   1030 <MAX7219WriteByte@plt>
xor    %edi,%edi
mov    $0xc,%esi
mov    $0x1,%edx
call   1030 <MAX7219WriteByte@plt>
xor    %edx,%edx
mov    $0xf,%esi
mov    %edx,%edi
call   1030 <MAX7219WriteByte@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MAX7219Init>:
push   %rax
xor    %edi,%edi
mov    $0x9,%esi
xor    %edx,%edx
call   1030 <MAX7219WriteByte@plt>
xor    %edi,%edi
mov    $0xa,%esi
mov    $0x3,%edx
call   1030 <MAX7219WriteByte@plt>
xor    %edi,%edi
mov    $0xb,%esi
mov    $0x7,%edx
call   1030 <MAX7219WriteByte@plt>
xor    %edi,%edi
mov    $0xc,%esi
mov    $0x1,%edx
call   1030 <MAX7219WriteByte@plt>
xor    %edi,%edi
mov    $0xf,%esi
xor    %edx,%edx
call   1030 <MAX7219WriteByte@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @MAX7219Init() {
%1 = call i32 @MAX7219WriteByte(i32 0, i32 9, i32 0)
%2 = call i32 @MAX7219WriteByte(i32 0, i32 10, i32 3)
%3 = call i32 @MAX7219WriteByte(i32 0, i32 11, i32 7)
%4 = call i32 @MAX7219WriteByte(i32 0, i32 12, i32 1)
%5 = call i32 @MAX7219WriteByte(i32 0, i32 15, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @MAX7219Init() {
%1 = tail call i32 @MAX7219WriteByte(i32 0, i32 9, i32 0)
%2 = tail call i32 @MAX7219WriteByte(i32 0, i32 10, i32 3)
%3 = tail call i32 @MAX7219WriteByte(i32 0, i32 11, i32 7)
%4 = tail call i32 @MAX7219WriteByte(i32 0, i32 12, i32 1)
%5 = tail call i32 @MAX7219WriteByte(i32 0, i32 15, i32 0)
ret i32 0
}
double fabs(double x) { return (x < 0) ? -x : x; }


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    113d <fabs+0x3d>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1147 <fabs+0x47>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fneg double %6
br label %10
8: ; preds = %1
%9 = load double, double* %2
br label %10
10: ; preds = %8, %5
%11 = phi double [ %7, %5 ], [ %9, %8 ]
ret double %11
}

LLVM IR (-O2):
define double @fabs(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
unsigned f(unsigned x) {
  if (x == 0)
    return 0;
  else
    return x - 1;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    111d <f+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1126 <f+0x26>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
sub    $0x1,%edi
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sub i32 %8, 1
store i32 %9, i32* %2
br label %10
10: ; preds = %7, %6
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = add i32 %0, -1
%4 = select i1 %2, i32 0, i32 %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main(void) { printf("Hello"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
define void @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int wchar_t;

/* Variables and functions */
int /*<<< orphan*/ wcsncpy(int *, int const *, size_t);
wchar_t *n2a_wcscpy(wchar_t *dest, const wchar_t *src, size_t count) {
  wcsncpy(dest, src, count);
  dest[count - 1] = L'\0';
  return dest;
}


x86 assembly (clang, -O0):
<n2a_wcscpy>:
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),%rdx
call   1030 <wcsncpy@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<n2a_wcscpy>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <wcsncpy@plt>
movl   $0x0,-0x4(%rbx,%r14,4)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32* @n2a_wcscpy(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i64, i64* %6
%10 = call i32 @wcsncpy(i32* %7, i32* %8, i64 %9)
%11 = load i32*, i32** %4
%12 = load i64, i64* %6
%13 = sub i64 %12, 1
%14 = getelementptr inbounds i32, i32* %11, i64 %13
store i32 0, i32* %14
%15 = load i32*, i32** %4
ret i32* %15
}

LLVM IR (-O2):
define i32* @n2a_wcscpy(i32* returned %0, i32* %1, i64 %2) {
%4 = tail call i32 @wcsncpy(i32* %0, i32* %1, i64 %2)
%5 = add i64 %2, -1
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 0, i32* %6
ret i32* %0
}
/* Variables and functions */
char tolower(int);
int base16(int c) { return c <= '9' ? c - '0' : tolower(c) - 'a' + 10; }


x86 assembly (clang, -O0):
<base16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x39,-0x4(%rbp)
jg     1133 <base16+0x23>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <base16+0x37>
mov    -0x4(%rbp),%edi
call   1030 <tolower@plt>
movsbl %al,%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base16>:
cmp    $0x39,%edi
jg     111b <base16+0xb>
add    $0xffffffd0,%edi
mov    %edi,%eax
ret
push   %rax
call   1030 <tolower@plt>
movsbl %al,%edi
add    $0xffffffa9,%edi
add    $0x8,%rsp
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @base16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 57
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 %6, 48
br label %14
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call signext i8 @tolower(i32 %9)
%11 = sext i8 %10 to i32
%12 = sub nsw i32 %11, 97
%13 = add nsw i32 %12, 10
br label %14
14: ; preds = %8, %5
%15 = phi i32 [ %7, %5 ], [ %13, %8 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @base16(i32 %0) {
%2 = icmp slt i32 %0, 58
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = add nsw i32 %0, -48
br label %9
5: ; preds = %1
%6 = tail call signext i8 @tolower(i32 %0)
%7 = sext i8 %6 to i32
%8 = add nsw i32 %7, -87
br label %9
9: ; preds = %5, %3
%10 = phi i32 [ %4, %3 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
char *get_home_dir_curruser();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  printf("%s", get_home_dir_curruser());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = tail call i8* (...) @get_home_dir_curruser()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Variables and functions */
float acos(int);
int dot_product(float *, float *);
int length(float *);
float unsigned_angle_between(float *u, float *v) {
  return acos(dot_product(u, v) / (length(u) * length(v)));
}


x86 assembly (clang, -O0):
<unsigned_angle_between>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <dot_product@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <length@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <length@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <acos@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsigned_angle_between>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <dot_product@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <length@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1030 <length@plt>
mov    %eax,%ecx
imul   %ebx,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %eax,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <acos@plt>

LLVM IR (-O0):
define float @unsigned_angle_between(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 = call i32 @dot_product(float* %5, float* %6)
%8 = load float*, float** %3
%9 = call i32 @length(float* %8)
%10 = load float*, float** %4
%11 = call i32 @length(float* %10)
%12 = mul nsw i32 %9, %11
%13 = sdiv i32 %7, %12
%14 = call float @acos(i32 %13)
ret float %14
}

LLVM IR (-O2):
define float @unsigned_angle_between(float* %0, float* %1) {
%3 = tail call i32 @dot_product(float* %0, float* %1)
%4 = tail call i32 @length(float* %0)
%5 = tail call i32 @length(float* %1)
%6 = mul nsw i32 %5, %4
%7 = sdiv i32 %3, %6
%8 = tail call float @acos(i32 %7)
ret float %8
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0xd1() {
  Assert_real((isupper(209) == 0),
              "/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_isupper.c",
              1050, ("isupper should be 0 for 0xd1"));
}


x86 assembly (clang, -O0):
<t_isupper_0xd1>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd1,%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x41a,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0xd1>:
push   %rax
mov    $0xd1,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x41a,%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_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xd1\00"
define void @t_isupper_0xd1() {
%1 = call i64 @isupper(i32 209)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1050, i8* getelementptr inbounds ([29 x i8], [29 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_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xd1\00"
define void @t_isupper_0xd1() {
%1 = tail call i64 @isupper(i32 209)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1050, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AccelGyroSettingsHandle();
int /*<<< orphan*/ UAVObjUpdated(int /*<<< orphan*/);
void AccelGyroSettingsUpdated() { UAVObjUpdated(AccelGyroSettingsHandle()); }


x86 assembly (clang, -O0):
<AccelGyroSettingsUpdated>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <AccelGyroSettingsHandle@plt>
mov    %eax,%edi
call   1040 <UAVObjUpdated@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<AccelGyroSettingsUpdated>:
push   %rax
xor    %eax,%eax
call   1030 <AccelGyroSettingsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <UAVObjUpdated@plt>

LLVM IR (-O0):
define void @AccelGyroSettingsUpdated() {
%1 = call i32 (...) @AccelGyroSettingsHandle()
%2 = call i32 @UAVObjUpdated(i32 %1)
ret void
}

LLVM IR (-O2):
define void @AccelGyroSettingsUpdated() {
%1 = tail call i32 (...) @AccelGyroSettingsHandle()
%2 = tail call i32 @UAVObjUpdated(i32 %1)
ret void
}