xunge/DecIR huggingface dataset:
void get_rpz(const double *x, double *rpz) {
  rpz[0] = x[0];
  rpz[1] = x[1];
  rpz[2] = x[2];
}


x86 assembly (clang, -O0):
<get_rpz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_rpz>:
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi)
movsd  0x8(%rdi),%xmm0
movsd  %xmm0,0x8(%rsi)
movsd  0x10(%rdi),%xmm0
movsd  %xmm0,0x10(%rsi)
ret

LLVM IR (-O0):
define void @get_rpz(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 1
%12 = load double, double* %11
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
%15 = load double*, double** %3
%16 = getelementptr inbounds double, double* %15, i64 2
%17 = load double, double* %16
%18 = load double*, double** %4
%19 = getelementptr inbounds double, double* %18, i64 2
store double %17, double* %19
ret void
}

LLVM IR (-O2):
define void @get_rpz(double* nocapture %0, double* nocapture writeonly %1) {
%3 = load double, double* %0
store double %3, double* %1
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %1, i64 1
store double %5, double* %6
%7 = getelementptr inbounds double, double* %0, i64 2
%8 = load double, double* %7
%9 = getelementptr inbounds double, double* %1, i64 2
store double %8, double* %9
ret void
}
int main() { return sizeof(signed long long int); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x8,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
int get_screen_offset(int col, int row) {
  if (col >= 80) {
    col = 0;
    ++row;
  }
  int offset = (row * 80 + col) * 2;
  return offset;
}


x86 assembly (clang, -O0):
<get_screen_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x50,-0x4(%rbp)
jl     1124 <get_screen_offset+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
imul   $0x50,-0x8(%rbp),%eax
add    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_screen_offset>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    $0x50,%edi
setge  %al
cmovl  %edi,%ecx
add    %esi,%eax
lea    (%rax,%rax,4),%eax
shl    $0x4,%eax
add    %ecx,%eax
add    %eax,%eax
ret

LLVM IR (-O0):
define i32 @get_screen_offset(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 80
br i1 %7, label %8, label %11
8: ; preds = %2
store i32 0, i32* %3
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
store i32 %10, i32* %4
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, 80
%14 = load i32, i32* %3
%15 = add nsw i32 %13, %14
%16 = mul nsw i32 %15, 2
store i32 %16, i32* %5
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
define i32 @get_screen_offset(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 79
%4 = zext i1 %3 to i32
%5 = add nsw i32 %4, %1
%6 = select i1 %3, i32 0, i32 %0
%7 = mul nsw i32 %5, 80
%8 = add nsw i32 %7, %6
%9 = shl nsw i32 %8, 1
ret i32 %9
}
/* Variables and functions */
scalar_t__ strcmp(char *, char const *);
bool is_help_param(const char *param) {
  return (param != NULL &&
          ((strcmp("-h", param) == 0) || (strcmp("--help", param) == 0)));
}


x86 assembly (clang, -O0):
<is_help_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     116e <is_help_param+0x5e>
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <strcmp@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xa(%rbp)
je     1168 <is_help_param+0x58>
mov    -0x8(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_help_param>:
push   %rbx
test   %rdi,%rdi
je     1149 <is_help_param+0x39>
mov    %rdi,%rbx
lea    0xee0(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     114d <is_help_param+0x3d>
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
define i32 @is_help_param(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = icmp eq i64 %11, 0
br label %13
13: ; preds = %9, %5
%14 = phi i1 [ true, %5 ], [ %12, %9 ]
br label %15
15: ; preds = %13, %1
%16 = phi i1 [ false, %1 ], [ %14, %13 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
define i32 @is_help_param(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i64 @strcmp(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %3, %6, %1
%11 = phi i32 [ 0, %1 ], [ 1, %3 ], [ %9, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ customer(int);
int fork();
int /*<<< orphan*/ perror(char *);
int startcustomer(int i) {
  int pid;
  pid = fork();
  switch (pid) {
  case 0:
    customer(i);
  case -1:
    perror("fork");
    return (-1);
  default:
    return (pid);
  }
}


x86 assembly (clang, -O0):
<startcustomer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xffffffff,%eax
je     1171 <startcustomer+0x41>
jmp    1159 <startcustomer+0x29>
mov    -0x10(%rbp),%eax
test   %eax,%eax
jne    1189 <startcustomer+0x59>
jmp    1169 <startcustomer+0x39>
mov    -0x8(%rbp),%edi
call   1030 <customer@plt>
lea    0xe88(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    118f <startcustomer+0x5f>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<startcustomer>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <fork@plt>
cmp    $0xffffffff,%eax
je     114c <startcustomer+0x1c>
test   %eax,%eax
je     1145 <startcustomer+0x15>
pop    %rbx
ret
mov    %ebx,%edi
call   1030 <customer@plt>
lea    0xead(%rip),%rdi
call   1040 <perror@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fork\00"
define i32 @startcustomer(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = call i32 (...) @fork()
store i32 %5, i32* %4
%6 = load i32, i32* %4
switch i32 %6, label %12 [
i32 0, label %7
i32 -1, label %10
]
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i32 @customer(i32 %8)
br label %10
10: ; preds = %1, %7
%11 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %14
12: ; preds = %1
%13 = load i32, i32* %4
store i32 %13, i32* %2
br label %14
14: ; preds = %12, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [5 x i8] c"fork\00"
define i32 @startcustomer(i32 %0) {
%2 = tail call i32 (...) @fork()
switch i32 %2, label %7 [
i32 0, label %3
i32 -1, label %5
]
3: ; preds = %1
%4 = tail call i32 @customer(i32 %0)
br label %5
5: ; preds = %1, %3
%6 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ -1, %5 ], [ %2, %1 ]
ret i32 %8
}
/* Variables and functions */
#define EAGAIN 132
#define EALREADY 131
#define EINPROGRESS 130
#define EINTR 129
#define ENOTCONN 128
int BIO_sock_non_fatal_error(int err) {
  switch (err) {
  case ENOTCONN:
  case EINTR:
  case EAGAIN:
  case EINPROGRESS:
  case EALREADY:
    return (1);
  default:
    break;
  }
  return (0);
}


x86 assembly (clang, -O0):
<BIO_sock_non_fatal_error>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffff80,%eax
sub    $0x4,%eax
ja     1127 <BIO_sock_non_fatal_error+0x27>
jmp    111b <BIO_sock_non_fatal_error+0x1b>
movl   $0x1,-0x4(%rbp)
jmp    1133 <BIO_sock_non_fatal_error+0x33>
jmp    112c <BIO_sock_non_fatal_error+0x2c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<BIO_sock_non_fatal_error>:
add    $0xffffff80,%edi
xor    %eax,%eax
cmp    $0x5,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @BIO_sock_non_fatal_error(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 128, label %5
i32 129, label %5
i32 132, label %5
i32 130, label %5
i32 131, label %5
]
5: ; preds = %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %8
6: ; preds = %1
br label %7
7: ; preds = %6
store i32 0, i32* %2
br label %8
8: ; preds = %7, %5
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @BIO_sock_non_fatal_error(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 5
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct rstate {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ replicator_iteration(struct rstate *);
void *replicator_loop(void *arg) {
  struct rstate *rs = (struct rstate *)arg;
  for (;;) {
    replicator_iteration(rs);
  }
}


x86 assembly (clang, -O0):
<replicator_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <replicator_iteration@plt>
jmp    1124 <replicator_loop+0x14>

x86 assembly (clang, -O2):
<replicator_loop>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <replicator_iteration@plt>
jmp    1120 <replicator_loop+0x10>

LLVM IR (-O0):
%struct.rstate = type { i32 }
define i8* @replicator_loop(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.rstate*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.rstate*
store %struct.rstate* %5, %struct.rstate** %3
br label %6
6: ; preds = %6, %1
%7 = load %struct.rstate*, %struct.rstate** %3
%8 = call i32 @replicator_iteration(%struct.rstate* %7)
br label %6
}

LLVM IR (-O2):
%struct.rstate = type { i32 }
define noalias i8* @replicator_loop(i8* %0) {
%2 = bitcast i8* %0 to %struct.rstate*
br label %3
3: ; preds = %3, %1
%4 = tail call i32 @replicator_iteration(%struct.rstate* %2)
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ set_hl(int /*<<< orphan*/);
void opcb_c6() { set_hl(0); }


x86 assembly (clang, -O0):
<opcb_c6>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <set_hl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<opcb_c6>:
xor    %edi,%edi
jmp    1030 <set_hl@plt>

LLVM IR (-O0):
define void @opcb_c6() {
%1 = call i32 @set_hl(i32 0)
ret void
}

LLVM IR (-O2):
define void @opcb_c6() {
%1 = tail call i32 @set_hl(i32 0)
ret void
}
double calculatePi(double a, double b, double t) {
  double numPart, den;
  numPart = (a + b);
  den = 4 * t;
  return (numPart * numPart) / den;
}


x86 assembly (clang, -O0):
<calculatePi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xed6(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculatePi>:
addsd  %xmm1,%xmm0
mulsd  0xef4(%rip),%xmm2
mulsd  %xmm0,%xmm0
divsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @calculatePi(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%9 = load double, double* %4
%10 = load double, double* %5
%11 = fadd double %9, %10
store double %11, double* %7
%12 = load double, double* %6
%13 = fmul double 4.000000e+00, %12
store double %13, double* %8
%14 = load double, double* %7
%15 = load double, double* %7
%16 = fmul double %14, %15
%17 = load double, double* %8
%18 = fdiv double %16, %17
ret double %18
}

LLVM IR (-O2):
define double @calculatePi(double %0, double %1, double %2) {
%4 = fadd double %0, %1
%5 = fmul double %2, 4.000000e+00
%6 = fmul double %4, %4
%7 = fdiv double %6, %5
ret double %7
}
/* Type definitions */
struct timeval {
  int tv_sec;
  long long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ die(char *);
scalar_t__ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long ll_time() {
  struct timeval t;
  if (gettimeofday(&t, NULL) != 0) {
    die("Cannot get time!");
  }
  return ((t.tv_sec * 1000 * 1000) + (t.tv_usec));
}


x86 assembly (clang, -O0):
<ll_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%rax
je     114b <ll_time+0x2b>
lea    0xeba(%rip),%rdi
call   1040 <die@plt>
imul   $0x3e8,-0x10(%rbp),%eax
imul   $0x3e8,%eax,%eax
cltq
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ll_time>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
test   %rax,%rax
je     1141 <ll_time+0x21>
lea    0xec4(%rip),%rdi
call   1040 <die@plt>
imul   $0xf4240,0x8(%rsp),%eax
cltq
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
@.str = [17 x i8] c"Cannot get time!\00"
define i64 @ll_time() {
%1 = alloca %struct.timeval
%2 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @die(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %0
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, 1000
%10 = mul nsw i32 %9, 1000
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%13 = load i64, i64* %12
%14 = add nsw i64 %11, %13
ret i64 %14
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
@.str = [17 x i8] c"Cannot get time!\00"
define i64 @ll_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i64 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @die(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i32, i32* %8
%10 = mul i32 %9, 1000000
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%13 = load i64, i64* %12
%14 = add nsw i64 %13, %11
ret i64 %14
}
void ble_rsp_flash_read_data(const struct ble_msg_flash_read_data_rsp_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.ble_msg_flash_read_data_rsp_t = type opaque
define void @ble_rsp_flash_read_data(%struct.ble_msg_flash_read_data_rsp_t* nocapture %0) {
ret void
}
/* Variables and functions */
double cos(double);
int *f();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int *a = f();
  double d = cos(1.57);
  printf("a = %d\n", *a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <f@plt>
mov    %rax,-0x8(%rbp)
movsd  0xeb5(%rip),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xea6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"a = %d\0A\00"
define i32 @main() {
%1 = tail call i32* (...) @f()
%2 = load i32, i32* %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ tfprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                            char const *, char const *);
int /*<<< orphan*/ time_str(char *);
void vegas_error(const char *name, const char *msg) {
  char tbuf[64];
  tfprintf(stderr, "HPC[%s]: Error (%s): %s\n", time_str(tbuf), name, msg);
  fflush(stderr);
}


x86 assembly (clang, -O0):
<vegas_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <time_str@plt>
mov    -0x54(%rbp),%edi
mov    %eax,%edx
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe97(%rip),%rsi
call   1040 <tfprintf@plt>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vegas_error>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e99(%rip),%r15
mov    (%r15),%ebp
mov    %rsp,%rdi
call   1030 <time_str@plt>
lea    0xea7(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1040 <tfprintf@plt>
mov    (%r15),%edi
call   1050 <fflush@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"HPC[%s]: Error (%s): %s\0A\00"
define void @vegas_error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [64 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i32, i32* @stderr
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%8 = call i32 @time_str(i8* %7)
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i32 @tfprintf(i32 %6, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %9, i8* %10)
%12 = load i32, i32* @stderr
%13 = call i32 @fflush(i32 %12)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"HPC[%s]: Error (%s): %s\0A\00"
define void @vegas_error(i8* %0, i8* %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @stderr
%6 = call i32 @time_str(i8* %4)
%7 = call i32 @tfprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %0, i8* %1)
%8 = load i32, i32* @stderr
%9 = call i32 @fflush(i32 %8)
ret void
}
/* Variables and functions */
int exp(double);
double sqrt(int);
double g(double x) { return (exp(-x) * (sqrt(1 + exp(-x) * exp(-x)))); }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
mov    -0x14(%rbp),%edi
imul   %eax,%edi
add    $0x1,%edi
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %rbx
sub    $0x20,%rsp
xorps  0xed4(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
call   1030 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <exp@plt>
mov    %eax,%ebx
movapd 0x10(%rsp),%xmm0
call   1030 <exp@plt>
imul   %eax,%ebx
add    $0x1,%ebx
mov    %ebx,%edi
call   1040 <sqrt@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @g(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = call i32 @exp(double %4)
%6 = sitofp i32 %5 to double
%7 = load double, double* %2
%8 = fneg double %7
%9 = call i32 @exp(double %8)
%10 = load double, double* %2
%11 = fneg double %10
%12 = call i32 @exp(double %11)
%13 = mul nsw i32 %9, %12
%14 = add nsw i32 1, %13
%15 = call double @sqrt(i32 %14)
%16 = fmul double %6, %15
ret double %16
}

LLVM IR (-O2):
define double @g(double %0) {
%2 = fneg double %0
%3 = tail call i32 @exp(double %2)
%4 = sitofp i32 %3 to double
%5 = tail call i32 @exp(double %2)
%6 = tail call i32 @exp(double %2)
%7 = mul nsw i32 %6, %5
%8 = add nsw i32 %7, 1
%9 = tail call double @sqrt(i32 %8)
%10 = fmul double %9, %4
ret double %10
}
int quelmode(char codeascii) {
  int mode = 901;
  if ((codeascii == '\t') || (codeascii == '\n') || (codeascii == '\r') ||
      ((codeascii >= ' ') && (codeascii <= '~'))) {
    mode = 900;
  }
  if ((codeascii >= '0') && (codeascii <= '9')) {
    mode = 902;
  }
  return mode;
}


x86 assembly (clang, -O0):
<quelmode>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x385,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x9,%eax
je     1152 <quelmode+0x52>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     1152 <quelmode+0x52>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
je     1152 <quelmode+0x52>
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jl     1159 <quelmode+0x59>
movsbl -0x1(%rbp),%eax
cmp    $0x7e,%eax
jg     1159 <quelmode+0x59>
movl   $0x384,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     117a <quelmode+0x7a>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jg     117a <quelmode+0x7a>
movl   $0x386,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quelmode>:
cmp    $0xd,%dil
ja     1128 <quelmode+0x28>
movzbl %dil,%eax
mov    $0x2600,%ecx
bt     %rax,%rcx
jae    1128 <quelmode+0x28>
mov    $0x384,%ecx
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
mov    $0x386,%eax
cmovae %ecx,%eax
ret
lea    -0x20(%rdi),%eax
mov    $0x385,%ecx
cmp    $0x5e,%al
jbe    1115 <quelmode+0x15>
jmp    111a <quelmode+0x1a>

LLVM IR (-O0):
define i32 @quelmode(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 901, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 9
br i1 %6, label %23, label %7
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 10
br i1 %10, label %23, label %11
11: ; preds = %7
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 13
br i1 %14, label %23, label %15
15: ; preds = %11
%16 = load i8, i8* %2
%17 = sext i8 %16 to i32
%18 = icmp sge i32 %17, 32
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp sle i32 %21, 126
br i1 %22, label %23, label %24
23: ; preds = %19, %11, %7, %1
store i32 900, i32* %3
br label %24
24: ; preds = %23, %19, %15
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = icmp sge i32 %26, 48
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp sle i32 %30, 57
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 902, i32* %3
br label %33
33: ; preds = %32, %28, %24
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
define i32 @quelmode(i8 signext %0) {
switch i8 %0, label %2 [
i8 13, label %5
i8 10, label %5
i8 9, label %5
]
2: ; preds = %1
%3 = add i8 %0, -32
%4 = icmp ult i8 %3, 95
br i1 %4, label %5, label %6
5: ; preds = %1, %1, %1, %2
br label %6
6: ; preds = %5, %2
%7 = phi i32 [ 900, %5 ], [ 901, %2 ]
%8 = add i8 %0, -48
%9 = icmp ult i8 %8, 10
%10 = select i1 %9, i32 902, i32 %7
ret i32 %10
}
int main(void) { return 3; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 3
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int /*<<< orphan*/ do_cow_open(int /*<<< orphan*/, char const *, int);
int do_generic_open(char const *name, int flags, mode_t mode,
                    int (*open_proc)(char const *, int, ...)) {
  do_cow_open(AT_FDCWD, name, flags);
  do {
  } while (0);
  return open_proc(name, flags, mode);
}


x86 assembly (clang, -O0):
<do_generic_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <do_cow_open@plt>
jmp    1140 <do_generic_open+0x30>
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    $0x0,%al
call   *%rcx
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_generic_open>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%rbx
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <do_cow_open@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
xor    %eax,%eax
mov    %r15,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    *%rcx

LLVM IR (-O0):
@AT_FDCWD = global i32 0
define i32 @do_generic_open(i8* %0, i32 %1, i32 %2, i32 (i8*, i32, ...)* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32 (i8*, i32, ...)*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 (i8*, i32, ...)* %3, i32 (i8*, i32, ...)** %8
%9 = load i32, i32* @AT_FDCWD
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @do_cow_open(i32 %9, i8* %10, i32 %11)
br label %13
13: ; preds = %4
br label %14
14: ; preds = %13
%15 = load i32 (i8*, i32, ...)*, i32 (i8*, i32, ...)** %8
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i32 (i8*, i32, ...) %15(i8* %16, i32 %17, i32 %18)
ret i32 %19
}

LLVM IR (-O2):
@AT_FDCWD = global i32 0
define i32 @do_generic_open(i8* %0, i32 %1, i32 %2, i32 (i8*, i32, ...)* nocapture %3) {
%5 = load i32, i32* @AT_FDCWD
%6 = tail call i32 @do_cow_open(i32 %5, i8* %0, i32 %1)
%7 = tail call i32 (i8*, i32, ...) %3(i8* %0, i32 %1, i32 %2)
ret i32 %7
}
int isletdig(char c) {
  if (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) ||
      ((c >= '0') && (c <= '9'))) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isletdig>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1124 <isletdig+0x24>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jle    1158 <isletdig+0x58>
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jl     113e <isletdig+0x3e>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jle    1158 <isletdig+0x58>
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1164 <isletdig+0x64>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1164 <isletdig+0x64>
movl   $0x1,-0x4(%rbp)
jmp    116b <isletdig+0x6b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isletdig>:
mov    %edi,%eax
and    $0xdf,%al
add    $0xbf,%al
cmp    $0x1a,%al
setb   %al
add    $0xd0,%dil
cmp    $0xa,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isletdig(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %27, label %11
11: ; preds = %7, %1
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 65
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 90
br i1 %18, label %27, label %19
19: ; preds = %15, %11
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = icmp sge i32 %21, 48
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i8, i8* %3
%25 = sext i8 %24 to i32
%26 = icmp sle i32 %25, 57
br i1 %26, label %27, label %28
27: ; preds = %23, %15, %7
store i32 1, i32* %2
br label %29
28: ; preds = %23, %19
store i32 0, i32* %2
br label %29
29: ; preds = %28, %27
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @isletdig(i8 signext %0) {
%2 = and i8 %0, -33
%3 = add i8 %2, -65
%4 = icmp ult i8 %3, 26
%5 = add i8 %0, -48
%6 = icmp ult i8 %5, 10
%7 = or i1 %6, %4
%8 = zext i1 %7 to i32
ret i32 %8
}
int CHECK_MEM67(unsigned char v) { return (v & 0xfc) == 0xa0; }


x86 assembly (clang, -O0):
<CHECK_MEM67>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xfc,%eax
cmp    $0xa0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<CHECK_MEM67>:
and    $0xfc,%dil
xor    %eax,%eax
cmp    $0xa0,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @CHECK_MEM67(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = and i32 %4, 252
%6 = icmp eq i32 %5, 160
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @CHECK_MEM67(i8 zeroext %0) {
%2 = and i8 %0, -4
%3 = icmp eq i8 %2, -96
%4 = zext i1 %3 to i32
ret i32 %4
}
double maxAbs(double a, double b) { return (a * a > b * b) ? a : b; }


x86 assembly (clang, -O0):
<maxAbs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    113b <maxAbs+0x3b>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1145 <maxAbs+0x45>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxAbs>:
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
cmpltsd %xmm2,%xmm3
andpd  %xmm3,%xmm0
andnpd %xmm1,%xmm3
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @maxAbs(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = fmul double %5, %6
%8 = load double, double* %4
%9 = load double, double* %4
%10 = fmul double %8, %9
%11 = fcmp ogt double %7, %10
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = load double, double* %3
br label %16
14: ; preds = %2
%15 = load double, double* %4
br label %16
16: ; preds = %14, %12
%17 = phi double [ %13, %12 ], [ %15, %14 ]
ret double %17
}

LLVM IR (-O2):
define double @maxAbs(double %0, double %1) {
%3 = fmul double %0, %0
%4 = fmul double %1, %1
%5 = fcmp ogt double %3, %4
%6 = select i1 %5, double %0, double %1
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ f2(int);
__attribute__((no_reorder)) __attribute__((no)) int func1(void) { f2(1); }


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

x86 assembly (clang, -O2):
<func1>:
mov    $0x1,%edi
jmp    1030 <f2@plt>

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

LLVM IR (-O2):
define i32 @func1() {
%1 = tail call i32 @f2(i32 1)
ret i32 undef
}
/* Variables and functions */
int lpd(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  printf("%d\n", n - lpd(n));
  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
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <lpd@plt>
mov    -0xc(%rbp),%esi
sub    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1030 <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
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebx
mov    %ebx,%edi
call   1050 <lpd@plt>
sub    %eax,%ebx
lea    0xea9(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @lpd(i32 %4)
%6 = sub nsw i32 %4, %5
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Type definitions */
struct found_file_sys {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct found_file_sys *);
void del_found_file_sys(void *m) {
  struct found_file_sys *ffs = (struct found_file_sys *)m;
  free(ffs);
}


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

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

LLVM IR (-O0):
%struct.found_file_sys = type { i32 }
define void @del_found_file_sys(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.found_file_sys*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.found_file_sys*
store %struct.found_file_sys* %5, %struct.found_file_sys** %3
%6 = load %struct.found_file_sys*, %struct.found_file_sys** %3
%7 = call i32 @free(%struct.found_file_sys* %6)
ret void
}

LLVM IR (-O2):
%struct.found_file_sys = type { i32 }
define void @del_found_file_sys(i8* nocapture %0) {
%2 = bitcast i8* %0 to %struct.found_file_sys*
%3 = tail call i32 @free(%struct.found_file_sys* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ esc(char *);
int /*<<< orphan*/ padding(int);
void vt52cub1(void) {
  esc("D");
  padding(5);
}


x86 assembly (clang, -O0):
<vt52cub1>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <esc@plt>
mov    $0x5,%edi
call   1030 <padding@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vt52cub1>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <esc@plt>
mov    $0x5,%edi
pop    %rax
jmp    1030 <padding@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"D\00"
define void @vt52cub1() {
%1 = call i32 @esc(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @padding(i32 5)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"D\00"
define void @vt52cub1() {
%1 = tail call i32 @esc(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @padding(i32 5)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ same_screen;
};
typedef TYPE_1__ XButtonEvent;

/* Variables and functions */
int get_XButtonEvent_same_screen(void *_p) {
  return (int)((XButtonEvent *)_p)->same_screen;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XButtonEvent_same_screen(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
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XButtonEvent_same_screen(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
void _M2_IOConsts_init(__attribute__((unused)) int argc,
                       __attribute__((unused)) char *argv[]) {}


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

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

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

LLVM IR (-O2):
define void @_M2_IOConsts_init(i32 %0, i8** nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main(int32_t argc, char **argv) {
  printf("g0hl1n's AES libcrypto demo v%s\n", "1.0");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"g0hl1n's AES libcrypto demo v%s\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"g0hl1n's AES libcrypto demo v%s\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void outputConfHeader(FILE *fp) {
  fprintf(fp, "# index    area    colour    gamma    enable\n");
}


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

x86 assembly (clang, -O2):
<outputConfHeader>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"# index area colour gamma enable\0A\00"
define void @outputConfHeader(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"# index area colour gamma enable\0A\00"
define void @outputConfHeader(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i64 45, i64 1, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ ft_putendl_fd(char *, int /*<<< orphan*/);
int /*<<< orphan*/ ft_putstr_fd(char *, int /*<<< orphan*/);
void ft_error(char *error_str) {
  ft_putstr_fd("ERROR", STDERR_FILENO);
  if (error_str != NULL) {
    ft_putstr_fd(" : ", STDERR_FILENO);
    ft_putendl_fd(error_str, STDERR_FILENO);
  }
  exit(1);
}


x86 assembly (clang, -O0):
<ft_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%esi
lea    0xeb4(%rip),%rdi
call   1030 <ft_putstr_fd@plt>
cmpq   $0x0,-0x8(%rbp)
je     1183 <ft_error+0x53>
mov    0x2e7d(%rip),%rax
mov    (%rax),%esi
lea    0xe9a(%rip),%rdi
call   1030 <ft_putstr_fd@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e64(%rip),%rax
mov    (%rax),%esi
call   1050 <ft_putendl_fd@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<ft_error>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ea2(%rip),%r14
mov    (%r14),%esi
lea    0xeb8(%rip),%rdi
call   1030 <ft_putstr_fd@plt>
test   %rbx,%rbx
je     116c <ft_error+0x3c>
mov    (%r14),%esi
lea    0xeaa(%rip),%rdi
call   1030 <ft_putstr_fd@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1050 <ft_putendl_fd@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"ERROR\00"
@STDERR_FILENO = global i32 0
@.str.1 = [4 x i8] c" : \00"
define void @ft_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @STDERR_FILENO
%4 = call i32 @ft_putstr_fd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = load i32, i32* @STDERR_FILENO
%9 = call i32 @ft_putstr_fd(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %2
%11 = load i32, i32* @STDERR_FILENO
%12 = call i32 @ft_putendl_fd(i8* %10, i32 %11)
br label %13
13: ; preds = %7, %1
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [6 x i8] c"ERROR\00"
@STDERR_FILENO = global i32 0
@.str.1 = [4 x i8] c" : \00"
define void @ft_error(i8* %0) {
%2 = load i32, i32* @STDERR_FILENO
%3 = tail call i32 @ft_putstr_fd(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp eq i8* %0, null
br i1 %4, label %10, label %5
5: ; preds = %1
%6 = load i32, i32* @STDERR_FILENO
%7 = tail call i32 @ft_putstr_fd(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @STDERR_FILENO
%9 = tail call i32 @ft_putendl_fd(i8* %0, i32 %8)
br label %10
10: ; preds = %5, %1
%11 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int, int);
void cleanString(char *string) {
  memset(string, 0x00, 500);
  return;
}


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

x86 assembly (clang, -O2):
<cleanString>:
xor    %esi,%esi
mov    $0x1f4,%edx
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @cleanString(i8* %0) {
%2 = tail call i32 @memset(i8* %0, i32 0, i32 500)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void endrun(int num) {
  printf("error code: %d!\n", num);
  exit(0);
}


x86 assembly (clang, -O0):
<endrun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<endrun>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"error code: %d!\0A\00"
define void @endrun(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [17 x i8] c"error code: %d!\0A\00"
define void @endrun(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hello\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int funk() {
  int hjemvegen123 = 1;
  return hjemvegen123;
}


x86 assembly (clang, -O0):
<funk>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @funk() {
ret i32 1
}