xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ TransformAlarmC__0__AlarmFrom__fired();
void AtmegaCompareP__0__Alarm__fired(void) {
  TransformAlarmC__0__AlarmFrom__fired();
}


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

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

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

LLVM IR (-O2):
define void @AtmegaCompareP__0__Alarm__fired() {
%1 = tail call i32 (...) @TransformAlarmC__0__AlarmFrom__fired()
ret void
}
/* Variables and functions */
int inb(int);
int /*<<< orphan*/ outb(int, char);
void putDebugChar(int c) {
  while (inb(0x3F8 + 5) & 0x20)
    ;
  outb(0x3F8, (char)c);
}


x86 assembly (clang, -O0):
<putDebugChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x3fd,%edi
call   1040 <inb@plt>
and    $0x20,%eax
cmp    $0x0,%eax
je     1146 <putDebugChar+0x26>
jmp    112b <putDebugChar+0xb>
mov    -0x4(%rbp),%eax
mov    $0x3f8,%edi
movsbl %al,%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putDebugChar>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x3fd,%edi
call   1040 <inb@plt>
test   $0x20,%al
jne    1130 <putDebugChar+0x10>
movsbl %bl,%esi
mov    $0x3f8,%edi
pop    %rbx
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @putDebugChar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = call i32 @inb(i32 1021)
%5 = and i32 %4, 32
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load i32, i32* %2
%10 = trunc i32 %9 to i8
%11 = call i32 @outb(i32 1016, i8 signext %10)
ret void
}

