xunge/DecIR huggingface dataset:
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ foreground;
};
typedef TYPE_1__ XGCValues;

/* Variables and functions */
unsigned long get_XGCValues_foreground(void *_p) {
  return (unsigned long)((XGCValues *)_p)->foreground;
}


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

x86 assembly (clang, -O2):
<get_XGCValues_foreground>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i64 @get_XGCValues_foreground(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @get_XGCValues_foreground(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int atoi(char *);
scalar_t__ isatty(int);
int main(int arg_count, char **arg_list) {
  int fildes = 0;
  if (arg_count > 1)
    fildes = atoi(arg_list[1]);
  return (isatty(fildes)) ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1157 <main+0x37>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <isatty@plt>
mov    %rax,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %edi,%eax
xor    %edi,%edi
cmp    $0x2,%eax
jl     1135 <main+0x15>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%edi
call   1030 <isatty@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %6
br label %14
14: ; preds = %9, %2
%15 = load i32, i32* %6
%16 = call i64 @isatty(i32 %15)
%17 = icmp ne i64 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 0, i32 1
ret i32 %19
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %4, %2
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
%10 = tail call i64 @isatty(i32 %9)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ TS_VERIFY_CTX;

/* Variables and functions */
int /*<<< orphan*/ TS_VERIFY_CTX_cleanup(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx) {
  if (!ctx)
    return;
  TS_VERIFY_CTX_cleanup(ctx);
  free(ctx);
}


x86 assembly (clang, -O0):
<TS_VERIFY_CTX_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113c <TS_VERIFY_CTX_free+0x1c>
jmp    114e <TS_VERIFY_CTX_free+0x2e>
mov    -0x8(%rbp),%rdi
call   1040 <TS_VERIFY_CTX_cleanup@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TS_VERIFY_CTX_free>:
test   %rdi,%rdi
je     1137 <TS_VERIFY_CTX_free+0x17>
push   %rbx
mov    %rdi,%rbx
call   1040 <TS_VERIFY_CTX_cleanup@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
define void @TS_VERIFY_CTX_free(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %11
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = call i32 @TS_VERIFY_CTX_cleanup(i32* %7)
%9 = load i32*, i32** %2
%10 = call i32 @free(i32* %9)
br label %11
11: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @TS_VERIFY_CTX_free(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @TS_VERIFY_CTX_cleanup(i32* %0)
%5 = tail call i32 @free(i32* %0)
br label %6
6: ; preds = %1, %3
ret void
}
int int_min(int a, int b) {
  if (a > b)
    return b;
  return a;
}


x86 assembly (clang, -O0):
<int_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1121 <int_min+0x21>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <int_min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_min>:
mov    %edi,%eax
cmp    %esi,%edi
cmovg  %esi,%eax
ret

LLVM IR (-O0):
define i32 @int_min(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 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %5
store i32 %10, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %9
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @int_min(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
int test_imm_6Bint64_lowword_reg(long long val) {
  return ((val) & (0x6B << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_6Bint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 107
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ utf8_char_to_wchar(char const *, size_t);
size_t vifm_wcwidth(int /*<<< orphan*/ const);
size_t get_char_screen_width(const char str[], size_t char_width) {
  const wchar_t wide = utf8_char_to_wchar(str, char_width);
  const size_t result = vifm_wcwidth(wide);
  return (result == (size_t)-1) ? 1 : result;
}


x86 assembly (clang, -O0):
<get_char_screen_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <utf8_char_to_wchar@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <vifm_wcwidth@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0xffffffffffffffff,-0x20(%rbp)
jne    1165 <get_char_screen_width+0x45>
mov    $0x1,%eax
mov    %rax,-0x28(%rbp)
jmp    116d <get_char_screen_width+0x4d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_char_screen_width>:
push   %rax
call   1040 <utf8_char_to_wchar@plt>
mov    %eax,%edi
call   1030 <vifm_wcwidth@plt>
cmp    $0xffffffffffffffff,%rax
mov    $0x1,%ecx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @get_char_screen_width(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i32 @utf8_char_to_wchar(i8* %7, i64 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = call i64 @vifm_wcwidth(i32 %10)
store i64 %11, i64* %6
%12 = load i64, i64* %6
%13 = icmp eq i64 %12, -1
br i1 %13, label %14, label %15
14: ; preds = %2
br label %17
15: ; preds = %2
%16 = load i64, i64* %6
br label %17
17: ; preds = %15, %14
%18 = phi i64 [ 1, %14 ], [ %16, %15 ]
ret i64 %18
}

LLVM IR (-O2):
define i64 @get_char_screen_width(i8* %0, i64 %1) {
%3 = tail call i32 @utf8_char_to_wchar(i8* %0, i64 %1)
%4 = tail call i64 @vifm_wcwidth(i32 %3)
%5 = icmp eq i64 %4, -1
%6 = select i1 %5, i64 1, i64 %4
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void function() { printf("Hello World\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello World\00"
define void @function() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
double test1(double x, double y, double z, double weight) {
  double tmp1 = x / weight;
  double tmp2 = y / weight;
  double tmp3 = -x / weight;
  return tmp1 + tmp2 + tmp3;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
unpcklpd %xmm0,%xmm1
unpcklpd %xmm3,%xmm3
divpd  %xmm3,%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm0,%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @test1(double %0, double %1, double %2, double %3) {
%5 = insertelement <2 x double> poison, double %1, i64 0
%6 = insertelement <2 x double> %5, double %0, i64 1
%7 = insertelement <2 x double> poison, double %3, i64 0
%8 = shufflevector <2 x double> %7, <2 x double> poison, <2 x i32> zeroinitializer
%9 = fdiv <2 x double> %6, %8
%10 = extractelement <2 x double> %9, i64 0
%11 = extractelement <2 x double> %9, i64 1
%12 = fadd double %11, %10
%13 = fsub double %12, %11
ret double %13
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void report_error2(char *message) { fprintf(stderr, "ERROR: %s\n", message); }


x86 assembly (clang, -O0):
<report_error2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_error2>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @report_error2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"ERROR: %s\0A\00"
define void @report_error2(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int f3(int a, int b) {
  __asm__ __volatile__("sub %1, %0 \n\t"
                       "jno 1f \n\t"
                       "cmc \n\t"
                       "rcr %0 \n\t"
                       "1: "
                       : "+r"(a)
                       : "r"(b)
                       : "cc");
  return a;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    %ecx,%eax
jno    111b <f3+0x1b>
cmc
rcr    %eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
mov    %edi,%eax
sub    %esi,%eax
jno    1109 <f3+0x9>
cmc
rcr    %eax
ret

LLVM IR (-O0):
define i32 @f3(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 i32 asm sideeffect "sub $1, $0 \0A\09jno 1f \0A\09cmc \0A\09rcr $0 \0A\091: ", "=r,r,0,~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %6, i32 %5)
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @f3(i32 %0, i32 %1) {
%3 = tail call i32 asm sideeffect "sub $1, $0 \0A\09jno 1f \0A\09cmc \0A\09rcr $0 \0A\091: ", "=r,r,0,~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %1, i32 %0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void ft_log(int nb) { printf("%i\n", nb); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define void @ft_log(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int);
int /*<<< orphan*/ g(int, int);
int k(int a) {
  int x, y, z;
  z = 0;
  ({
    f((1), (z));
    g((1), (z));
  });
  return 1;
}


x86 assembly (clang, -O0):
<k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    $0x1,%edi
call   1030 <f@plt>
mov    -0x10(%rbp),%esi
mov    $0x1,%edi
call   1040 <g@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<k>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
call   1030 <f@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <g@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @k(i32 %0) {
%2 = tail call i32 @f(i32 1, i32 0)
%3 = tail call i32 @g(i32 1, i32 0)
ret i32 1
}
/* Variables and functions */
int g(int);
int f(int n) { return g(n); }


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

x86 assembly (clang, -O2):
<f>:
jmp    1030 <g@plt>

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = tail call i32 @g(i32 %0)
ret i32 %2
}
float calcola_nepero() {
  float fattoriale[] = {2, 6, 24, 120, 720, 5040, 40320};
  float nepero = 2;
  int i;
  for (i = 0; i < 7; i++)
    nepero = nepero + (1 / fattoriale[i]);
  return (nepero);
}


x86 assembly (clang, -O0):
<calcola_nepero>:
push   %rbp
mov    %rsp,%rbp
mov    0xf05(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xf02(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeff(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xefd(%rip),%eax
mov    %eax,-0x8(%rbp)
movss  0xeca(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x7,-0x28(%rbp)
jge    117a <calcola_nepero+0x7a>
movss  -0x24(%rbp),%xmm0
movslq -0x28(%rbp),%rax
movss  0xea7(%rip),%xmm1
divss  -0x20(%rbp,%rax,4),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1142 <calcola_nepero+0x42>
movss  -0x24(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcola_nepero>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
@__const.calcola_nepero.fattoriale = [7 x float] [float 2.000000e+00, float 6.000000e+00, float 2.400000e+01, float 1.200000e+02, float 7.200000e+02, float 5.040000e+03, float 4.032000e+04]
define float @calcola_nepero() {
%1 = alloca [7 x float]
%2 = alloca float
%3 = alloca i32
%4 = bitcast [7 x float]* %1 to i8*
store float 2.000000e+00, float* %2
store i32 0, i32* %3
br label %5
5: ; preds = %16, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 7
br i1 %7, label %8, label %19
8: ; preds = %5
%9 = load float, float* %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [7 x float], [7 x float]* %1, i64 0, i64 %11
%13 = load float, float* %12
%14 = fdiv float 1.000000e+00, %13
%15 = fadd float %9, %14
store float %15, float* %2
br label %16
16: ; preds = %8
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
br label %5
19: ; preds = %5
%20 = load float, float* %2
ret float %20
}

LLVM IR (-O2):
define float @calcola_nepero() {
ret float 0x4005BF0900000000
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long long);
int main() {
  long long unsigned int x, y, z;
  int n;
  x = 2;
  y = 1;
  n = 0;
  while (n < 100) {
    printf("%llu\n", x);
    n = n + 1;
    z = x + y;
    x = y;
    y = z;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x2,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x64,-0x24(%rbp)
jge    117a <main+0x6a>
mov    -0x10(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1136 <main+0x26>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r15d
mov    $0x2,%ebx
mov    $0x64,%ebp
lea    0xed2(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rax
add    %r15,%rax
mov    %r15,%rbx
mov    %rax,%r15
add    $0xffffffff,%ebp
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%llu\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %6, %1 ]
%3 = phi i64 [ 2, %0 ], [ %4, %1 ]
%4 = phi i64 [ 1, %0 ], [ %7, %1 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %3)
%6 = add nuw nsw i32 %2, 1
%7 = add i64 %3, %4
%8 = icmp eq i32 %6, 100
br i1 %8, label %9, label %1
9: ; preds = %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_logdata(long long, long long, int, unsigned char *,
                                 int);
int data_scanner(void *arg, long long seq, long long timestamp, int hash,
                 unsigned char *buf, int size) {
  long long begin_seq = *(long long *)arg;
  if (begin_seq > seq) {
    return 1;
  }
  print_logdata(seq, timestamp, hash, buf, size);
  return 1;
}


x86 assembly (clang, -O0):
<data_scanner>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9d,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1154 <data_scanner+0x44>
movl   $0x1,-0x4(%rbp)
jmp    1173 <data_scanner+0x63>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x30(%rbp),%rcx
mov    -0x34(%rbp),%r8d
call   1030 <print_logdata@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_scanner>:
push   %rax
cmp    %rsi,(%rdi)
jg     1129 <data_scanner+0x19>
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %ecx,%edx
mov    %r8,%rcx
mov    %r9d,%r8d
call   1030 <print_logdata@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @data_scanner(i8* %0, i64 %1, i64 %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i64
store i8* %0, i8** %8
store i64 %1, i64* %9
store i64 %2, i64* %10
store i32 %3, i32* %11
store i8* %4, i8** %12
store i32 %5, i32* %13
%15 = load i8*, i8** %8
%16 = bitcast i8* %15 to i64*
%17 = load i64, i64* %16
store i64 %17, i64* %14
%18 = load i64, i64* %14
%19 = load i64, i64* %9
%20 = icmp sgt i64 %18, %19
br i1 %20, label %21, label %22
21: ; preds = %6
store i32 1, i32* %7
br label %29
22: ; preds = %6
%23 = load i64, i64* %9
%24 = load i64, i64* %10
%25 = load i32, i32* %11
%26 = load i8*, i8** %12
%27 = load i32, i32* %13
%28 = call i32 @print_logdata(i64 %23, i64 %24, i32 %25, i8* %26, i32 %27)
store i32 1, i32* %7
br label %29
29: ; preds = %22, %21
%30 = load i32, i32* %7
ret i32 %30
}

LLVM IR (-O2):
define i32 @data_scanner(i8* nocapture %0, i64 %1, i64 %2, i32 %3, i8* %4, i32 %5) {
%7 = bitcast i8* %0 to i64*
%8 = load i64, i64* %7
%9 = icmp sgt i64 %8, %1
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 @print_logdata(i64 %1, i64 %2, i32 %3, i8* %4, i32 %5)
br label %12
12: ; preds = %6, %10
ret i32 1
}
void ff_hevc_put_hevc_uni_epel_hv8_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_epel_hv8_8_sse4() {
ret void
}
void dummy(void) {}


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

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

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

LLVM IR (-O2):
define void @dummy() {
ret void
}
void PR27122_ext() {
  regular_enable_if(0, 2);
  regular_enable_if(1, 2);
  regular_enable_if();
}


x86 assembly (clang, -O0):
<PR27122_ext>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <regular_enable_if@plt>
mov    $0x1,%edi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <regular_enable_if@plt>
mov    $0x0,%al
call   1030 <regular_enable_if@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PR27122_ext>:
push   %rax
xor    %edi,%edi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <regular_enable_if@plt>
mov    $0x1,%edi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <regular_enable_if@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <regular_enable_if@plt>

LLVM IR (-O0):
define void @PR27122_ext() {
%1 = call i32 (i32, i32, ...) bitcast (i32 (...)* @regular_enable_if to i32 (i32, i32, ...)*)(i32 0, i32 2)
%2 = call i32 (i32, i32, ...) bitcast (i32 (...)* @regular_enable_if to i32 (i32, i32, ...)*)(i32 1, i32 2)
%3 = call i32 (...) @regular_enable_if()
ret void
}

LLVM IR (-O2):
define void @PR27122_ext() {
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @regular_enable_if to i32 (i32, i32, ...)*)(i32 0, i32 2)
%2 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @regular_enable_if to i32 (i32, i32, ...)*)(i32 1, i32 2)
%3 = tail call i32 (...) @regular_enable_if()
ret void
}
void old_style_f(a, b, c) int a, b;
double c;
{ printf("a=%d b=%d b=%f\n", a, b, c); }


x86 assembly (clang, -O0):
<old_style_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
movsd  -0x10(%rbp),%xmm0
lea    0xecb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<old_style_f>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
mov    $0x1,%al
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [16 x i8] c"a=%d b=%d b=%f\0A\00"
define void @old_style_f(i32 %0, i32 %1, double %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, double %2)
ret void
}
/* Variables and functions */
scalar_t__ RAND_MAX;
double rand();
double randmm(double min, double max) {
  double s;
  s = rand();
  s /= ((float)RAND_MAX);
  s *= (max - min);
  s += min;
  return s;
}


x86 assembly (clang, -O0):
<randmm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movsd  %xmm0,-0x18(%rbp)
mov    0x2eb3(%rip),%rax
cvtsi2ssq (%rax),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randmm>:
sub    $0x18,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2eba(%rip),%rax
xorps  %xmm1,%xmm1
cvtsi2ssq (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @randmm(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = call double (...) @rand()
store double %6, double* %5
%7 = load i64, i64* @RAND_MAX
%8 = sitofp i64 %7 to float
%9 = fpext float %8 to double
%10 = load double, double* %5
%11 = fdiv double %10, %9
store double %11, double* %5
%12 = load double, double* %4
%13 = load double, double* %3
%14 = fsub double %12, %13
%15 = load double, double* %5
%16 = fmul double %15, %14
store double %16, double* %5
%17 = load double, double* %3
%18 = load double, double* %5
%19 = fadd double %18, %17
store double %19, double* %5
%20 = load double, double* %5
ret double %20
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @randmm(double %0, double %1) {
%3 = tail call double (...) @rand()
%4 = load i64, i64* @RAND_MAX
%5 = sitofp i64 %4 to float
%6 = fpext float %5 to double
%7 = fdiv double %3, %6
%8 = fsub double %1, %0
%9 = fmul double %8, %7
%10 = fadd double %9, %0
ret double %10
}
void setgrent(void) { anvil_syslog(0, "%s unimplemented\n", __FUNCTION__); }


x86 assembly (clang, -O0):
<setgrent>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
lea    0xeee(%rip),%rdx
mov    $0x0,%al
call   1030 <anvil_syslog@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<setgrent>:
lea    0xee9(%rip),%rsi
lea    0xef4(%rip),%rdx
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <anvil_syslog@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.setgrent = [9 x i8] c"setgrent\00"
define void @setgrent() {
%1 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__FUNCTION__.setgrent, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.setgrent = [9 x i8] c"setgrent\00"
define void @setgrent() {
%1 = tail call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__FUNCTION__.setgrent, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0x0e() {
  Assert_real((isalpha(14) == 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_isalpha.c",
              75, ("isalpha should be 0 for 0x0e"));
}


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

x86 assembly (clang, -O2):
<t_isalpha_0x0e>:
push   %rax
mov    $0xe,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4b,%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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0x0e\00"
define void @t_isalpha_0x0e() {
%1 = call i64 @isalpha(i32 14)
%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 75, 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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0x0e\00"
define void @t_isalpha_0x0e() {
%1 = tail call i64 @isalpha(i32 14)
%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 75, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RemoveStreams();
int /*<<< orphan*/ SPUclose();
long SPUshutdown(void) {
  SPUclose();
  RemoveStreams();
  return 0;
}


x86 assembly (clang, -O0):
<SPUshutdown>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <SPUclose@plt>
mov    $0x0,%al
call   1040 <RemoveStreams@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @SPUshutdown() {
%1 = call i32 (...) @SPUclose()
%2 = call i32 (...) @RemoveStreams()
ret i64 0
}

LLVM IR (-O2):
define i64 @SPUshutdown() {
%1 = tail call i32 (...) @SPUclose()
%2 = tail call i32 (...) @RemoveStreams()
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ mgrSendMessageToLedController(char *);
int mgrDownloadStopped(int code, void *arg1, void *arg2) {
  ;
  if (code == 0) {
    mgrSendMessageToLedController("/led/orange/on");
  } else {
    mgrSendMessageToLedController("/led/orange/blink/fast");
  }
  return 0;
}


x86 assembly (clang, -O0):
<mgrDownloadStopped>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    113e <mgrDownloadStopped+0x2e>
lea    0xecc(%rip),%rdi
call   1030 <mgrSendMessageToLedController@plt>
jmp    114a <mgrDownloadStopped+0x3a>
lea    0xeca(%rip),%rdi
call   1030 <mgrSendMessageToLedController@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mgrDownloadStopped>:
push   %rax
test   %edi,%edi
lea    0xee6(%rip),%rax
lea    0xeee(%rip),%rdi
cmove  %rax,%rdi
call   1030 <mgrSendMessageToLedController@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"/led/orange/on\00"
@.str.1 = [23 x i8] c"/led/orange/blink/fast\00"
define i32 @mgrDownloadStopped(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @mgrSendMessageToLedController(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %13
11: ; preds = %3
%12 = call i32 @mgrSendMessageToLedController(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"/led/orange/on\00"
@.str.1 = [23 x i8] c"/led/orange/blink/fast\00"
define i32 @mgrDownloadStopped(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0)
%6 = tail call i32 @mgrSendMessageToLedController(i8* %5)
ret i32 0
}
void _Locale_monetary_destroy(struct _Locale_monetary *lmon
                              __attribute__((__unused__))) {}


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

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

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

LLVM IR (-O2):
%struct._Locale_monetary = type opaque
define void @_Locale_monetary_destroy(%struct._Locale_monetary* nocapture %0) {
ret void
}
int test_imm_D7int64_highword_reg(long long val) {
  return ((val >> 32) & (0xD7 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D7int64_highword_reg>:
movabs $0xd700000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D7int64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 215
%6 = icmp ne i64 %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_D7int64_highword_reg(i64 %0) {
%2 = and i64 %0, 923417968640
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void do_vzeroupper() { asm volatile("vzeroupper"); }


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

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

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

LLVM IR (-O2):
define void @do_vzeroupper() {
tail call void asm sideeffect "vzeroupper", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ serial_write_str(char *);
void page_fault() { serial_write_str("Page fault detected."); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"Page fault detected.\00"
define void @page_fault() {
%1 = call i32 @serial_write_str(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Page fault detected.\00"
define void @page_fault() {
%1 = tail call i32 @serial_write_str(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
float cos(float);
float sin(float);
void sinCos(float *returnSin, float *returnCos, float theta) {
  *returnSin = sin(theta);
  *returnCos = cos(theta);
}


x86 assembly (clang, -O0):
<sinCos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
call   1030 <sin@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
call   1040 <cos@plt>
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinCos>:
push   %r14
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <sin@plt>
movss  %xmm0,(%rbx)
movss  0x4(%rsp),%xmm0
call   1040 <cos@plt>
movss  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @sinCos(float* %0, float* %1, float %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float
store float* %0, float** %4
store float* %1, float** %5
store float %2, float* %6
%7 = load float, float* %6
%8 = call float @sin(float %7)
%9 = load float*, float** %4
store float %8, float* %9
%10 = load float, float* %6
%11 = call float @cos(float %10)
%12 = load float*, float** %5
store float %11, float* %12
ret void
}

LLVM IR (-O2):
define void @sinCos(float* nocapture writeonly %0, float* nocapture writeonly %1, float %2) {
%4 = tail call float @sin(float %2)
store float %4, float* %0
%5 = tail call float @cos(float %2)
store float %5, float* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CounterToLocalTimeC__1__Counter__overflow();
int /*<<< orphan*/ TransformAlarmC__1__Counter__overflow();
int /*<<< orphan*/ TransformAlarmC__2__Counter__overflow();
void TransformCounterC__1__Counter__overflow(void) {
  TransformAlarmC__2__Counter__overflow();
  TransformAlarmC__1__Counter__overflow();
  CounterToLocalTimeC__1__Counter__overflow();
}


x86 assembly (clang, -O0):
<TransformCounterC__1__Counter__overflow>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <TransformAlarmC__2__Counter__overflow@plt>
mov    $0x0,%al
call   1050 <TransformAlarmC__1__Counter__overflow@plt>
mov    $0x0,%al
call   1040 <CounterToLocalTimeC__1__Counter__overflow@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TransformCounterC__1__Counter__overflow>:
push   %rax
xor    %eax,%eax
call   1030 <TransformAlarmC__2__Counter__overflow@plt>
xor    %eax,%eax
call   1050 <TransformAlarmC__1__Counter__overflow@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <CounterToLocalTimeC__1__Counter__overflow@plt>

LLVM IR (-O0):
define void @TransformCounterC__1__Counter__overflow() {
%1 = call i32 (...) @TransformAlarmC__2__Counter__overflow()
%2 = call i32 (...) @TransformAlarmC__1__Counter__overflow()
%3 = call i32 (...) @CounterToLocalTimeC__1__Counter__overflow()
ret void
}

LLVM IR (-O2):
define void @TransformCounterC__1__Counter__overflow() {
%1 = tail call i32 (...) @TransformAlarmC__2__Counter__overflow()
%2 = tail call i32 (...) @TransformAlarmC__1__Counter__overflow()
%3 = tail call i32 (...) @CounterToLocalTimeC__1__Counter__overflow()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void vwarn(const char *fmt, va_list ap) {
  if (fmt)
    vfprintf(stderr, fmt, ap);
  perror("");
}


x86 assembly (clang, -O0):
<vwarn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114f <vwarn+0x2f>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <vfprintf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vwarn>:
test   %rdi,%rdi
je     113d <vwarn+0x1d>
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
call   1040 <vfprintf@plt>
add    $0x8,%rsp
lea    0xebc(%rip),%rdi
jmp    1030 <perror@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [1 x i8] zeroinitializer
define void @vwarn(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 = icmp ne i8* %5, null
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i32 @vfprintf(i32 %8, i8* %9, i32 %10)
br label %12
12: ; preds = %7, %2
%13 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [1 x i8] zeroinitializer
define void @vwarn(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @vfprintf(i32 %5, i8* %0, i32 %1)
br label %7
7: ; preds = %4, %2
%8 = tail call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}
unsigned long EEPROMStatusGet(void) {
  return ((*((volatile unsigned long *)(0x400AF018))));
}


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

x86 assembly (clang, -O2):
<EEPROMStatusGet>:
mov    0x400af018,%rax
40
ret

LLVM IR (-O0):
define i64 @EEPROMStatusGet() {
%1 = load volatile i64, i64* inttoptr (i64 1074458648 to i64*)
ret i64 %1
}

LLVM IR (-O2):
define i64 @EEPROMStatusGet() {
%1 = load volatile i64, i64* inttoptr (i64 1074458648 to i64*)
ret i64 %1
}
int test_imm_5Bint64_midword_reg(long long val) {
  return ((val >> 16) & (0x5B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_5Bint64_midword_reg>:
test   $0x5b0000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_5Bint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 91
%6 = icmp ne i64 %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_5Bint64_midword_reg(i64 %0) {
%2 = and i64 %0, 5963776
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("Usage: mem [-h] [-l -s -c] -a addr [-n count]\n");
}


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

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

LLVM IR (-O0):
@.str = [47 x i8] c"Usage: mem [-h] [-l -s -c] -a addr [-n count]\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [46 x i8] c"Usage: mem [-h] [-l -s -c] -a addr [-n count]\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned int num_digits(const char *s) {
  unsigned int num = 0;
  for (; ((*s) >= '0' && (*s) <= '9') && *s != '\0'; s++, num++)
    ;
  return (num);
}


x86 assembly (clang, -O0):
<num_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0xd(%rbp)
jl     1149 <num_digits+0x49>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x39,%ecx
mov    %al,-0xd(%rbp)
jg     1149 <num_digits+0x49>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1159 <num_digits+0x59>
jmp    1178 <num_digits+0x78>
jmp    115e <num_digits+0x5e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <num_digits+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_digits>:
mov    (%rdi),%cl
add    $0xd0,%cl
xor    %eax,%eax
cmp    $0x9,%cl
ja     1121 <num_digits+0x21>
xor    %eax,%eax
xchg   %ax,%ax
movzbl 0x1(%rdi,%rax,1),%ecx
add    $0xd0,%cl
add    $0x1,%rax
cmp    $0xa,%cl
jb     1110 <num_digits+0x10>
ret

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

LLVM IR (-O2):
define i32 @num_digits(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %13
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ 0, %1 ]
%7 = phi i8* [ %8, %5 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = add i32 %6, 1
%10 = load i8, i8* %8
%11 = add i8 %10, -48
%12 = icmp ult i8 %11, 10
br i1 %12, label %5, label %13
13: ; preds = %5, %1
%14 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %14
}