xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int solveMeFirst(int, int);
int main() {
  int num1, num2;
  scanf("%d %d", &num1, &num2);
  printf("%d", solveMeFirst(num1, num2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <solveMeFirst@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <solveMeFirst@plt>
lea    0xeab(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @solveMeFirst(i32 %6, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dct64_1_486_a(double *, int *);
int /*<<< orphan*/ dct64_1_486_b(int *, int *, int *);
void dct64_486(int *a, int *b, double *samples) {
  int bufs[33];
  dct64_1_486_a(samples, bufs);
  dct64_1_486_b(a, b, bufs);
}


x86 assembly (clang, -O0):
<dct64_486>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1030 <dct64_1_486_a@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1040 <dct64_1_486_b@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dct64_486>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %rdx,%rdi
mov    %r15,%rsi
call   1030 <dct64_1_486_a@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <dct64_1_486_b@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @dct64_486(i32* %0, i32* %1, double* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca double*
%7 = alloca [33 x i32]
store i32* %0, i32** %4
store i32* %1, i32** %5
store double* %2, double** %6
%8 = load double*, double** %6
%9 = getelementptr inbounds [33 x i32], [33 x i32]* %7, i64 0, i64 0
%10 = call i32 @dct64_1_486_a(double* %8, i32* %9)
%11 = load i32*, i32** %4
%12 = load i32*, i32** %5
%13 = getelementptr inbounds [33 x i32], [33 x i32]* %7, i64 0, i64 0
%14 = call i32 @dct64_1_486_b(i32* %11, i32* %12, i32* %13)
ret void
}

LLVM IR (-O2):
define void @dct64_486(i32* %0, i32* %1, double* %2) {
%4 = alloca [33 x i32]
%5 = bitcast [33 x i32]* %4 to i8*
%6 = getelementptr inbounds [33 x i32], [33 x i32]* %4, i64 0, i64 0
%7 = call i32 @dct64_1_486_a(double* %2, i32* %6)
%8 = call i32 @dct64_1_486_b(i32* %0, i32* %1, i32* %6)
ret void
}
int ned_getint(n)
int *n;
{
  char s[100 + 1];
  if (ned_gets(s) < 0)
    return (-1);
  *n = atoi(s);
  return (0);
}


x86 assembly (clang, -O0):
<ned_getint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x0,%al
call   1030 <ned_gets@plt>
cmp    $0x0,%eax
jge    114f <ned_getint+0x2f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <ned_getint+0x49>
lea    -0x80(%rbp),%rdi
mov    $0x0,%al
call   1040 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ned_getint>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rdi,%r14
xor    %ebx,%ebx
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <ned_gets@plt>
test   %eax,%eax
js     1149 <ned_getint+0x29>
mov    %rsp,%rdi
xor    %eax,%eax
call   1040 <atoi@plt>
mov    %eax,(%r14)
jmp    114e <ned_getint+0x2e>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @ned_getint(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [101 x i8]
store i32* %0, i32** %3
%5 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @ned_gets to i32 (i8*, ...)*)(i8* %5)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %13
9: ; preds = %1
%10 = getelementptr inbounds [101 x i8], [101 x i8]* %4, i64 0, i64 0
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %10)
%12 = load i32*, i32** %3
store i32 %11, i32* %12
store i32 0, i32* %2
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @ned_getint(i32* nocapture writeonly %0) {
%2 = alloca [101 x i8]
%3 = getelementptr inbounds [101 x i8], [101 x i8]* %2, i64 0, i64 0
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @ned_gets to i32 (i8*, ...)*)(i8* %3)
%5 = icmp slt i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %3)
store i32 %7, i32* %0
br label %8
8: ; preds = %1, %6
%9 = phi i32 [ 0, %6 ], [ -1, %1 ]
ret i32 %9
}
/* Variables and functions */
scalar_t__ malloc(int);
int *makeVector9(int n) { return (int *)malloc(n * sizeof(int)); }


x86 assembly (clang, -O0):
<makeVector9>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeVector9>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i32* @makeVector9(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = mul i64 %4, 4
%6 = trunc i64 %5 to i32
%7 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to i32*
ret i32* %8
}

LLVM IR (-O2):
define i32* @makeVector9(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i32*
ret i32* %4
}
int main() {
  void gcd(int, int);
  void lcm(int, int);
  int u, v;
  scanf("%d,%d", &u, &v);
  gcd(u, v);
  lcm(u, v);
  printf("greatest common divisor = %d\n", gcd);
  printf("least common multiple number = %d\n", lcm);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1058 <gcd@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <lcm@plt>
lea    0xe94(%rip),%rdi
mov    0x2e6f(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
mov    0x2e4a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1058 <gcd@plt>
mov    0x2e8b(%rip),%r14
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <lcm@plt>
mov    0x2e68(%rip),%rbx
lea    0xe8f(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d,%d\00"
@.str.1 = [30 x i8] c"greatest common divisor = %d\0A\00"
@.str.2 = [35 x i8] c"least common multiple number = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), void (i32, i32)* @gcd)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), void (i32, i32)* @lcm)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d,%d\00"
@.str.1 = [30 x i8] c"greatest common divisor = %d\0A\00"
@.str.2 = [35 x i8] c"least common multiple number = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = load i32, i32* %1
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), void (i32, i32)* @gcd)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0), void (i32, i32)* @lcm)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void thread_id() { exit(1); }


x86 assembly (clang, -O0):
<thread_id>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

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

LLVM IR (-O0):
define void @thread_id() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @thread_id() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int CHAR_BIT;
int CHAR_MIN;
int INT_MAX;
int SCHAR_MIN;
int SHRT_MIN;
int UCHAR_MAX;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, int, int, int,
                           int, int);
