xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ C67_asm(char *, int, int, int);
void C67_SHL(int r, int v) { C67_asm("SHL.S", r, v, v); }


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

x86 assembly (clang, -O2):
<C67_SHL>:
mov    %esi,%ecx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
mov    %ecx,%edx
jmp    1030 <C67_asm@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"SHL.S\00"
define void @C67_SHL(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 = load i32, i32* %4
%8 = call i32 @C67_asm(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"SHL.S\00"
define void @C67_SHL(i32 %0, i32 %1) {
%3 = tail call i32 @C67_asm(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ADVKATA();
int /*<<< orphan*/ START(char *);
void STARTKATA(char s[]) {
  START(s);
  ADVKATA();
}


x86 assembly (clang, -O0):
<STARTKATA>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <START@plt>
mov    $0x0,%al
call   1030 <ADVKATA@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @STARTKATA(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @START(i8* %3)
%5 = call i32 (...) @ADVKATA()
ret void
}

LLVM IR (-O2):
define void @STARTKATA(i8* %0) {
%2 = tail call i32 @START(i8* %0)
%3 = tail call i32 (...) @ADVKATA()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
int suma(int, int, int);
void main() {
  int d1, d2, d3;
  printf("Dame tres numeros\n");
  scanf("%d %d %d", &d1, &d2, &d3);
  printf("%d\n", suma(d1, d2, d3));
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <suma@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xea9(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1060 <scanf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
call   1050 <suma@plt>
lea    0xe86(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str.1 = [9 x i8] c"%d %d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [18 x i8] c"Dame tres numeros\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 @suma(i32 %9, i32 %10, i32 %11)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %12)
ret void
}
void cache_wait(unsigned reg, unsigned long mask) {
  while ((*((volatile unsigned *)reg)) & mask)
    ;
}


x86 assembly (clang, -O0):
<cache_wait>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    (%rax),%eax
mov    %eax,%eax
and    -0x10(%rbp),%rax
cmp    $0x0,%rax
je     1125 <cache_wait+0x25>
jmp    110b <cache_wait+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<cache_wait>:
mov    %edi,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rax),%ecx
and    %esi,%ecx
jne    1110 <cache_wait+0x10>
ret

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

LLVM IR (-O2):
define void @cache_wait(i32 %0, i64 %1) {
%3 = zext i32 %0 to i64
%4 = inttoptr i64 %3 to i32*
br label %5
5: ; preds = %5, %2
%6 = load volatile i32, i32* %4
%7 = zext i32 %6 to i64
%8 = and i64 %7, %1
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ usbFatalError();
void ep1ReceiveCallback(uint8_t *packet_buffer, uint32_t length,
                        unsigned int is_setup) {
  usbFatalError();
}


x86 assembly (clang, -O0):
<ep1ReceiveCallback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0x0,%al
call   1030 <usbFatalError@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ep1ReceiveCallback(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 (...) @usbFatalError()
ret void
}

LLVM IR (-O2):
define void @ep1ReceiveCallback(i32* nocapture readnone %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @usbFatalError()
ret void
}
/* Variables and functions */
int is_big_endian_lazy();
int is_big_endian(void) { return is_big_endian_lazy(); }


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

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

LLVM IR (-O0):
define i32 @is_big_endian() {
%1 = call i32 (...) @is_big_endian_lazy()
ret i32 %1
}

LLVM IR (-O2):
define i32 @is_big_endian() {
%1 = tail call i32 (...) @is_big_endian_lazy()
ret i32 %1
}
int _gcd(int a, int b) {
  if (!b)
    return a;
  return _gcd(b, a % b);
}


x86 assembly (clang, -O0):
<_gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <_gcd+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <_gcd+0x37>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <_gcd@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gcd>:
mov    %edi,%eax
test   %esi,%esi
je     111d <_gcd+0x1d>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <_gcd+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @_gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %9, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %5, %4 ], [ %0, %2 ]
%7 = srem i32 %6, %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4, %2
%10 = phi i32 [ %0, %2 ], [ %5, %4 ]
ret i32 %10
}
void clear_leds(void) {
  (*(volatile unsigned long *)(0xE0028000 + 0x14)) |= 0x00ff0000;
}


x86 assembly (clang, -O0):
<clear_leds>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe0028014,%eax
mov    (%rax),%rcx
or     $0xff0000,%rcx
mov    $0xe0028014,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_leds>:
mov    $0xe0028014,%eax
orq    $0xff0000,(%rax)
ret

LLVM IR (-O0):
define void @clear_leds() {
%1 = load volatile i64, i64* inttoptr (i64 3758260244 to i64*)
%2 = or i64 %1, 16711680
store volatile i64 %2, i64* inttoptr (i64 3758260244 to i64*)
ret void
}

LLVM IR (-O2):
define void @clear_leds() {
%1 = load volatile i64, i64* inttoptr (i64 3758260244 to i64*)
%2 = or i64 %1, 16711680
store volatile i64 %2, i64* inttoptr (i64 3758260244 to i64*)
ret void
}
void scamper_do_tbit_cleanup(void) { return; }


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

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

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

LLVM IR (-O2):
define void @scamper_do_tbit_cleanup() {
ret void
}
float cubicNoiseInterpolate(const float a, const float b, const float c,
                            const float d, const float x) {
  const float p = (d - c) - (a - b);
  return x * (x * (x * p + ((a - b) - p)) + (c - a)) + b;
}


x86 assembly (clang, -O0):
<cubicNoiseInterpolate>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x4(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
movss  -0x14(%rbp),%xmm3
movss  -0x18(%rbp),%xmm4
movss  -0x4(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
subss  -0x18(%rbp),%xmm1
mulss  %xmm4,%xmm3
addss  %xmm1,%xmm3
movss  -0xc(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
mulss  %xmm3,%xmm2
addss  %xmm1,%xmm2
movss  -0x8(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<cubicNoiseInterpolate>:
subss  %xmm2,%xmm3
subss  %xmm0,%xmm2
subss  %xmm1,%xmm0
subss  %xmm0,%xmm3
subss  %xmm3,%xmm0
mulss  %xmm4,%xmm3
addss  %xmm3,%xmm0
mulss  %xmm4,%xmm0
addss  %xmm2,%xmm0
mulss  %xmm4,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @cubicNoiseInterpolate(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%12 = load float, float* %9
%13 = load float, float* %8
%14 = fsub float %12, %13
%15 = load float, float* %6
%16 = load float, float* %7
%17 = fsub float %15, %16
%18 = fsub float %14, %17
store float %18, float* %11
%19 = load float, float* %10
%20 = load float, float* %10
%21 = load float, float* %10
%22 = load float, float* %11
%23 = load float, float* %6
%24 = load float, float* %7
%25 = fsub float %23, %24
%26 = load float, float* %11
%27 = fsub float %25, %26
%28 = call float @llvm.fmuladd.f32(float %21, float %22, float %27)
%29 = load float, float* %8
%30 = load float, float* %6
%31 = fsub float %29, %30
%32 = call float @llvm.fmuladd.f32(float %20, float %28, float %31)
%33 = load float, float* %7
%34 = call float @llvm.fmuladd.f32(float %19, float %32, float %33)
ret float %34
}

LLVM IR (-O2):
define float @cubicNoiseInterpolate(float %0, float %1, float %2, float %3, float %4) {
%6 = fsub float %3, %2
%7 = fsub float %0, %1
%8 = fsub float %6, %7
%9 = fsub float %7, %8
%10 = tail call float @llvm.fmuladd.f32(float %4, float %8, float %9)
%11 = fsub float %2, %0
%12 = tail call float @llvm.fmuladd.f32(float %4, float %10, float %11)
%13 = tail call float @llvm.fmuladd.f32(float %4, float %12, float %1)
ret float %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int XResourceManagerString() {
  printf("XResourceManagerString called\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [30 x i8] c"XResourceManagerString called\00"
define i32 @XResourceManagerString() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
char *strncpy(char *dest, const char *src, int count) {
  __asm__("cld\n"
          "1:\tdecl %2\n\t"
          "js 2f\n\t"
          "lodsb\n\t"
          "stosb\n\t"
          "testb %%al,%%al\n\t"
          "jne 1b\n\t"
          "rep\n\t"
          "stosb\n"
          "2:"
          :
          : "S"(src), "D"(dest), "c"(count)
          : "%al");
  return dest;
}


x86 assembly (clang, -O0):
<strncpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%ecx
cld
dec    %ecx
js     112f <strncpy+0x2f>
lods   %ds:(%rsi),%al
stos   %al,%es:(%rdi)
test   %al,%al
jne    111b <strncpy+0x1b>
rep stos %al,%es:(%rdi)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy>:
mov    %edx,%ecx
cld
dec    %ecx
js     110f <strncpy+0xf>
lods   %ds:(%rsi),%al
stos   %al,%es:(%rdi)
test   %al,%al
jne    1103 <strncpy+0x3>
rep stos %al,%es:(%rdi)
mov    %rdi,%rax
ret

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

LLVM IR (-O2):
define i8* @strncpy(i8* returned %0, i8* %1, i32 %2) {
tail call void asm sideeffect "cld\0A1:\09decl $2\0A\09js 2f\0A\09lodsb\0A\09stosb\0A\09testb %al,%al\0A\09jne 1b\0A\09rep\0A\09stosb\0A2:", "{si},{di},{cx},~{al},~{dirflag},~{fpsr},~{flags}"(i8* %1, i8* %0, i32 %2)
ret i8* %0
}
/* Variables and functions */
size_t get_shell_end(size_t shell_idx) {
  static const size_t end[] = {1, 4, 4, 10, 20};
  return end[shell_idx];
}


x86 assembly (clang, -O0):
<get_shell_end>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
lea    0xeed(%rip),%rax
mov    (%rax,%rcx,8),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_shell_end>:
lea    0xef9(%rip),%rax
mov    (%rax,%rdi,8),%rax
ret

LLVM IR (-O0):
@get_shell_end.end = internal constant [5 x i64] [i64 1, i64 4, i64 4, i64 10, i64 20]
define i64 @get_shell_end(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = getelementptr inbounds [5 x i64], [5 x i64]* @get_shell_end.end, i64 0, i64 %3
%5 = load i64, i64* %4
ret i64 %5
}

LLVM IR (-O2):
@get_shell_end.end = internal unnamed_addr constant [5 x i64] [i64 1, i64 4, i64 4, i64 10, i64 20]
define i64 @get_shell_end(i64 %0) {
%2 = getelementptr inbounds [5 x i64], [5 x i64]* @get_shell_end.end, i64 0, i64 %0
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void subfree(void **d) { free(*d); }


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

x86 assembly (clang, -O2):
<subfree>:
mov    (%rdi),%rdi
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @subfree(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @free(i8* %2)
ret void
}
void SPUasync(unsigned int cycle, unsigned int flags) {}


x86 assembly (clang, -O0):
<SPUasync>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @SPUasync(i32 %0, i32 %1) {
ret void
}
void native_halt(void) { asm volatile("hlt" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @native_halt() {
tail call void asm sideeffect "hlt", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int main(int argc, char *_[]) {
  const unsigned N = 1 << 5;
  unsigned A[N];
  for (unsigned i = 0; i < N; ++i) {
    A[i] = i;
  }
  return argc + A[0];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x20,-0x14(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x20,-0x24(%rbp)
jae    1150 <main+0x50>
mov    -0x24(%rbp),%ecx
mov    -0x24(%rbp),%eax
mov    %ecx,-0xb0(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112b <main+0x2b>
mov    -0x8(%rbp),%eax
add    -0xb0(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 %0
}
/* Variables and functions */
char *strerror(int);
char *c_strerror(int arg0) { return strerror(arg0); }


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

x86 assembly (clang, -O2):
<c_strerror>:
jmp    1030 <strerror@plt>

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

LLVM IR (-O2):
define i8* @c_strerror(i32 %0) {
%2 = tail call i8* @strerror(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char *argv[]) {
  int distance = 200;
  int length = 30;
  printf("You are %d miles away. You are %d inches tall.\n", distance, length);
  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   $0xc8,-0x14(%rbp)
movl   $0x1e,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xc8,%esi
mov    $0x1e,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [48 x i8] c"You are %d miles away. You are %d inches tall.\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 200, i32* %6
store i32 30, i32* %7
%8 = load i32, i32* %6
%9 = load i32, i32* %7
%10 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [48 x i8] c"You are %d miles away. You are %d inches tall.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i32 200, i32 30)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main0(int argc, char **argv) {
  for (int i = 0; i < argc; i++) {
    puts(*(argv + i));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1151 <main0+0x41>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <main0+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main0>:
push   %r15
push   %r14
push   %rbx
test   %edi,%edi
jle    1142 <main0+0x32>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <main0+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @main0(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8**, i8*** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 @puts(i8* %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
ret i32 0
}

LLVM IR (-O2):
define i32 @main0(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %7
6: ; preds = %7, %2
ret i32 0
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
void swapbufs(char **a, char **b) {
  char *tmp = *a;
  *a = *b;
  *b = tmp;
}


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

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

LLVM IR (-O0):
define void @swapbufs(i8** %0, i8** %1) {
%3 = alloca i8**
%4 = alloca i8**
%5 = alloca i8*
store i8** %0, i8*** %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8**, i8*** %4
%9 = load i8*, i8** %8
%10 = load i8**, i8*** %3
store i8* %9, i8** %10
%11 = load i8*, i8** %5
%12 = load i8**, i8*** %4
store i8* %11, i8** %12
ret void
}

LLVM IR (-O2):
define void @swapbufs(i8** nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %0
%4 = load i8*, i8** %1
store i8* %4, i8** %0
store i8* %3, i8** %1
ret void
}
unsigned int FLIP32(unsigned int b) {
  unsigned int c;
  c = (b & 0xff000000) >> 24;
  c |= (b & 0xff0000) >> 8;
  c |= (b & 0xff00) << 8;
  c |= (b & 0xff) << 24;
  return c;
}


x86 assembly (clang, -O0):
<FLIP32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
shr    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
shl    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @FLIP32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, -16777216
%6 = lshr i32 %5, 24
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = and i32 %7, 16711680
%9 = lshr i32 %8, 8
%10 = load i32, i32* %3
%11 = or i32 %10, %9
store i32 %11, i32* %3
%12 = load i32, i32* %2
%13 = and i32 %12, 65280
%14 = shl i32 %13, 8
%15 = load i32, i32* %3
%16 = or i32 %15, %14
store i32 %16, i32* %3
%17 = load i32, i32* %2
%18 = and i32 %17, 255
%19 = shl i32 %18, 24
%20 = load i32, i32* %3
%21 = or i32 %20, %19
store i32 %21, i32* %3
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @FLIP32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ klock_getT2();
int getTIssue2(int y) {
  int *a;
  a = (int *)klock_getT2();
  return *a - y;
}


x86 assembly (clang, -O0):
<getTIssue2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <klock_getT2@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
sub    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTIssue2>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <klock_getT2@plt>
mov    (%rax),%eax
sub    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getTIssue2(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = call i64 (...) @klock_getT2()
%5 = inttoptr i64 %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = load i32, i32* %2
%9 = sub nsw i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @getTIssue2(i32 %0) {
%2 = tail call i64 (...) @klock_getT2()
%3 = inttoptr i64 %2 to i32*
%4 = load i32, i32* %3
%5 = sub nsw i32 %4, %0
ret i32 %5
}
/* Variables and functions */
double stat_mean(double *, int);
double stat_stderr(double *, int);
double stat_stderr_rel(double *data, int size) {
  return stat_stderr(data, size) / stat_mean(data, size);
}


x86 assembly (clang, -O0):
<stat_stderr_rel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <stat_stderr@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <stat_mean@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stat_stderr_rel>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1040 <stat_stderr@plt>
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <stat_mean@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @stat_stderr_rel(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = call double @stat_stderr(double* %5, i32 %6)
%8 = load double*, double** %3
%9 = load i32, i32* %4
%10 = call double @stat_mean(double* %8, i32 %9)
%11 = fdiv double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @stat_stderr_rel(double* %0, i32 %1) {
%3 = tail call double @stat_stderr(double* %0, i32 %1)
%4 = tail call double @stat_mean(double* %0, i32 %1)
%5 = fdiv double %3, %4
ret double %5
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
scalar_t__ nanosleep(struct timespec *, struct timespec *);
int /*<<< orphan*/ printf(char *);
int tsleep() {
  struct timespec tim, tim2;
  tim.tv_sec = 0;
  tim.tv_nsec = 10000;
  if (nanosleep(&tim, &tim2) < 0) {
    printf("Failed during nanosleep.");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<tsleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x10(%rbp)
movl   $0x2710,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <nanosleep@plt>
cmp    $0x0,%rax
jge    1166 <tsleep+0x46>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    116d <tsleep+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsleep>:
sub    $0x28,%rsp
movq   $0x0,0x10(%rsp)
movl   $0x2710,0x8(%rsp)
lea    0x8(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1040 <nanosleep@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     1153 <tsleep+0x33>
add    $0x28,%rsp
ret
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@.str = [25 x i8] c"Failed during nanosleep.\00"
define i32 @tsleep() {
%1 = alloca i32
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 1
store i64 0, i64* %4
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i32 0, i32 0
store i32 10000, i32* %5
%6 = call i64 @nanosleep(%struct.timespec* %2, %struct.timespec* %3)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %11
10: ; preds = %0
store i32 0, i32* %1
br label %11
11: ; preds = %10, %8
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@.str = [25 x i8] c"Failed during nanosleep.\00"
define i32 @tsleep() {
%1 = alloca %struct.timespec
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %1 to i8*
%4 = bitcast %struct.timespec* %2 to i8*
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
store i32 10000, i32* %6
%7 = call i64 @nanosleep(%struct.timespec* %1, %struct.timespec* %2)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %0, %9
%12 = phi i32 [ 1, %9 ], [ 0, %0 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ removeSocketEntry(int);
void io_closeSocket(int *sfd) {
  if (sfd && *sfd != -1) {
    close(*sfd);
    removeSocketEntry(*sfd);
    *sfd = -1;
  }
}


x86 assembly (clang, -O0):
<io_closeSocket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1164 <io_closeSocket+0x44>
mov    -0x8(%rbp),%rax
cmpl   $0xffffffff,(%rax)
je     1164 <io_closeSocket+0x44>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1040 <close@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <removeSocketEntry@plt>
mov    -0x8(%rbp),%rax
movl   $0xffffffff,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_closeSocket>:
push   %rbx
test   %rdi,%rdi
je     1142 <io_closeSocket+0x22>
mov    %rdi,%rbx
mov    (%rdi),%edi
cmp    $0xffffffff,%edi
je     1142 <io_closeSocket+0x22>
call   1040 <close@plt>
mov    (%rbx),%edi
call   1030 <removeSocketEntry@plt>
movl   $0xffffffff,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @io_closeSocket(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %17
5: ; preds = %1
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = icmp ne i32 %7, -1
br i1 %8, label %9, label %17
9: ; preds = %5
%10 = load i32*, i32** %2
%11 = load i32, i32* %10
%12 = call i32 @close(i32 %11)
%13 = load i32*, i32** %2
%14 = load i32, i32* %13
%15 = call i32 @removeSocketEntry(i32 %14)
%16 = load i32*, i32** %2
store i32 -1, i32* %16
br label %17
17: ; preds = %9, %5, %1
ret void
}

LLVM IR (-O2):
define void @io_closeSocket(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = load i32, i32* %0
%5 = icmp eq i32 %4, -1
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i32 @close(i32 %4)
%8 = load i32, i32* %0
%9 = tail call i32 @removeSocketEntry(i32 %8)
store i32 -1, i32* %0
br label %10
10: ; preds = %6, %3, %1
ret void
}
/* Variables and functions */
char tolower(char);
void normalize(char *str) {
  int i;
  for (i = 0; str[i] != '\0'; i++) {
    str[i] = tolower(str[i]);
  }
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1164 <normalize+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <normalize+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <normalize+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <normalize+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @normalize(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call signext i8 @tolower(i8 signext %6)
store i8 %8, i8* %7
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Type definitions */
struct timespec {
  long tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec const *, int /*<<< orphan*/ *);
void gol_sleep(long wait) {
  const struct timespec t = {.tv_sec = 0, .tv_nsec = wait};
  nanosleep(&t, NULL);
}


x86 assembly (clang, -O0):
<gol_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gol_sleep>:
sub    $0x18,%rsp
mov    %rdi,0x8(%rsp)
movl   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i32 }
define void @gol_sleep(i64 %0) {
%2 = alloca i64
%3 = alloca %struct.timespec
store i64 %0, i64* %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%5 = load i64, i64* %2
store i64 %5, i64* %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i32 0, i32* %6
%7 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i32 }
define void @gol_sleep(i64 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i64 %0, i64* %4
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i32 0, i32* %5
%6 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret void
}
char *dcgettext(domainname, msgid, category) const char *domainname;
const char *msgid;
int category;
{ return libintl_dcgettext(domainname, msgid, category); }


x86 assembly (clang, -O0):
<dcgettext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x0,%al
call   1030 <libintl_dcgettext@plt>
cltq
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @dcgettext(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @libintl_dcgettext to i32 (i8*, i8*, i32, ...)*)(i8* %7, i8* %8, i32 %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8*
ret i8* %12
}

LLVM IR (-O2):
define i8* @dcgettext(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @libintl_dcgettext to i32 (i8*, i8*, i32, ...)*)(i8* %0, i8* %1, i32 %2)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
void oneline_comment(FILE *f) {
  int c;
  do {
    c = getc(f);
  } while (c != '\n');
}


x86 assembly (clang, -O0):
<oneline_comment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jne    111c <oneline_comment+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oneline_comment>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <getc@plt>
cmp    $0xa,%eax
jne    1120 <oneline_comment+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @oneline_comment(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @getc(i32* %0)
%4 = icmp eq i32 %3, 10
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}
/* Variables and functions */
scalar_t__ strlen(void *);
int /*<<< orphan*/ xdestroy(void *, size_t);
void xstrdestroy(void *ptr) {
  size_t mem;
  if (ptr != (void *)NULL) {
    mem = (size_t)((strlen(ptr)));
    xdestroy(ptr, mem);
  }
}


x86 assembly (clang, -O0):
<xstrdestroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1151 <xstrdestroy+0x31>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <xdestroy@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @xstrdestroy(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 i32 @xdestroy(i8* %0, i64 %4)
br label %6
6: ; preds = %3, %1
ret void
}
int main() {
  int N;
  printf("Enter the value of N: \n");
  scanf("%d", &N);
  int ans = ((N) * (N + 1) * (2 * N + 1)) / 6;
  printf("%d", ans);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%ecx
imul   %eax,%ecx
add    %eax,%eax
add    $0x1,%eax
imul   %ecx,%eax
cltq
imul   $0x2aaaaaab,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
shr    $0x20,%rsi
add    %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter the value of N: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 1
%9 = mul nsw i32 %6, %8
%10 = load i32, i32* %2
%11 = mul nsw i32 2, %10
%12 = add nsw i32 %11, 1
%13 = mul nsw i32 %9, %12
%14 = sdiv i32 %13, 6
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [23 x i8] c"Enter the value of N: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
%7 = mul nsw i32 %6, %5
%8 = shl nsw i32 %5, 1
%9 = or i32 %8, 1
%10 = mul nsw i32 %7, %9
%11 = sdiv i32 %10, 6
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}
prn(n) int n;
{
  register a;
  if (a = ldiv(0, n, 10))
    prn(a);
  putc(lrem(0, n, 10) + '0');
}


x86 assembly (clang, -O0):
<prn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
xor    %edi,%edi
mov    $0xa,%edx
mov    $0x0,%al
call   1050 <ldiv@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     1170 <prn+0x30>
mov    -0xc(%rbp),%edi
call   1030 <prn@plt>
mov    -0x8(%rbp),%esi
xor    %edi,%edi
mov    $0xa,%edx
mov    $0x0,%al
call   1060 <lrem@plt>
mov    %eax,%edi
add    $0x30,%edi
mov    $0x0,%al
call   1040 <putc@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prn>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
mov    %ebx,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1050 <ldiv@plt>
test   %eax,%eax
je     115e <prn+0x1e>
mov    %eax,%edi
call   1030 <prn@plt>
xor    %edi,%edi
mov    %ebx,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1060 <lrem@plt>
lea    0x30(%rax),%edi
xor    %eax,%eax
pop    %rbx
jmp    1040 <putc@plt>

LLVM IR (-O0):
define i32 @prn(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @ldiv to i32 (i32, i32, i32, ...)*)(i32 0, i32 %5, i32 10)
store i32 %6, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i32, i32* %4
%10 = call i32 @prn(i32 %9)
br label %11
11: ; preds = %8, %1
%12 = load i32, i32* %3
%13 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @lrem to i32 (i32, i32, i32, ...)*)(i32 0, i32 %12, i32 10)
%14 = add nsw i32 %13, 48
%15 = call i32 (i32, ...) bitcast (i32 (...)* @putc to i32 (i32, ...)*)(i32 %14)
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @prn(i32 %0) {
%2 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @ldiv to i32 (i32, i32, i32, ...)*)(i32 0, i32 %0, i32 10)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @prn(i32 %2)
br label %6
6: ; preds = %4, %1
%7 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @lrem to i32 (i32, i32, i32, ...)*)(i32 0, i32 %0, i32 10)
%8 = add nsw i32 %7, 48
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @putc to i32 (i32, ...)*)(i32 %8)
ret i32 undef
}
/* Variables and functions */
scalar_t__ uran();
int iran_sign() { return (int)uran(); }


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

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

LLVM IR (-O0):
define i32 @iran_sign() {
%1 = call i64 (...) @uran()
%2 = trunc i64 %1 to i32
ret i32 %2
}

LLVM IR (-O2):
define i32 @iran_sign() {
%1 = tail call i64 (...) @uran()
%2 = trunc i64 %1 to i32
ret i32 %2
}