LLVM IR (-O2):
define void @putDebugChar(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @inb(i32 1021)
%4 = and i32 %3, 32
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = trunc i32 %0 to i8
%8 = tail call i32 @outb(i32 1016, i8 signext %7)
ret void
}
/* Variables and functions */
int safer_strncat(char *, size_t, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
bool strcat_s(char *dest, size_t destsz, const char *src) {
  return (src != NULL) ? safer_strncat(dest, destsz, src, strlen(src)) : false;
}


x86 assembly (clang, -O0):
<strcat_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     117b <strcat_s+0x5b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
call   1040 <safer_strncat@plt>
mov    %eax,-0x1c(%rbp)
jmp    1185 <strcat_s+0x65>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1185 <strcat_s+0x65>
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat_s>:
test   %rdx,%rdx
je     1150 <strcat_s+0x30>
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <safer_strncat@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @strcat_s(i8* %0, i64 %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @strlen(i8* %2)
%7 = tail call i32 @safer_strncat(i8* %0, i64 %1, i8* %2, i32 %6)
br label %8
8: ; preds = %3, %5
%9 = phi i32 [ %7, %5 ], [ 0, %3 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *progname) {
  fprintf(stderr,
          "%s [-p port] [-l logfile]\n"
          "\t -p port    - specifies port to bind to\n"
          "\t -l logfile - logs SMTP transaction to specified file\n",
          progname);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [123 x i8] c"%s [-p port] [-l logfile]\0A\09 -p port - specifies port to bind to\0A\09 -l logfile - logs SMTP transaction to specified file\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([123 x i8], [123 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [123 x i8] c"%s [-p port] [-l logfile]\0A\09 -p port - specifies port to bind to\0A\09 -l logfile - logs SMTP transaction to specified file\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([123 x i8], [123 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int _func_xpath_funcs(char *, void *, int, char *);
int _func_xpath_lname(char *chunk, void *data) {
  return _func_xpath_funcs(chunk, data, 12, "local-name()");
}


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

x86 assembly (clang, -O2):
<_func_xpath_lname>:
lea    0xee9(%rip),%rcx
mov    $0xc,%edx
jmp    1030 <_func_xpath_funcs@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"local-name()\00"
define i32 @_func_xpath_lname(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @_func_xpath_funcs(i8* %5, i8* %6, i32 12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 %7
}

LLVM IR (-O2):
@.str = [13 x i8] c"local-name()\00"
define i32 @_func_xpath_lname(i8* %0, i8* %1) {
%3 = tail call i32 @_func_xpath_funcs(i8* %0, i8* %1, i32 12, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
unsigned long get_ds(void) { return ((5)); }


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

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

LLVM IR (-O0):
define i64 @get_ds() {
ret i64 5
}

LLVM IR (-O2):
define i64 @get_ds() {
ret i64 5
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char const *, char const *,
                           char const *, int);
int /*<<< orphan*/ stderr;
void _assertfail(const char *msg, const char *cond, const char *file,
                 int line) {
  fprintf(stderr, msg, cond, file, line);
  abort();
}


x86 assembly (clang, -O0):
<_assertfail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_assertfail>:
push   %rax
mov    %ecx,%r8d
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @_assertfail(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i32, i32* %8
%14 = call i32 @fprintf(i32 %9, i8* %10, i8* %11, i8* %12, i32 %13)
%15 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
define void @_assertfail(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* %0, i8* %1, i8* %2, i32 %3)
%7 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;
typedef scalar_t__ wctype_t;

/* Variables and functions */
int wctype_table_lookup(char const *, int /*<<< orphan*/);
int __iswctype(wint_t wc, wctype_t desc) {
  if (desc == (wctype_t)0)
    return 0;
  return wctype_table_lookup((const char *)desc, wc);
}


x86 assembly (clang, -O0):
<__iswctype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1136 <__iswctype+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1145 <__iswctype+0x35>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <wctype_table_lookup@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__iswctype>:
test   %rsi,%rsi
je     1121 <__iswctype+0x11>
mov    %edi,%eax
mov    %rsi,%rdi
mov    %eax,%esi
jmp    1030 <wctype_table_lookup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @__iswctype(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 %0, i32* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %14
9: ; preds = %2
%10 = load i64, i64* %5
%11 = inttoptr i64 %10 to i8*
%12 = load i32, i32* %4
%13 = call i32 @wctype_table_lookup(i8* %11, i32 %12)
store i32 %13, i32* %3
br label %14
14: ; preds = %9, %8
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @__iswctype(i32 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = inttoptr i64 %1 to i8*
%6 = tail call i32 @wctype_table_lookup(i8* %5, i32 %0)
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ %6, %4 ], [ 0, %2 ]
ret i32 %8
}
int glwin_handle_events(void *voidhandle) { return 0; }


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

x86 assembly (clang, -O2):
<glwin_handle_events>:
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @glwin_handle_events(i8* nocapture readnone %0) {
ret i32 0
}
float LerpAngle(float a2, float a1, float frac) {
  if (a1 - a2 > 180) {
    a1 -= 360;
  }
  if (a1 - a2 < -180) {
    a1 += 360;
  }
  return a2 + frac * (a1 - a2);
}


x86 assembly (clang, -O0):
<LerpAngle>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  0xedb(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1144 <LerpAngle+0x44>
movss  -0x8(%rbp),%xmm0
movss  0xec9(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
movss  0xeb2(%rip),%xmm0
ucomiss %xmm1,%xmm0
jbe    1171 <LerpAngle+0x71>
movss  0xe9d(%rip),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<LerpAngle>:
movaps %xmm1,%xmm3
subss  %xmm0,%xmm3
movss  0xef1(%rip),%xmm4
addss  %xmm1,%xmm4
movss  0xee9(%rip),%xmm5
cmpltss %xmm3,%xmm5
andps  %xmm5,%xmm4
andnps %xmm1,%xmm5
orps   %xmm4,%xmm5
movaps %xmm5,%xmm1
subss  %xmm0,%xmm1
movaps %xmm5,%xmm3
addss  0xecd(%rip),%xmm3
cmpltss 0xec8(%rip),%xmm1
andps  %xmm1,%xmm3
andnps %xmm5,%xmm1
orps   %xmm3,%xmm1
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @LerpAngle(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* %5
%8 = load float, float* %4
%9 = fsub float %7, %8
%10 = fcmp ogt float %9, 1.800000e+02
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = load float, float* %5
%13 = fsub float %12, 3.600000e+02
store float %13, float* %5
br label %14
14: ; preds = %11, %3
%15 = load float, float* %5
%16 = load float, float* %4
%17 = fsub float %15, %16
%18 = fcmp olt float %17, -1.800000e+02
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load float, float* %5
%21 = fadd float %20, 3.600000e+02
store float %21, float* %5
br label %22
22: ; preds = %19, %14
%23 = load float, float* %4
%24 = load float, float* %6
%25 = load float, float* %5
%26 = load float, float* %4
%27 = fsub float %25, %26
%28 = call float @llvm.fmuladd.f32(float %24, float %27, float %23)
ret float %28
}

LLVM IR (-O2):
define float @LerpAngle(float %0, float %1, float %2) {
%4 = fsub float %1, %0
%5 = fcmp ogt float %4, 1.800000e+02
%6 = fadd float %1, -3.600000e+02
%7 = select i1 %5, float %6, float %1
%8 = fsub float %7, %0
%9 = fcmp olt float %8, -1.800000e+02
%10 = fadd float %7, 3.600000e+02
%11 = select i1 %9, float %10, float %7
%12 = fsub float %11, %0
%13 = tail call float @llvm.fmuladd.f32(float %2, float %12, float %0)
ret float %13
}
/* Variables and functions */
int divideBy255(int);
int convert8To5(int b) { return divideBy255(b * 31); }


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

x86 assembly (clang, -O2):
<convert8To5>:
mov    %edi,%eax
shl    $0x5,%eax
sub    %edi,%eax
mov    %eax,%edi
jmp    1030 <divideBy255@plt>

LLVM IR (-O0):
define i32 @convert8To5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 31
%5 = call i32 @divideBy255(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @convert8To5(i32 %0) {
%2 = mul nsw i32 %0, 31
%3 = tail call i32 @divideBy255(i32 %2)
ret i32 %3
}
/* Variables and functions */
char *uint2str(long long, char *);
char *int2str(long long value, char *buf) {
  if (value < 0) {
    *buf++ = '-';
    value = -value;
  }
  return uint2str(value, buf);
}


x86 assembly (clang, -O0):
<int2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1147 <int2str+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,(%rax)
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <uint2str@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int2str>:
test   %rdi,%rdi
js     111a <int2str+0xa>
jmp    1030 <uint2str@plt>
movb   $0x2d,(%rsi)
add    $0x1,%rsi
neg    %rdi
jmp    1030 <uint2str@plt>

LLVM IR (-O0):
define i8* @int2str(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%5 = load i64, i64* %3
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %4
store i8 45, i8* %8
%10 = load i64, i64* %3
%11 = sub nsw i64 0, %10
store i64 %11, i64* %3
br label %12
12: ; preds = %7, %2
%13 = load i64, i64* %3
%14 = load i8*, i8** %4
%15 = call i8* @uint2str(i64 %13, i8* %14)
ret i8* %15
}

LLVM IR (-O2):
define i8* @int2str(i64 %0, i8* %1) {
%3 = icmp slt i64 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %1, i64 1
store i8 45, i8* %1
%6 = sub nsw i64 0, %0
br label %7
7: ; preds = %4, %2
%8 = phi i64 [ %6, %4 ], [ %0, %2 ]
%9 = phi i8* [ %5, %4 ], [ %1, %2 ]
%10 = tail call i8* @uint2str(i64 %8, i8* %9)
ret i8* %10
}
/* Variables and functions */
char *ultoa(unsigned long, char *, int);
extern char *utoa(unsigned int value, char *string, int radix) {
  return ultoa((unsigned long)value, string, radix);
}


x86 assembly (clang, -O0):
<utoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <ultoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utoa>:
mov    %edi,%edi
jmp    1030 <ultoa@plt>

LLVM IR (-O0):
define i8* @utoa(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i8* @ultoa(i64 %8, i8* %9, i32 %10)
ret i8* %11
}

LLVM IR (-O2):
define i8* @utoa(i32 %0, i8* %1, i32 %2) {
%4 = zext i32 %0 to i64
%5 = tail call i8* @ultoa(i64 %4, i8* %1, i32 %2)
ret i8* %5
}
long long cpucycles_x86estimate(void) {
  long long result;
  asm volatile(".byte 15;.byte 49" : "=A"(result));
  return result;
}


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

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

LLVM IR (-O0):
define i64 @cpucycles_x86estimate() {
%1 = alloca i64
%2 = call i64 asm sideeffect ".byte 15;.byte 49", "=A,~{dirflag},~{fpsr},~{flags}"()
store i64 %2, i64* %1
%3 = load i64, i64* %1
ret i64 %3
}

LLVM IR (-O2):
define i64 @cpucycles_x86estimate() {
%1 = tail call i64 asm sideeffect ".byte 15;.byte 49", "=A,~{dirflag},~{fpsr},~{flags}"()
ret i64 %1
}
int abs(int x) {
  if (x < 0)
    return -x;
  return x;
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <abs+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ output_line(char *);
void gen_swap(void) { output_line("swap r1 r2"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"swap r1 r2\00"
define void @gen_swap() {
%1 = call i32 @output_line(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"swap r1 r2\00"
define void @gen_swap() {
%1 = tail call i32 @output_line(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void const *strdup(void const *);
const void *__FHHashStringRetainCallback(const void *key) {
  return strdup(key);
}


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

x86 assembly (clang, -O2):
<__FHHashStringRetainCallback>:
jmp    1030 <strdup@plt>

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

LLVM IR (-O2):
define noalias i8* @__FHHashStringRetainCallback(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ bmount(char *);
int /*<<< orphan*/ bumount();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ infoSB();
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("[ERROR] Paràmetres incorrectes! Prova: ./infosb ../disco.imagen\n");
    exit(-1);
  }
  bmount(argv[1]);
  infoSB();
  bumount();
  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)
cmpl   $0x2,-0x8(%rbp)
je     1186 <main+0x36>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <bmount@plt>
mov    $0x0,%al
call   1060 <infoSB@plt>
mov    $0x0,%al
call   1040 <bumount@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1171 <main+0x21>
mov    0x8(%rsi),%rdi
call   1050 <bmount@plt>
xor    %eax,%eax
call   1060 <infoSB@plt>
xor    %eax,%eax
call   1040 <bumount@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [66 x i8] c"[ERROR] Par\C3\A0metres incorrectes! Prova: ./infosb ../disco.imagen\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @bmount(i8* %14)
%16 = call i32 (...) @infoSB()
%17 = call i32 (...) @bumount()
ret i32 0
}

LLVM IR (-O2):
@str = [65 x i8] c"[ERROR] Par\C3\A0metres incorrectes! Prova: ./infosb ../disco.imagen\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([65 x i8], [65 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @bmount(i8* %9)
%11 = tail call i32 (...) @infoSB()
%12 = tail call i32 (...) @bumount()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int i;
  int sum = 0;
  for (i = 0; i < argc; i++) {
    sum += i;
  }
  printf("Sum is: %d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1157 <main+0x47>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
mov    -0x18(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
test   %edi,%edi
jle    1129 <main+0x19>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,1),%esi
add    $0xffffffff,%esi
jmp    112b <main+0x1b>
xor    %esi,%esi
push   %rax
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"Sum is: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %11, %0
%13 = add i32 %12, -1
br label %14
14: ; preds = %4, %2
%15 = phi i32 [ 0, %2 ], [ %13, %4 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void HandleFunc_1(void) { printf("cleanup func1\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"cleanup func1\00"
define void @HandleFunc_1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int triple(int);
void triple_value(int *px) { *px = triple(*px); }


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

x86 assembly (clang, -O2):
<triple_value>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1030 <triple@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @triple_value(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 @triple(i32 %4)
%6 = load i32*, i32** %2
store i32 %5, i32* %6
ret void
}

LLVM IR (-O2):
define void @triple_value(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @triple(i32 %2)
store i32 %3, i32* %0
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
char *copy_string(char *input) {
  size_t length = strlen(input) + 1;
  char *output = (char *)malloc(sizeof(char) * length);
  strncpy(output, input, length);
  return output;
}


x86 assembly (clang, -O0):
<copy_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_string>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15d,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <strncpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @copy_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = mul i64 1, %9
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = load i8*, i8** %2
%16 = load i64, i64* %3
%17 = call i32 @strncpy(i8* %14, i8* %15, i64 %16)
%18 = load i8*, i8** %4
ret i8* %18
}

LLVM IR (-O2):
define i8* @copy_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = sext i32 %3 to i64
%5 = tail call i64 @malloc(i32 %3)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @strncpy(i8* %6, i8* %0, i64 %4)
ret i8* %6
}
int clamp(int value, int min, int max) {
  int ret = value < min ? min : value;
  return ret > max ? max : ret;
}


x86 assembly (clang, -O0):
<clamp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1124 <clamp+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    112a <clamp+0x2a>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1147 <clamp+0x47>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    114d <clamp+0x4d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @clamp(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load i32, i32* %5
br label %15
13: ; preds = %3
%14 = load i32, i32* %4
br label %15
15: ; preds = %13, %11
%16 = phi i32 [ %12, %11 ], [ %14, %13 ]
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = load i32, i32* %6
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = load i32, i32* %6
br label %24
22: ; preds = %15
%23 = load i32, i32* %7
br label %24
24: ; preds = %22, %20
%25 = phi i32 [ %21, %20 ], [ %23, %22 ]
ret i32 %25
}

LLVM IR (-O2):
define i32 @clamp(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = select i1 %4, i32 %1, i32 %0
%6 = icmp sgt i32 %5, %2
%7 = select i1 %6, i32 %2, i32 %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print_delimiter(const char *message) {
  printf("====-- CinyTest %s --====\n", message);
}


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

x86 assembly (clang, -O2):
<print_delimiter>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [27 x i8] c"====-- CinyTest %s --====\0A\00"
define void @print_delimiter(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
unsigned long http_parser_version(void) {
  return 2 * 0x10000 | 9 * 0x00100 | 2 * 0x00001;
}


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

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

LLVM IR (-O0):
define i64 @http_parser_version() {
ret i64 133378
}

LLVM IR (-O2):
define i64 @http_parser_version() {
ret i64 133378
}
void outer_unlock_all(void) {}


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

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

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

LLVM IR (-O2):
define void @outer_unlock_all() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print1D(int *ptr, int size) {
  for (int i = 0; i < size; i++) {
    printf("%d ", ptr[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print1D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print1D+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print1D+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print1D>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print1D+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print1D+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print1D(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = tail call i32 @putchar(i32 10)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Variables and functions */
int /*<<< orphan*/ endOfProcess();
int /*<<< orphan*/ produce();
void producer() {
  produce();
  endOfProcess();
}


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

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

LLVM IR (-O0):
define void @producer() {
%1 = call i32 (...) @produce()
%2 = call i32 (...) @endOfProcess()
ret void
}

LLVM IR (-O2):
define void @producer() {
%1 = tail call i32 (...) @produce()
%2 = tail call i32 (...) @endOfProcess()
ret void
}
void goSouthEast(int *lat, int *lon) {
  *lat -= 1;
  *lon += 1;
}


x86 assembly (clang, -O0):
<goSouthEast>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<goSouthEast>:
addl   $0xffffffff,(%rdi)
addl   $0x1,(%rsi)
ret

LLVM IR (-O0):
define void @goSouthEast(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* %5
%7 = sub nsw i32 %6, 1
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
ret void
}

LLVM IR (-O2):
define void @goSouthEast(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = add nsw i32 %3, -1
store i32 %4, i32* %0
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
ret void
}
int squared(int num) { return num * num; }


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

x86 assembly (clang, -O2):
<squared>:
mov    %edi,%eax
imul   %edi,%eax
ret

LLVM IR (-O0):
define i32 @squared(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = mul nsw i32 %3, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @squared(i32 %0) {
%2 = mul nsw i32 %0, %0
ret i32 %2
}
double ft_mix(double x, double y, double a) { return (x * (1 - a) + y * a); }


x86 assembly (clang, -O0):
<ft_mix>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xee0(%rip),%xmm2
subsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_mix>:
movsd  0xef8(%rip),%xmm3
subsd  %xmm2,%xmm3
mulsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ft_mix(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %6
%9 = fsub double 1.000000e+00, %8
%10 = load double, double* %5
%11 = load double, double* %6
%12 = fmul double %10, %11
%13 = call double @llvm.fmuladd.f64(double %7, double %9, double %12)
ret double %13
}

LLVM IR (-O2):
define double @ft_mix(double %0, double %1, double %2) {
%4 = fsub double 1.000000e+00, %2
%5 = fmul double %1, %2
%6 = tail call double @llvm.fmuladd.f64(double %0, double %4, double %5)
ret double %6
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ memcpy(char *, char const *, scalar_t__);
scalar_t__ strmlen(char *);
char *strmdup(const char *s) {
  char *dest = NULL;
  dest = (char *)malloc(strmlen((char *)s) + 1);
  if (dest == NULL)
    return NULL;
  memcpy(dest, s, strmlen((char *)s) + 1);
  return dest;
}


x86 assembly (clang, -O0):
<strmdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strmlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1175 <strmdup+0x45>
movq   $0x0,-0x8(%rbp)
jmp    11aa <strmdup+0x7a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strmlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %rax,%rdx
add    $0x1,%rdx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strmdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strmlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1166 <strmdup+0x36>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <strmlen@plt>
lea    0x1(%rax),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <memcpy@plt>
jmp    1168 <strmdup+0x38>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strmdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* null, i8** %4
%5 = load i8*, i8** %3
%6 = call i64 @strmlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %1
store i8* null, i8** %2
br label %21
13: ; preds = %1
%14 = load i8*, i8** %4
%15 = load i8*, i8** %3
%16 = load i8*, i8** %3
%17 = call i64 @strmlen(i8* %16)
%18 = add nsw i64 %17, 1
%19 = call i32 @memcpy(i8* %14, i8* %15, i64 %18)
%20 = load i8*, i8** %4
store i8* %20, i8** %2
br label %21
21: ; preds = %13, %12
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define i8* @strmdup(i8* %0) {
%2 = tail call i64 @strmlen(i8* %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = tail call i64 @strmlen(i8* %0)
%9 = add nsw i64 %8, 1
%10 = tail call i32 @memcpy(i8* %5, i8* %0, i64 %9)
br label %11
11: ; preds = %1, %7
%12 = phi i8* [ %5, %7 ], [ null, %1 ]
ret i8* %12
}
/* Type definitions */
struct module {
  int dummy;
};

/* Variables and functions */
int memcmp(struct module const **, struct module const **, int);
int module_ptr_cmp(const struct module **a, const struct module **b) {
  return memcmp(a, b, sizeof(*a));
}


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

x86 assembly (clang, -O2):
<module_ptr_cmp>:
mov    $0x8,%edx
jmp    1030 <memcmp@plt>

LLVM IR (-O0):
%struct.module = type { i32 }
define i32 @module_ptr_cmp(%struct.module** %0, %struct.module** %1) {
%3 = alloca %struct.module**
%4 = alloca %struct.module**
store %struct.module** %0, %struct.module*** %3
store %struct.module** %1, %struct.module*** %4
%5 = load %struct.module**, %struct.module*** %3
%6 = load %struct.module**, %struct.module*** %4
%7 = call i32 @memcmp(%struct.module** %5, %struct.module** %6, i32 8)
ret i32 %7
}

LLVM IR (-O2):
%struct.module = type { i32 }
define i32 @module_ptr_cmp(%struct.module** %0, %struct.module** %1) {
%3 = tail call i32 @memcmp(%struct.module** %0, %struct.module** %1, i32 8)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                   void *(*)(void *), void *);
void Pthread_create(pthread_t *thread, const pthread_attr_t *attr,
                    void *(*start_routine)(void *), void *arg) {
  int rc = pthread_create(thread, attr, start_routine, arg);
  assert(rc == 0);
}


x86 assembly (clang, -O0):
<Pthread_create>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1040 <pthread_create@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pthread_create>:
push   %rax
call   1040 <pthread_create@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
pop    %rax
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @Pthread_create(i32* %0, i32* %1, i8* (i8*)* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8* (i8*)*
%8 = alloca i8*
%9 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i8* (i8*)* %2, i8* (i8*)** %7
store i8* %3, i8** %8
%10 = load i32*, i32** %5
%11 = load i32*, i32** %6
%12 = load i8* (i8*)*, i8* (i8*)** %7
%13 = load i8*, i8** %8
%14 = call i32 @pthread_create(i32* %10, i32* %11, i8* (i8*)* %12, i8* %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
ret void
}

LLVM IR (-O2):
define void @Pthread_create(i32* %0, i32* %1, i8* (i8*)* %2, i8* %3) {
%5 = tail call i32 @pthread_create(i32* %0, i32* %1, i8* (i8*)* %2, i8* %3)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Reserved86_DriverIRQHandler();
__attribute__((weak)) void Reserved86_IRQHandler(void) {
  Reserved86_DriverIRQHandler();
}


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

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

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

LLVM IR (-O2):
define weak void @Reserved86_IRQHandler() {
%1 = tail call i32 (...) @Reserved86_DriverIRQHandler()
ret void
}
unsigned int mask(unsigned u, int n_bits) { return u & ((1 << n_bits) - 1); }


x86 assembly (clang, -O0):
<mask>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mask>:
mov    %esi,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @mask(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 = shl i32 1, %6
%8 = sub nsw i32 %7, 1
%9 = and i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @mask(i32 %0, i32 %1) {
%3 = shl nsw i32 -1, %1
%4 = xor i32 %3, -1
%5 = and i32 %4, %0
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
double stdlib_strided_dsmeanpn(int /*<<< orphan*/ const, float const *,
                               int /*<<< orphan*/ const);
double stdlib_strided_dsmean(const int64_t N, const float *X,
                             const int64_t stride) {
  return stdlib_strided_dsmeanpn(N, X, stride);
}


x86 assembly (clang, -O0):
<stdlib_strided_dsmean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <stdlib_strided_dsmeanpn@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_dsmean>:
jmp    1030 <stdlib_strided_dsmeanpn@plt>

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

LLVM IR (-O2):
define double @stdlib_strided_dsmean(i32 %0, float* %1, i32 %2) {
%4 = tail call double @stdlib_strided_dsmeanpn(i32 %0, float* %1, i32 %2)
ret double %4
}