xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, void const *, int);
int /*<<< orphan*/ salsa_k32(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *);
void salsa20_genBlock256(void *dest, const void *k, const void *iv,
                         uint64_t i) {
  uint32_t n[4];
  memcpy(n, iv, 8);
  salsa_k32((uint32_t *)dest, (uint32_t *)k, n);
}


x86 assembly (clang, -O0):
<salsa20_genBlock256>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1040 <salsa_k32@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<salsa20_genBlock256>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <salsa_k32@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @salsa20_genBlock256(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca [4 x i32]
%6 = bitcast [4 x i32]* %5 to i8*
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %5, i64 0, i64 0
%8 = call i32 @memcpy(i32* %7, i8* %2, i32 8)
%9 = bitcast i8* %0 to i32*
%10 = bitcast i8* %1 to i32*
%11 = call i32 @salsa_k32(i32* %9, i32* %10, i32* %7)
ret void
}
/* Variables and functions */
double getTime();
void Spin(int timeinsecs) {
  double t = getTime();
  while ((getTime() - t) < timeinsecs)
    ;
}


x86 assembly (clang, -O0):
<Spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getTime@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getTime@plt>
movaps %xmm0,%xmm1
subsd  -0x10(%rbp),%xmm1
cvtsi2sdl -0x4(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    114a <Spin+0x3a>
jmp    1127 <Spin+0x17>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Spin>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <getTime@plt>
movsd  %xmm0,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <getTime@plt>
subsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
ucomisd %xmm0,%xmm1
ja     1130 <Spin+0x20>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @Spin(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = call double (...) @getTime()
store double %4, double* %3
br label %5
5: ; preds = %12, %1
%6 = call double (...) @getTime()
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = fcmp olt double %8, %10
br i1 %11, label %12, label %13
12: ; preds = %5
br label %5
13: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @Spin(i32 %0) {
%2 = tail call double (...) @getTime()
%3 = sitofp i32 %0 to double
br label %4
4: ; preds = %4, %1
%5 = tail call double (...) @getTime()
%6 = fsub double %5, %2
%7 = fcmp olt double %6, %3
br i1 %7, label %4, label %8
8: ; preds = %4
ret void
}
/* Variables and functions */
double const RAND_MAX;
double const rand();
double randRange(const double min, const double max) {
  if (min > max)
    return randRange(max, min);
  return rand() * (max - min) / RAND_MAX + min;
}


x86 assembly (clang, -O0):
<randRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    115b <randRange+0x3b>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <randRange@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1185 <randRange+0x65>
mov    $0x0,%al
call   1040 <rand@plt>
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2e71(%rip),%rax
divsd  (%rax),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randRange>:
movapd %xmm1,%xmm2
movapd %xmm0,%xmm1
ucomisd %xmm2,%xmm0
movapd %xmm2,%xmm0
ja     1110 <randRange>
sub    $0x18,%rsp
xor    %eax,%eax
movsd  %xmm1,0x10(%rsp)
movsd  %xmm2,0x8(%rsp)
call   1030 <rand@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@RAND_MAX = constant double 0.000000e+00
define double @randRange(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load double, double* %5
%11 = load double, double* %4
%12 = call double @randRange(double %10, double %11)
store double %12, double* %3
br label %23
13: ; preds = %2
%14 = call double (...) @rand()
%15 = load double, double* %5
%16 = load double, double* %4
%17 = fsub double %15, %16
%18 = fmul double %14, %17
%19 = load double, double* @RAND_MAX
%20 = fdiv double %18, %19
%21 = load double, double* %4
%22 = fadd double %20, %21
store double %22, double* %3
br label %23
23: ; preds = %13, %9
%24 = load double, double* %3
ret double %24
}

LLVM IR (-O2):
@RAND_MAX = constant double 0.000000e+00
define double @randRange(double %0, double %1) {
br label %3
3: ; preds = %3, %2
%4 = phi double [ %0, %2 ], [ %5, %3 ]
%5 = phi double [ %1, %2 ], [ %4, %3 ]
%6 = fcmp ogt double %4, %5
br i1 %6, label %3, label %7
7: ; preds = %3
%8 = tail call double (...) @rand()
%9 = fsub double %5, %4
%10 = fmul double %9, %8
%11 = fdiv double %10, 0.000000e+00
%12 = fadd double %4, %11
ret double %12
}
/* Variables and functions */
char *aeron_driver_tool_usage();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ stderr;
void aeron_driver_tool_print_error_and_usage(const char *message) {
  fprintf(stderr, "%s\n%s", message, aeron_driver_tool_usage());
}


x86 assembly (clang, -O0):
<aeron_driver_tool_print_error_and_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <aeron_driver_tool_usage@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aeron_driver_tool_print_error_and_usage>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb3(%rip),%rax
mov    (%rax),%ebp
xor    %eax,%eax
call   1030 <aeron_driver_tool_usage@plt>
lea    0xec3(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"%s\0A%s\00"
define void @aeron_driver_tool_print_error_and_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i8* (...) @aeron_driver_tool_usage()
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %3)
ret void
}
/* Variables and functions */
float csv_get_float(int /*<<< orphan*/);
int /*<<< orphan*/ field_start(char *, int);
float csvfloat(char *line, int f) {
  return csv_get_float(field_start(line, f));
}


x86 assembly (clang, -O0):
<csvfloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <field_start@plt>
mov    %eax,%edi
call   1040 <csv_get_float@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csvfloat>:
push   %rax
call   1030 <field_start@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <csv_get_float@plt>

LLVM IR (-O0):
define float @csvfloat(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @field_start(i8* %5, i32 %6)
%8 = call float @csv_get_float(i32 %7)
ret float %8
}

LLVM IR (-O2):
define float @csvfloat(i8* %0, i32 %1) {
%3 = tail call i32 @field_start(i8* %0, i32 %1)
%4 = tail call float @csv_get_float(i32 %3)
ret float %4
}
void poly2_(n, parray) int *n;
float parray[][2];
{ poly2((long)*n, parray); }


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

x86 assembly (clang, -O2):
<poly2_>:
movslq (%rdi),%rdi
xor    %eax,%eax
jmp    1030 <poly2@plt>

LLVM IR (-O0):
define void @poly2_(i32* %0, [2 x float]* %1) {
%3 = alloca i32*
%4 = alloca [2 x float]*
store i32* %0, i32** %3
store [2 x float]* %1, [2 x float]** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = sext i32 %6 to i64
%8 = load [2 x float]*, [2 x float]** %4
%9 = call i32 (i64, [2 x float]*, ...) bitcast (i32 (...)* @poly2 to i32 (i64, [2 x float]*, ...)*)(i64 %7, [2 x float]* %8)
ret void
}

LLVM IR (-O2):
define void @poly2_(i32* nocapture %0, [2 x float]* %1) {
%3 = load i32, i32* %0
%4 = sext i32 %3 to i64
%5 = tail call i32 (i64, [2 x float]*, ...) bitcast (i32 (...)* @poly2 to i32 (i64, [2 x float]*, ...)*)(i64 %4, [2 x float]* %1)
ret void
}
/* Type definitions */
typedef int u_int8_t;
typedef int u_int32_t;

/* Variables and functions */
u_int32_t tlv_get_header_len(u_int8_t *buf) {
  u_int32_t len = 0;
  if (buf[1] & 0x80)
    len = 1 + (buf[1] & 0x7f);
  else
    len = 2;
  return len;
}


x86 assembly (clang, -O0):
<tlv_get_header_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1139 <tlv_get_header_len+0x39>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
and    $0x7f,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1140 <tlv_get_header_len+0x40>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tlv_get_header_len>:
mov    0x4(%rdi),%eax
mov    %eax,%ecx
and    $0x7f,%ecx
add    $0x1,%ecx
test   $0x80,%al
mov    $0x2,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @tlv_get_header_len(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 1
%6 = load i32, i32* %5
%7 = and i32 %6, 128
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 1
%12 = load i32, i32* %11
%13 = and i32 %12, 127
%14 = add nsw i32 1, %13
store i32 %14, i32* %3
br label %16
15: ; preds = %1
store i32 2, i32* %3
br label %16
16: ; preds = %15, %9
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @tlv_get_header_len(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = and i32 %3, 128
%5 = icmp eq i32 %4, 0
%6 = and i32 %3, 127
%7 = add nuw nsw i32 %6, 1
%8 = select i1 %5, i32 2, i32 %7
ret i32 %8
}
short test_70_2(short *mem) { return __atomic_fetch_xor(mem + 4, -1, 4); }


x86 assembly (clang, -O0):
<test_70_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
movw   $0xffff,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    %cx,-0x10(%rbp)
mov    0x8(%rax),%ax
mov    %ax,-0xe(%rbp)
mov    -0xe(%rbp),%ax
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%dx
mov    %dx,%si
mov    %ax,%dx
mov    %edx,-0x24(%rbp)
xor    %esi,%edx
mov    %edx,-0x20(%rbp)
lock cmpxchg %dx,(%rcx)
sete   %cl
mov    %ax,-0x1a(%rbp)
test   $0x1,%cl
mov    %ax,-0xe(%rbp)
jne    1165 <test_70_2+0x65>
jmp    112d <test_70_2+0x2d>
mov    -0x1a(%rbp),%ax
mov    %ax,-0xc(%rbp)
movswl -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_70_2>:
movzwl 0x8(%rdi),%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %eax,%ecx
not    %ecx
lock cmpxchg %cx,0x8(%rdi)
jne    1110 <test_70_2+0x10>
ret

LLVM IR (-O0):
define signext i16 @test_70_2(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
%4 = alloca i16
store i16* %0, i16** %2
%5 = load i16*, i16** %2
%6 = getelementptr inbounds i16, i16* %5, i64 4
store i16 -1, i16* %3
%7 = load i16, i16* %3
%8 = atomicrmw xor i16* %6, i16 %7 acq_rel
store i16 %8, i16* %4
%9 = load i16, i16* %4
ret i16 %9
}

LLVM IR (-O2):
define signext i16 @test_70_2(i16* nocapture %0) {
%2 = getelementptr inbounds i16, i16* %0, i64 4
%3 = atomicrmw xor i16* %2, i16 -1 acq_rel
ret i16 %3
}
_Bool __atomic_compare_exchange_4(volatile void *atom, void *ref,
                                  unsigned int xchg, _Bool weak,
                                  int success_memorder, int failure_memorder) {
  unsigned int rv;
  unsigned int cmp = *(unsigned int *)ref;
  asm volatile("lock cmpxchg"
               "l"
               " %2,%1\n"
               : "=a"(rv), "+m"(*(unsigned int *)atom)
               : "q"(xchg), "0"(cmp)
               : "memory");
  *(unsigned int *)ref = rv;
  return (rv == cmp);
}


x86 assembly (clang, -O0):
<__atomic_compare_exchange_4>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
and    $0x1,%al
mov    %al,-0x15(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%eax
lock cmpxchg %edx,(%rcx)
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__atomic_compare_exchange_4>:
mov    (%rsi),%ecx
mov    %ecx,%eax
lock cmpxchg %edx,(%rdi)
mov    %eax,(%rsi)
cmp    %ecx,%eax
sete   %al
ret

LLVM IR (-O0):
define zeroext i1 @__atomic_compare_exchange_4(i8* %0, i8* %1, i32 %2, i1 zeroext %3, i32 %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i32 %2, i32* %9
%15 = zext i1 %3 to i8
store i8 %15, i8* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%16 = load i8*, i8** %8
%17 = bitcast i8* %16 to i32*
%18 = load i32, i32* %17
store i32 %18, i32* %14
%19 = load i8*, i8** %7
%20 = bitcast i8* %19 to i32*
%21 = load i32, i32* %9
%22 = load i32, i32* %14
%23 = call i32 asm sideeffect "lock cmpxchgl $2,$1\0A", "={ax},=*m,q,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %20, i32 %21, i32 %22, i32* elementtype(i32) %20)
store i32 %23, i32* %13
%24 = load i32, i32* %13
%25 = load i8*, i8** %8
%26 = bitcast i8* %25 to i32*
store i32 %24, i32* %26
%27 = load i32, i32* %13
%28 = load i32, i32* %14
%29 = icmp eq i32 %27, %28
ret i1 %29
}

LLVM IR (-O2):
define zeroext i1 @__atomic_compare_exchange_4(i8* %0, i8* nocapture %1, i32 %2, i1 zeroext %3, i32 %4, i32 %5) {
%7 = bitcast i8* %1 to i32*
%8 = load i32, i32* %7
%9 = bitcast i8* %0 to i32*
%10 = tail call i32 asm sideeffect "lock cmpxchgl $2,$1\0A", "={ax},=*m,q,0,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %9, i32 %2, i32 %8, i32* elementtype(i32) %9)
store i32 %10, i32* %7
%11 = icmp eq i32 %10, %8
ret i1 %11
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, int, int, char const *);
char *strerror(int);
void handle_error_myerrno(int return_code, int myerrno, char *msg) {
  const char *error_str = strerror(myerrno);
  printf("%s return_code=%d\nerrno=%d\nmessage=%s\n", msg, return_code, myerrno,
         error_str);
  exit(1);
}


x86 assembly (clang, -O0):
<handle_error_myerrno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <strerror@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<handle_error_myerrno>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
mov    %esi,%edi
call   1050 <strerror@plt>
lea    0xeb7(%rip),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
mov    %rax,%r8
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"%s return_code=%d\0Aerrno=%d\0Amessage=%s\0A\00"
define void @handle_error_myerrno(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%8 = load i32, i32* %5
%9 = call i8* @strerror(i32 %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %6
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = load i8*, i8** %7
%14 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i32 %12, i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [39 x i8] c"%s return_code=%d\0Aerrno=%d\0Amessage=%s\0A\00"
define void @handle_error_myerrno(i32 %0, i32 %1, i8* %2) {
%4 = tail call i8* @strerror(i32 %1)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %2, i32 %0, i32 %1, i8* %4)
%6 = tail call i32 @exit(i32 1)
unreachable
}
unsigned long query_drivemap(void) { return 1L << 2; }


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

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

LLVM IR (-O0):
define i64 @query_drivemap() {
ret i64 4
}

LLVM IR (-O2):
define i64 @query_drivemap() {
ret i64 4
}
/* Variables and functions */
int is_power_of_two(size_t x) { return (x & (x - 1)) == 0; }


x86 assembly (clang, -O0):
<is_power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_power_of_two>:
lea    -0x1(%rdi),%rcx
xor    %eax,%eax
test   %rcx,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_power_of_two(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = sub i64 %4, 1
%6 = and i64 %3, %5
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @is_power_of_two(i64 %0) {
%2 = tail call i64 @llvm.ctpop.i64(i64 %0)
%3 = icmp ult i64 %2, 2
%4 = zext i1 %3 to i32
ret i32 %4
}
void whole2(void) {}


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

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

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

LLVM IR (-O2):
define void @whole2() {
ret void
}
unsigned long long gg(unsigned long long a) {
  return a & 0xfffffffffffff000ull;
}


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

x86 assembly (clang, -O2):
<gg>:
mov    %rdi,%rax
and    $0xfffffffffffff000,%rax
ret

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

LLVM IR (-O2):
define i64 @gg(i64 %0) {
%2 = and i64 %0, -4096
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void USART3_IRQHandler() { default_handler(); }


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

x86 assembly (clang, -O2):
<USART3_IRQHandler>:
xor    %eax,%eax
jmp    1030 <default_handler@plt>

LLVM IR (-O0):
define weak void @USART3_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @USART3_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ InitTasks();
int /*<<< orphan*/ InitVars();
void InitSystem() {
  InitVars();
  InitTasks();
}


x86 assembly (clang, -O0):
<InitSystem>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <InitVars@plt>
mov    $0x0,%al
call   1030 <InitTasks@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @InitSystem() {
%1 = call i32 (...) @InitVars()
%2 = call i32 (...) @InitTasks()
ret void
}

LLVM IR (-O2):
define void @InitSystem() {
%1 = tail call i32 (...) @InitVars()
%2 = tail call i32 (...) @InitTasks()
ret void
}
void fe(int *y) {
  char x;
  asm(""
      : "=@cc"
        "e"(x));
  if (!x)
    *y = 0;
}


x86 assembly (clang, -O0):
<fe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
cmpb   $0x0,-0x9(%rbp)
jne    1122 <fe+0x22>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<fe>:
jne    1103 <fe+0x3>
ret
movl   $0x0,(%rdi)
ret

LLVM IR (-O0):
define void @fe(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
%4 = call i8 asm "", "={@cce},~{dirflag},~{fpsr},~{flags}"()
store i8 %4, i8* %3
%5 = load i8, i8* %3
%6 = icmp ne i8 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = load i32*, i32** %2
store i32 0, i32* %8
br label %9
9: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @fe(i32* nocapture writeonly %0) {
%2 = tail call i8 asm "", "={@cce},~{dirflag},~{fpsr},~{flags}"()
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %1
store i32 0, i32* %0
br label %5
5: ; preds = %4, %1
ret void
}
void register_pmu_cal_sys_ops(const struct pmu_cal_sys_ops **ops) {}


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

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

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

LLVM IR (-O2):
%struct.pmu_cal_sys_ops = type opaque
define void @register_pmu_cal_sys_ops(%struct.pmu_cal_sys_ops** nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ solve();
int main(void) {
  solve();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @solve()
ret i32 0
}
int startswith(char *str, char *prefix) {
  char *s = str;
  char *p = prefix;
  for (; *p; s++, p++)
    if (*s != *p)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<startswith>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     116d <startswith+0x6d>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
mov    -0x28(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     114b <startswith+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1174 <startswith+0x74>
jmp    1150 <startswith+0x50>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    111c <startswith+0x1c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<startswith>:
mov    (%rsi),%cl
mov    $0x1,%eax
test   %cl,%cl
je     1122 <startswith+0x22>
xor    %edx,%edx
nopl   (%rax)
cmp    %cl,(%rdi,%rdx,1)
jne    1123 <startswith+0x23>
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <startswith+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @startswith(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, %6
br i1 %10, label %11, label %16
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %5, %11, %2
%17 = phi i32 [ 1, %2 ], [ 1, %11 ], [ 0, %5 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ ex4();
int main() { ex4(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @ex4()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main() {
  char vector[] = {37, 73, 77};
  char *ptr_i = vector;
  printf("%d\n", *ptr_i);
  ptr_i += 1;
  printf("%d\n", *ptr_i);
  ptr_i += 1;
  printf("%d\n", *ptr_i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee1(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xed9(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0x3(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xec4(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xea5(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    0xe86(%rip),%rdi
movsbl (%rax),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0x25,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x49,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x4d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 37)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 73)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 77)
ret i32 0
}
void irq_enable(void) { __asm__ volatile("sti"); }


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

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

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

LLVM IR (-O2):
define void @irq_enable() {
tail call void asm sideeffect "sti", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
void *thread_proc(void *arg) {
  sleep(2);
  exit(0);
  return NULL;
}


x86 assembly (clang, -O0):
<thread_proc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2,%edi
call   1040 <sleep@plt>
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<thread_proc>:
push   %rax
mov    $0x2,%edi
call   1040 <sleep@plt>
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i8* @thread_proc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @sleep(i32 2)
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define noalias i8* @thread_proc(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 2)
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
long foo_int(int);
void foo_int_loop(long *x, int *y, int N) {
  for (int i = 0; i < N; ++i) {
    x[i] = foo_int(y[i]);
  }
}


x86 assembly (clang, -O0):
<foo_int_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1163 <foo_int_loop+0x53>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1030 <foo_int@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <foo_int_loop+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_int_loop>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %edx,%edx
jle    1146 <foo_int_loop+0x36>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edi
call   1030 <foo_int@plt>
mov    %rax,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <foo_int_loop+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @foo_int_loop(i64* %0, i32* %1, i32 %2) {
%4 = alloca i64*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store i64* %0, i64** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %23, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i32*, i32** %5
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32, i32* %13, i64 %15
%17 = load i32, i32* %16
%18 = call i64 @foo_int(i32 %17)
%19 = load i64*, i64** %4
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i64, i64* %19, i64 %21
store i64 %18, i64* %22
br label %23
23: ; preds = %12
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
store i32 %25, i32* %7
br label %8
26: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @foo_int_loop(i64* nocapture writeonly %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %8
7: ; preds = %8, %3
ret void
8: ; preds = %5, %8
%9 = phi i64 [ 0, %5 ], [ %14, %8 ]
%10 = getelementptr inbounds i32, i32* %1, i64 %9
%11 = load i32, i32* %10
%12 = tail call i64 @foo_int(i32 %11)
%13 = getelementptr inbounds i64, i64* %0, i64 %9
store i64 %12, i64* %13
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %7, label %8
}
/* Variables and functions */
int /*<<< orphan*/ dummy_function2();
void dummy_function3(void) { dummy_function2(); }


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

x86 assembly (clang, -O2):
<dummy_function3>:
xor    %eax,%eax
jmp    1030 <dummy_function2@plt>

LLVM IR (-O0):
define void @dummy_function3() {
%1 = call i32 (...) @dummy_function2()
ret void
}

LLVM IR (-O2):
define void @dummy_function3() {
%1 = tail call i32 (...) @dummy_function2()
ret void
}
/* Variables and functions */
float max(float, float);
float max3(float x, float y, float z) { return max(x, max(y, z)); }


x86 assembly (clang, -O0):
<max3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1030 <max@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
call   1030 <max@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<max3>:
push   %rax
movss  %xmm0,0x4(%rsp)
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1030 <max@plt>
movaps %xmm0,%xmm1
movss  0x4(%rsp),%xmm0
pop    %rax
jmp    1030 <max@plt>

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

LLVM IR (-O2):
define float @max3(float %0, float %1, float %2) {
%4 = tail call float @max(float %1, float %2)
%5 = tail call float @max(float %0, float %4)
ret float %5
}
/* Variables and functions */
scalar_t__ drwav__is_little_endian();
__attribute__((always_)) unsigned short
drwav__bytes_to_u16(const unsigned char *data) {
  if (drwav__is_little_endian()) {
    return (data[0] << 0) | (data[1] << 8);
  } else {
    return (data[1] << 0) | (data[0] << 8);
  }
}


x86 assembly (clang, -O0):
<drwav__bytes_to_u16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <drwav__is_little_endian@plt>
cmp    $0x0,%rax
je     114d <drwav__bytes_to_u16+0x3d>
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
shl    $0x0,%eax
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %ax,-0x2(%rbp)
jmp    1168 <drwav__bytes_to_u16+0x58>
mov    -0x10(%rbp),%rax
movzbl 0x1(%rax),%eax
shl    $0x0,%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drwav__bytes_to_u16>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <drwav__is_little_endian@plt>
xor    %ecx,%ecx
xor    %edx,%edx
test   %rax,%rax
sete   %cl
setne  %dl
movzbl (%rbx,%rcx,1),%ecx
movzbl (%rbx,%rdx,1),%eax
shl    $0x8,%eax
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i16 @drwav__bytes_to_u16(i8* %0) {
%2 = alloca i16
%3 = alloca i8*
store i8* %0, i8** %3
%4 = call i64 (...) @drwav__is_little_endian()
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %19
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = shl i32 %10, 0
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 8
%17 = or i32 %11, %16
%18 = trunc i32 %17 to i16
store i16 %18, i16* %2
br label %32
19: ; preds = %1
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = shl i32 %23, 0
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = zext i8 %27 to i32
%29 = shl i32 %28, 8
%30 = or i32 %24, %29
%31 = trunc i32 %30 to i16
store i16 %31, i16* %2
br label %32
32: ; preds = %19, %6
%33 = load i16, i16* %2
ret i16 %33
}

LLVM IR (-O2):
define zeroext i16 @drwav__bytes_to_u16(i8* nocapture %0) {
%2 = tail call i64 (...) @drwav__is_little_endian()
%3 = icmp eq i64 %2, 0
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = select i1 %3, i8* %0, i8* %4
%6 = select i1 %3, i8* %4, i8* %0
%7 = load i8, i8* %6
%8 = zext i8 %7 to i16
%9 = load i8, i8* %5
%10 = zext i8 %9 to i16
%11 = shl nuw i16 %10, 8
%12 = or i16 %11, %8
ret i16 %12
}
void RTFileExists(void) {}


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

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

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

LLVM IR (-O2):
define void @RTFileExists() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t abs8(int8_t i) {
  if (i < 0)
    i = -i;
  return i;
}


x86 assembly (clang, -O0):
<abs8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1119 <abs8+0x19>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs8>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @abs8(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int isChinese(int character) {
  if (character > 0x4E00 && character < 0x9FA6) {
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<isChinese>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x4e00,-0x8(%rbp)
jle    112d <isChinese+0x2d>
cmpl   $0x9fa6,-0x8(%rbp)
jge    112d <isChinese+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    1134 <isChinese+0x34>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isChinese>:
add    $0xffff605a,%edi
cmp    $0xffffae5b,%edi
sbb    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @isChinese(i32 %0) {
%2 = add i32 %0, -40870
%3 = icmp ult i32 %2, -20901
%4 = sext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int sum(int x, int y) {
  printf("summing: %i+%i\n", x, y);
  return x + y;
}


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

x86 assembly (clang, -O2):
<sum>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xee2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"summing: %i+%i\0A\00"
define i32 @sum(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = add nsw i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
@.str = [16 x i8] c"summing: %i+%i\0A\00"
define i32 @sum(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = add nsw i32 %1, %0
ret i32 %4
}
/* Variables and functions */
char *redhttp_strndup(char const *, size_t);
size_t strlen(char const *);
char *redhttp_strdup(const char *str1) {
  char *str2 = NULL;
  if (str1) {
    size_t str1_len = strlen(str1);
    str2 = redhttp_strndup(str1, str1_len);
  }
  return str2;
}


x86 assembly (clang, -O0):
<redhttp_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115d <redhttp_strdup+0x3d>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <redhttp_strndup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<redhttp_strdup>:
test   %rdi,%rdi
je     113a <redhttp_strdup+0x1a>
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <redhttp_strndup@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @redhttp_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = tail call i8* @redhttp_strndup(i8* %0, i64 %4)
br label %6
6: ; preds = %3, %1
%7 = phi i8* [ %5, %3 ], [ null, %1 ]
ret i8* %7
}
char *assert_fail() {
  do {
    if (!(0 == 1))
      return "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/"
             "tests/test_json.c"
             ":"
             "31"
             ": "
             "0 == 1";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<assert_fail>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_fail>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_json.c:31: 0 == 1\00"
define i8* @assert_fail() {
%1 = alloca i8*
br label %2
2: ; preds = %0
store i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0), i8** %1
br label %4
3: ; No predecessors!
store i8* null, i8** %1
br label %4
4: ; preds = %3, %2
%5 = load i8*, i8** %1
ret i8* %5
}

LLVM IR (-O2):
@.str = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_json.c:31: 0 == 1\00"
define i8* @assert_fail() {
ret i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ allocate();
int /*<<< orphan*/ read_options(int, char **);
int /*<<< orphan*/ start_threads();
int /*<<< orphan*/ write_pattern();
int main(int argc, char *argv[]) {
  read_options(argc, argv);
  allocate();
  write_pattern();
  start_threads();
  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)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <read_options@plt>
mov    $0x0,%al
call   1060 <allocate@plt>
mov    $0x0,%al
call   1040 <write_pattern@plt>
mov    $0x0,%al
call   1050 <start_threads@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <read_options@plt>
xor    %eax,%eax
call   1060 <allocate@plt>
xor    %eax,%eax
call   1040 <write_pattern@plt>
xor    %eax,%eax
call   1050 <start_threads@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @read_options(i32 %6, i8** %7)
%9 = call i32 (...) @allocate()
%10 = call i32 (...) @write_pattern()
%11 = call i32 (...) @start_threads()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @read_options(i32 %0, i8** %1)
%4 = tail call i32 (...) @allocate()
%5 = tail call i32 (...) @write_pattern()
%6 = tail call i32 (...) @start_threads()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo(unsigned short);
__attribute__((no, noclone)) unsigned short f3(unsigned short x,
                                               unsigned short y) {
  unsigned short r = x - y;
  if (x <= r)
    foo(r);
  return r;
}


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x4(%rbp),%ecx
sub    %ecx,%eax
mov    %ax,-0x6(%rbp)
movzwl -0x2(%rbp),%eax
movzwl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jg     114d <f3+0x3d>
movzwl -0x6(%rbp),%edi
call   1030 <foo@plt>
movzwl -0x6(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
push   %rbx
mov    %edi,%ebx
sub    %esi,%ebx
cmp    %di,%bx
jb     1122 <f3+0x12>
movzwl %bx,%edi
call   1030 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i16 @f3(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%6 = load i16, i16* %3
%7 = zext i16 %6 to i32
%8 = load i16, i16* %4
%9 = zext i16 %8 to i32
%10 = sub nsw i32 %7, %9
%11 = trunc i32 %10 to i16
store i16 %11, i16* %5
%12 = load i16, i16* %3
%13 = zext i16 %12 to i32
%14 = load i16, i16* %5
%15 = zext i16 %14 to i32
%16 = icmp sle i32 %13, %15
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i16, i16* %5
%19 = call i32 @foo(i16 zeroext %18)
br label %20
20: ; preds = %17, %2
%21 = load i16, i16* %5
ret i16 %21
}

LLVM IR (-O2):
define zeroext i16 @f3(i16 zeroext %0, i16 zeroext %1) {
%3 = sub i16 %0, %1
%4 = icmp ult i16 %3, %0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @foo(i16 zeroext %3)
br label %7
7: ; preds = %5, %2
ret i16 %3
}