unsigned int _limits(FILE *output) {
  fprintf(output, "%d %d %d %d %d %d ", CHAR_BIT, SCHAR_MIN, UCHAR_MAX,
          SHRT_MIN, INT_MAX, CHAR_MIN);
  return 3;
}


x86 assembly (clang, -O0):
<_limits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
mov    0x2e98(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb7(%rip),%rax
mov    (%rax),%r8d
mov    0x2e75(%rip),%rax
mov    (%rax),%r9d
mov    0x2e8b(%rip),%rax
mov    (%rax),%r10d
mov    0x2e89(%rip),%rax
mov    (%rax),%eax
lea    0xea0(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1030 <fprintf@plt>
mov    $0x3,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_limits>:
push   %rax
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    0x2ea7(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec6(%rip),%rax
mov    (%rax),%r8d
mov    0x2e84(%rip),%rax
mov    (%rax),%r9d
mov    0x2e9a(%rip),%rax
mov    (%rax),%r10d
mov    0x2e98(%rip),%rsi
mov    (%rsi),%eax
lea    0xeaf(%rip),%rsi
push   %rax
push   %r10
call   1030 <fprintf@plt>
add    $0x10,%rsp
mov    $0x3,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%d %d %d %d %d %d \00"
@CHAR_BIT = global i32 0
@SCHAR_MIN = global i32 0
@UCHAR_MAX = global i32 0
@SHRT_MIN = global i32 0
@INT_MAX = global i32 0
@CHAR_MIN = global i32 0
define i32 @_limits(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @CHAR_BIT
%5 = load i32, i32* @SCHAR_MIN
%6 = load i32, i32* @UCHAR_MAX
%7 = load i32, i32* @SHRT_MIN
%8 = load i32, i32* @INT_MAX
%9 = load i32, i32* @CHAR_MIN
%10 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 %9)
ret i32 3
}

LLVM IR (-O2):
@.str = [19 x i8] c"%d %d %d %d %d %d \00"
@CHAR_BIT = global i32 0
@SCHAR_MIN = global i32 0
@UCHAR_MAX = global i32 0
@SHRT_MIN = global i32 0
@INT_MAX = global i32 0
@CHAR_MIN = global i32 0
define i32 @_limits(i32* nocapture %0) {
%2 = load i32, i32* @CHAR_BIT
%3 = load i32, i32* @SCHAR_MIN
%4 = load i32, i32* @UCHAR_MAX
%5 = load i32, i32* @SHRT_MIN
%6 = load i32, i32* @INT_MAX
%7 = load i32, i32* @CHAR_MIN
%8 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7)
ret i32 3
}
/* Variables and functions */
double sqrt(double);
double math_sqrt(double x) { return sqrt(x); }


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

x86 assembly (clang, -O2):
<math_sqrt>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     111f <math_sqrt+0xf>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define double @math_sqrt(double %0) {
%2 = tail call double @sqrt(double %0)
ret double %2
}
/* Type definitions */
struct nlattr {
  int dummy;
};
typedef int /*<<< orphan*/ __le16;

/* Variables and functions */
scalar_t__ nla_data(struct nlattr const *);
__le16 nla_get_le16(const struct nlattr *nla) {
  return *(__le16 *)nla_data(nla);
}


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

x86 assembly (clang, -O2):
<nla_get_le16>:
push   %rax
call   1030 <nla_data@plt>
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.nlattr = type { i32 }
define i32 @nla_get_le16(%struct.nlattr* %0) {
%2 = alloca %struct.nlattr*
store %struct.nlattr* %0, %struct.nlattr** %2
%3 = load %struct.nlattr*, %struct.nlattr** %2
%4 = call i64 @nla_data(%struct.nlattr* %3)
%5 = inttoptr i64 %4 to i32*
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
%struct.nlattr = type { i32 }
define i32 @nla_get_le16(%struct.nlattr* %0) {
%2 = tail call i64 @nla_data(%struct.nlattr* %0)
%3 = inttoptr i64 %2 to i32*
%4 = load i32, i32* %3
ret i32 %4
}
/* Variables and functions */
float fabsf(float);
__attribute__((__weak__, __always___)) float softboundmpx_fabsf(float x) {
  return fabsf(x);
}


x86 assembly (clang, -O0):
<softboundmpx_fabsf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movaps 0xeeb(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_fabsf>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define weak float @softboundmpx_fabsf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @llvm.fabs.f32(float %3)
ret float %4
}

LLVM IR (-O2):
define weak float @softboundmpx_fabsf(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
ret float %2
}
/* Variables and functions */
int factorial(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  printf("Enter a Whole Number: ");
  scanf("%d", &n);
  printf("%d! = %d\n", n, factorial(n));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <factorial@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1030 <factorial@plt>
lea    0xeb4(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter a Whole Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"%d! = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @factorial(i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter a Whole Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"%d! = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @factorial(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
void pausedir(dir) char *dir;
{
  log3("alert: unable to opendir ", dir, ", sleeping...\n");
  sleep(10);
}


x86 assembly (clang, -O0):
<pausedir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
lea    0xedc(%rip),%rdx
mov    $0x0,%al
call   1030 <log3@plt>
mov    $0xa,%edi
mov    $0x0,%al
call   1040 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pausedir>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
lea    0xee8(%rip),%rdx
xor    %eax,%eax
call   1030 <log3@plt>
mov    $0xa,%edi
xor    %eax,%eax
pop    %rcx
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"alert: unable to opendir \00"
@.str.1 = [15 x i8] c", sleeping...\0A\00"
define void @pausedir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @log3 to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 10)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"alert: unable to opendir \00"
@.str.1 = [15 x i8] c", sleeping...\0A\00"
define void @pausedir(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @log3 to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 10)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
void storen(void *_p, size_t l, __m128i v) {
  uint8_t buf[16], *p = _p;
  *(__m128i *)buf = v;
  for (size_t i = 0; i != l; ++i)
    p[i] = buf[i];
}


x86 assembly (clang, -O0):
<storen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x60(%rbp)
movq   $0x0,-0x70(%rbp)
mov    -0x70(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     1157 <storen+0x57>
mov    -0x70(%rbp),%rax
mov    -0x60(%rbp,%rax,4),%edx
mov    -0x68(%rbp),%rax
mov    -0x70(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x70(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x70(%rbp)
jmp    1125 <storen+0x25>
pop    %rbp
ret

x86 assembly (clang, -O2):
<storen>:
sub    $0x48,%rsp
mov    %edx,(%rsp)
test   %rsi,%rsi
je     112e <storen+0x1e>
mov    %rsi,%rax
shl    $0x2,%rax
mov    %rsp,%rsi
mov    %rax,%rdx
call   1030 <memcpy@plt>
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
define void @storen(i8* nocapture writeonly %0, i64 %1, i32 %2) {
%4 = alloca [16 x i32]
%5 = bitcast [16 x i32]* %4 to i8*
%6 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
store i32 %2, i32* %6
%7 = icmp eq i64 %1, 0
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = shl nuw i64 %1, 2
br label %10
10: ; preds = %8, %3
ret void
}
/* Variables and functions */
int rand();
int random_number(void) {
  int rnd;
  rnd = rand();
  return rnd % 6;
}


x86 assembly (clang, -O0):
<random_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_number>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @random_number() {
%1 = alloca i32
%2 = call i32 (...) @rand()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = srem i32 %3, 6
ret i32 %4
}

LLVM IR (-O2):
define i32 @random_number() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 6
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ test_strcut();
int main() {
  test_strcut();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_strcut()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
__attribute__((always_)) void write8(unsigned long addr, uint8_t value) {
  *((volatile uint8_t *)(addr)) = value;
}


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

x86 assembly (clang, -O2):
<write8>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @write8(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i64, i64* %3
%7 = inttoptr i64 %6 to i32*
store volatile i32 %5, i32* %7
ret void
}

LLVM IR (-O2):
define void @write8(i64 %0, i32 %1) {
%3 = inttoptr i64 %0 to i32*
store volatile i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void b_quit() { exit(0); }


x86 assembly (clang, -O0):
<b_quit>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<b_quit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @b_quit() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @b_quit() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
void fputshort(short v, FILE *fp) {
  fputc((char)((v >> 0) & 0xff), fp);
  fputc((char)((v >> 8) & 0xff), fp);
}


x86 assembly (clang, -O0):
<fputshort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movswl -0x2(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
movswl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    -0x10(%rbp),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fputshort>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
movsbl %bpl,%edi
call   1030 <fputc@plt>
sar    $0x8,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
define void @fputshort(i16 signext %0, i32* %1) {
%3 = alloca i16
%4 = alloca i32*
store i16 %0, i16* %3
store i32* %1, i32** %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = ashr i32 %6, 0
%8 = and i32 %7, 255
%9 = trunc i32 %8 to i8
%10 = load i32*, i32** %4
%11 = call i32 @fputc(i8 signext %9, i32* %10)
%12 = load i16, i16* %3
%13 = sext i16 %12 to i32
%14 = ashr i32 %13, 8
%15 = and i32 %14, 255
%16 = trunc i32 %15 to i8
%17 = load i32*, i32** %4
%18 = call i32 @fputc(i8 signext %16, i32* %17)
ret void
}

LLVM IR (-O2):
define void @fputshort(i16 signext %0, i32* nocapture %1) {
%3 = trunc i16 %0 to i8
%4 = tail call i32 @fputc(i8 signext %3, i32* %1)
%5 = lshr i16 %0, 8
%6 = trunc i16 %5 to i8
%7 = tail call i32 @fputc(i8 signext %6, i32* %1)
ret void
}
/* Variables and functions */
int clock();
long msGettick(void) {
  return clock() / 1000;
  ;
}


x86 assembly (clang, -O0):
<msGettick>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <clock@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<msGettick>:
push   %rax
xor    %eax,%eax
call   1030 <clock@plt>
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @msGettick() {
%1 = call i32 (...) @clock()
%2 = sdiv i32 %1, 1000
%3 = sext i32 %2 to i64
ret i64 %3
}

LLVM IR (-O2):
define i64 @msGettick() {
%1 = tail call i32 (...) @clock()
%2 = sdiv i32 %1, 1000
%3 = sext i32 %2 to i64
ret i64 %3
}
int write_xattr(char *pathname, unsigned int xattr) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @write_xattr(i8* nocapture readnone %0, i32 %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ nextState(double);
int /*<<< orphan*/ paintRobotImg(char *, double, double);
int /*<<< orphan*/ readControl();
int /*<<< orphan*/ sleep_ms(int);
double time_elapsed();
int /*<<< orphan*/ writeState();
void loop() {
  readControl();
  double dt = time_elapsed();
  nextState(dt);
  writeState();
  paintRobotImg("./robots/3engines/imgs/shipD.png", 0.4, 0.205);
  sleep_ms(10);
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <readControl@plt>
mov    $0x0,%al
call   1030 <time_elapsed@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <nextState@plt>
mov    $0x0,%al
call   1050 <writeState@plt>
lea    0xe7d(%rip),%rdi
movsd  0xe65(%rip),%xmm0
movsd  0xe65(%rip),%xmm1
call   1080 <paintRobotImg@plt>
mov    $0xa,%edi
call   1060 <sleep_ms@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rax
xor    %eax,%eax
call   1070 <readControl@plt>
xor    %eax,%eax
call   1030 <time_elapsed@plt>
call   1040 <nextState@plt>
xor    %eax,%eax
call   1050 <writeState@plt>
lea    0xe8e(%rip),%rdi
movsd  0xe76(%rip),%xmm0
movsd  0xe76(%rip),%xmm1
call   1080 <paintRobotImg@plt>
mov    $0xa,%edi
pop    %rax
jmp    1060 <sleep_ms@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"./robots/3engines/imgs/shipD.png\00"
define void @loop() {
%1 = alloca double
%2 = call i32 (...) @readControl()
%3 = call double (...) @time_elapsed()
store double %3, double* %1
%4 = load double, double* %1
%5 = call i32 @nextState(double %4)
%6 = call i32 (...) @writeState()
%7 = call i32 @paintRobotImg(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double 4.000000e-01, double 2.050000e-01)
%8 = call i32 @sleep_ms(i32 10)
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"./robots/3engines/imgs/shipD.png\00"
define void @loop() {
%1 = tail call i32 (...) @readControl()
%2 = tail call double (...) @time_elapsed()
%3 = tail call i32 @nextState(double %2)
%4 = tail call i32 (...) @writeState()
%5 = tail call i32 @paintRobotImg(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double 4.000000e-01, double 2.050000e-01)
%6 = tail call i32 @sleep_ms(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printTab(int *, int);
int /*<<< orphan*/ triCasier(int *, int);
int main() {
  int tab[] = {1, 5, 3, 6, 9, 645, 1, 4, 2, 567, 8};
  printTab(tab, 11);
  triCasier(tab, 11);
  printTab(tab, 11);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x2c,%edx
call   1040 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0xb,%esi
call   1030 <printTab@plt>
lea    -0x30(%rbp),%rdi
mov    $0xb,%esi
call   1050 <triCasier@plt>
lea    -0x30(%rbp),%rdi
mov    $0xb,%esi
call   1030 <printTab@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
movups 0xef0(%rip),%xmm0
movups %xmm0,0x1c(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xb,%esi
call   1030 <printTab@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1040 <triCasier@plt>
mov    %rbx,%rdi
mov    $0xb,%esi
call   1030 <printTab@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.tab = [11 x i32] [i32 1, i32 5, i32 3, i32 6, i32 9, i32 645, i32 1, i32 4, i32 2, i32 567, i32 8]
define i32 @main() {
%1 = alloca i32
%2 = alloca [11 x i32]
store i32 0, i32* %1
%3 = bitcast [11 x i32]* %2 to i8*
%4 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 0
%5 = call i32 @printTab(i32* %4, i32 11)
%6 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 0
%7 = call i32 @triCasier(i32* %6, i32 11)
%8 = getelementptr inbounds [11 x i32], [11 x i32]* %2, i64 0, i64 0
%9 = call i32 @printTab(i32* %8, i32 11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.tab = [11 x i32] [i32 1, i32 5, i32 3, i32 6, i32 9, i32 645, i32 1, i32 4, i32 2, i32 567, i32 8]
define i32 @main() {
%1 = alloca [11 x i32]
%2 = bitcast [11 x i32]* %1 to i8*
%3 = getelementptr inbounds [11 x i32], [11 x i32]* %1, i64 0, i64 0
%4 = call i32 @printTab(i32* %3, i32 11)
%5 = call i32 @triCasier(i32* %3, i32 11)
%6 = call i32 @printTab(i32* %3, i32 11)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_fail(char *msg) {
  printf("%s", msg);
  printf("\x1B[31m");
  printf("%s", "FAIL\n");
  printf("\x1B[0m");
}


x86 assembly (clang, -O0):
<print_fail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_fail>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.2 = [6 x i8] c"FAIL\0A\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
define void @print_fail(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"\1B[31m\00"
@.str.3 = [5 x i8] c"\1B[0m\00"
@str = [5 x i8] c"FAIL\00"
define void @print_fail(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CompileConstant(int);
void DoPConstant(void) { CompileConstant(51); }


x86 assembly (clang, -O0):
<DoPConstant>:
push   %rbp
mov    %rsp,%rbp
mov    $0x33,%edi
call   1030 <CompileConstant@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoPConstant>:
mov    $0x33,%edi
jmp    1030 <CompileConstant@plt>

LLVM IR (-O0):
define void @DoPConstant() {
%1 = call i32 @CompileConstant(i32 51)
ret void
}

LLVM IR (-O2):
define void @DoPConstant() {
%1 = tail call i32 @CompileConstant(i32 51)
ret void
}
int inc_sol_seq(int seq) {
  seq++;
  if (seq > 0x0f)
    seq = 1;
  return (seq);
}


x86 assembly (clang, -O0):
<inc_sol_seq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0xf,-0x4(%rbp)
jle    1121 <inc_sol_seq+0x21>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc_sol_seq>:
lea    0x1(%rdi),%ecx
cmp    $0xf,%edi
mov    $0x1,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @inc_sol_seq(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 15
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %8
8: ; preds = %7, %1
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @inc_sol_seq(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = icmp sgt i32 %0, 14
%4 = select i1 %3, i32 1, i32 %2
ret i32 %4
}
/* Variables and functions */
char *emalloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
char *boolean_toString(char x) {
  char *s;
  if (x) {
    s = emalloc(5);
    strcpy(s, "true");
  } else {
    s = emalloc(6);
    strcpy(s, "false");
  }
  return s;
}


x86 assembly (clang, -O0):
<boolean_toString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     115b <boolean_toString+0x3b>
mov    $0x5,%edi
call   1040 <emalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1179 <boolean_toString+0x59>
mov    $0x6,%edi
call   1040 <emalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boolean_toString>:
push   %rbx
test   %dil,%dil
je     113c <boolean_toString+0x1c>
mov    $0x5,%edi
call   1040 <emalloc@plt>
mov    %rax,%rbx
lea    0xec6(%rip),%rsi
jmp    1150 <boolean_toString+0x30>
mov    $0x6,%edi
call   1040 <emalloc@plt>
mov    %rax,%rbx
lea    0xeb5(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @boolean_toString(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8*
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = icmp ne i8 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i8* @emalloc(i32 5)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %14
10: ; preds = %1
%11 = call i8* @emalloc(i32 6)
store i8* %11, i8** %3
%12 = load i8*, i8** %3
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %10, %6
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define i8* @boolean_toString(i8 signext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i8* @emalloc(i32 5)
%5 = tail call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %9
6: ; preds = %1
%7 = tail call i8* @emalloc(i32 6)
%8 = tail call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %6, %3
%10 = phi i8* [ %4, %3 ], [ %7, %6 ]
ret i8* %10
}
float mph_to_kph(float value) { return value * 1.609344f; }


x86 assembly (clang, -O0):
<mph_to_kph>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define float @mph_to_kph(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 0x3FF9BFDF80000000
ret float %4
}

LLVM IR (-O2):
define float @mph_to_kph(float %0) {
%2 = fmul float %0, 0x3FF9BFDF80000000
ret float %2
}
int test_imm_B2int8_mem(signed char *val) {
  return ((*val) & (-0xB2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_B2int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff4e,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B2int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -178
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
unsigned int exynos_5410_gpio_read(unsigned int);
unsigned int odroid_xu_gpio_read_27() {
  unsigned int bank_offset = 0x0C60;
  unsigned int bit_index = 1;
  return (exynos_5410_gpio_read(bank_offset) >> bit_index) & 0x1;
}


x86 assembly (clang, -O0):
<odroid_xu_gpio_read_27>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xc60,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exynos_5410_gpio_read@plt>
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
and    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<odroid_xu_gpio_read_27>:
push   %rax
mov    $0xc60,%edi
call   1030 <exynos_5410_gpio_read@plt>
shr    %eax
and    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @odroid_xu_gpio_read_27() {
%1 = alloca i32
%2 = alloca i32
store i32 3168, i32* %1
store i32 1, i32* %2
%3 = load i32, i32* %1
%4 = call i32 @exynos_5410_gpio_read(i32 %3)
%5 = load i32, i32* %2
%6 = lshr i32 %4, %5
%7 = and i32 %6, 1
ret i32 %7
}

LLVM IR (-O2):
define i32 @odroid_xu_gpio_read_27() {
%1 = tail call i32 @exynos_5410_gpio_read(i32 3168)
%2 = lshr i32 %1, 1
%3 = and i32 %2, 1
ret i32 %3
}
unsigned long get_cr3(void) {
  unsigned long cr3;
  asm("mov %%cr3, %0\n" : "=r"(cr3));
  return cr3;
}


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

x86 assembly (clang, -O2):
<get_cr3>:
mov    %cr3,%rax
ret

LLVM IR (-O0):
define i64 @get_cr3() {
%1 = alloca i64
%2 = call i64 asm "mov %cr3, $0\0A", "=r,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @get_cr3() {
%1 = tail call i64 asm "mov %cr3, $0\0A", "=r,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int strcmp(char *, char *);
int equal_string(void *s1, void *s2) {
  char **str_1 = (char **)s1;
  char **str_2 = (char **)s2;
  printf("hit string");
  int comparison = strcmp(*str_1, *str_2);
  if (comparison == 0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<equal_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rsi
call   1040 <strcmp@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1178 <equal_string+0x58>
movl   $0x1,-0x4(%rbp)
jmp    117f <equal_string+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    (%rbx),%rdi
mov    (%r14),%rsi
call   1040 <strcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"hit string\00"
define i32 @equal_string(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i8**
store i8** %12, i8*** %7
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%14 = load i8**, i8*** %6
%15 = load i8*, i8** %14
%16 = load i8**, i8*** %7
%17 = load i8*, i8** %16
%18 = call i32 @strcmp(i8* %15, i8* %17)
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %2
store i32 1, i32* %3
br label %23
22: ; preds = %2
store i32 0, i32* %3
br label %23
23: ; preds = %22, %21
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
@.str = [11 x i8] c"hit string\00"
define i32 @equal_string(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(1) %7)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
ret i32 %10
}
int test_imm_FDint8_mem(signed char *val) {
  return ((*val) & (0xFD << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_FDint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -3
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ test_stochastic_rounding();
int main(void) { test_stochastic_rounding(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @test_stochastic_rounding()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_stochastic_rounding()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix "
                  "char>] < in.map > out.S\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [82 x i8] c"Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [82 x i8] c"Usage: kallsyms [--all-symbols] [--symbol-prefix=<prefix char>] < in.map > out.S\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, float *, int);
void copyvector(float *result, float *vec) { memcpy(result, vec, 12); }


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

x86 assembly (clang, -O2):
<copyvector>:
mov    $0xc,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @copyvector(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 @memcpy(float* %5, float* %6, i32 12)
ret void
}

LLVM IR (-O2):
define void @copyvector(float* %0, float* %1) {
%3 = tail call i32 @memcpy(float* %0, float* %1, i32 12)
ret void
}