xunge/DecIR huggingface dataset:
/* Variables and functions */
int pow(int, int);
int validInput(int n, int size) {
  if (n > (pow(2, size) - 1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<validInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    114d <validInput+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1154 <validInput+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validInput>:
push   %rbx
mov    %edi,%ebx
mov    $0x2,%edi
call   1030 <pow@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setle  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @validInput(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* %4
%7 = load i32, i32* %5
%8 = call i32 @pow(i32 2, i32 %7)
%9 = sub nsw i32 %8, 1
%10 = icmp sgt i32 %6, %9
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @validInput(i32 %0, i32 %1) {
%3 = tail call i32 @pow(i32 2, i32 %1)
%4 = icmp sle i32 %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
void drflac__cpuid(int info[4], int fid) {
  __asm__ __volatile__("cpuid"
                       : "=a"(info[0]), "=b"(info[1]), "=c"(info[2]),
                         "=d"(info[3])
                       : "a"(fid), "c"(0));
}


x86 assembly (clang, -O0):
<drflac__cpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%r8
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
xor    %ecx,%ecx
cpuid
mov    %eax,%r9d
mov    -0x28(%rbp),%rax
mov    %ecx,%esi
mov    -0x20(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,0x4(%rdi)
mov    %esi,0x8(%rcx)
mov    %edx,0xc(%rax)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<drflac__cpuid>:
push   %rbx
mov    %esi,%eax
xor    %ecx,%ecx
cpuid
mov    %eax,(%rdi)
mov    %ebx,0x4(%rdi)
mov    %ecx,0x8(%rdi)
mov    %edx,0xc(%rdi)
pop    %rbx
ret

LLVM IR (-O0):
define void @drflac__cpuid(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 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 2
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 3
%13 = load i32, i32* %4
%14 = call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %13, i32 0)
%15 = extractvalue { i32, i32, i32, i32 } %14, 0
%16 = extractvalue { i32, i32, i32, i32 } %14, 1
%17 = extractvalue { i32, i32, i32, i32 } %14, 2
%18 = extractvalue { i32, i32, i32, i32 } %14, 3
store i32 %15, i32* %6
store i32 %16, i32* %8
store i32 %17, i32* %10
store i32 %18, i32* %12
ret void
}

LLVM IR (-O2):
define void @drflac__cpuid(i32* nocapture writeonly %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = getelementptr inbounds i32, i32* %0, i64 2
%5 = getelementptr inbounds i32, i32* %0, i64 3
%6 = tail call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},{ax},{cx},~{dirflag},~{fpsr},~{flags}"(i32 %1, i32 0)
%7 = extractvalue { i32, i32, i32, i32 } %6, 0
%8 = extractvalue { i32, i32, i32, i32 } %6, 1
%9 = extractvalue { i32, i32, i32, i32 } %6, 2
%10 = extractvalue { i32, i32, i32, i32 } %6, 3
store i32 %7, i32* %0
store i32 %8, i32* %3
store i32 %9, i32* %4
store i32 %10, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void MPPETermOutput(void *v) { free(v); }


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

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

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

LLVM IR (-O2):
define void @MPPETermOutput(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
void *string_dup(char *);
void *mcsp_rawnamenode_hook_copy(void *hook) {
  char *rawname = (char *)hook;
  if (rawname) {
    return string_dup(rawname);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<mcsp_rawnamenode_hook_copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1141 <mcsp_rawnamenode_hook_copy+0x31>
mov    -0x18(%rbp),%rdi
call   1030 <string_dup@plt>
mov    %rax,-0x8(%rbp)
jmp    1149 <mcsp_rawnamenode_hook_copy+0x39>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mcsp_rawnamenode_hook_copy>:
test   %rdi,%rdi
je     111a <mcsp_rawnamenode_hook_copy+0xa>
jmp    1030 <string_dup@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @mcsp_rawnamenode_hook_copy(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @string_dup(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
/* Variables and functions */
int binIndex(char *);
char bin(char *g) { return *(g + binIndex(g)); }


x86 assembly (clang, -O0):
<bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <binIndex@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin>:
push   %rbx
mov    %rdi,%rbx
call   1030 <binIndex@plt>
cltq
mov    (%rbx,%rax,1),%al
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @bin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @binIndex(i8* %4)
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %3, i64 %6
%8 = load i8, i8* %7
ret i8 %8
}

LLVM IR (-O2):
define signext i8 @bin(i8* %0) {
%2 = tail call i32 @binIndex(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
void LPCChannelConfigMBSet(unsigned long ulBase, unsigned long ulChannel,
                           unsigned long ulConfig, unsigned long ulAddress,
                           unsigned long ulOffset) {
  ;
  ;

  ;
  ;

  ;
  ulConfig |= (((ulOffset >> 1) << 5) & 0x00003FE0);
  ulConfig |= 0x00000001;
  (*((volatile unsigned long *)(ulBase + 0x00000010 + (ulChannel * 0x10)))) =
      ulConfig;
  (*((volatile unsigned long *)(ulBase + 0x00000018 + (ulChannel * 0x10)))) =
      ulAddress;
}


x86 assembly (clang, -O0):
<LPCChannelConfigMBSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rax
shr    $0x1,%rax
shl    $0x5,%rax
and    $0x3fe0,%rax
or     -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
or     $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    -0x10(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    $0x18,%rax
mov    -0x10(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<LPCChannelConfigMBSet>:
shl    $0x4,%r8d
and    $0x3fe0,%r8d
or     %rdx,%r8
or     $0x1,%r8
shl    $0x4,%rsi
mov    %r8,0x10(%rsi,%rdi,1)
mov    %rcx,0x18(%rsi,%rdi,1)
ret

LLVM IR (-O0):
define void @LPCChannelConfigMBSet(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i64 %0, i64* %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i64 %3, i64* %9
store i64 %4, i64* %10
%11 = load i64, i64* %10
%12 = lshr i64 %11, 1
%13 = shl i64 %12, 5
%14 = and i64 %13, 16352
%15 = load i64, i64* %8
%16 = or i64 %15, %14
store i64 %16, i64* %8
%17 = load i64, i64* %8
%18 = or i64 %17, 1
store i64 %18, i64* %8
%19 = load i64, i64* %8
%20 = load i64, i64* %6
%21 = add i64 %20, 16
%22 = load i64, i64* %7
%23 = mul i64 %22, 16
%24 = add i64 %21, %23
%25 = inttoptr i64 %24 to i64*
store volatile i64 %19, i64* %25
%26 = load i64, i64* %9
%27 = load i64, i64* %6
%28 = add i64 %27, 24
%29 = load i64, i64* %7
%30 = mul i64 %29, 16
%31 = add i64 %28, %30
%32 = inttoptr i64 %31 to i64*
store volatile i64 %26, i64* %32
ret void
}

LLVM IR (-O2):
define void @LPCChannelConfigMBSet(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4) {
%6 = shl i64 %4, 4
%7 = and i64 %6, 16352
%8 = or i64 %7, %2
%9 = or i64 %8, 1
%10 = shl i64 %1, 4
%11 = add i64 %10, %0
%12 = add i64 %11, 16
%13 = inttoptr i64 %12 to i64*
store volatile i64 %9, i64* %13
%14 = add i64 %11, 24
%15 = inttoptr i64 %14 to i64*
store volatile i64 %3, i64* %15
ret void
}
void ASN1_BMPSTRING_free(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_BMPSTRING_free() {
ret void
}
/* Variables and functions */
int f(int);
int main() {
  int i = f(6);
  int *j, *k;
  int A[12];
  int *t;
  (*(t = A)) = *t + 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%edi
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
mov    -0x58(%rbp),%rax
mov    (%rax),%eax
add    $0x1,%eax
lea    -0x50(%rbp),%rcx
mov    %rcx,-0x58(%rbp)
mov    %eax,-0x50(%rbp)
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x6,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca [12 x i32]
%6 = alloca i32*
store i32 0, i32* %1
%7 = call i32 @f(i32 6)
store i32 %7, i32* %2
%8 = load i32*, i32** %6
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
%11 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 0
store i32* %11, i32** %6
store i32 %10, i32* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ scalar_product(double *, double *, int);
double sqrt(int /*<<< orphan*/);
double euclidean_norm(double x[], int n) {
  return sqrt(scalar_product(x, x, n));
}


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

x86 assembly (clang, -O2):
<euclidean_norm>:
push   %rax
mov    %esi,%edx
mov    %rdi,%rsi
call   1030 <scalar_product@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @euclidean_norm(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 double*, double** %3
%7 = load i32, i32* %4
%8 = call i32 @scalar_product(double* %5, double* %6, i32 %7)
%9 = call double @sqrt(i32 %8)
ret double %9
}

LLVM IR (-O2):
define double @euclidean_norm(double* %0, i32 %1) {
%3 = tail call i32 @scalar_product(double* %0, double* %0, i32 %1)
%4 = tail call double @sqrt(i32 %3)
ret double %4
}
/* Variables and functions */
char *corta_string(char *);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int main(void) {
  char *s = "Campos verdes";
  int numcar = 0;
  numcar = strlen(s);
  if (numcar > 0) {
    s = corta_string(s);
    printf("%s\n", s);
  } else
    printf("Error:Tiene menos de un caracter Â\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    118b <main+0x5b>
mov    -0x10(%rbp),%rdi
call   1050 <corta_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1199 <main+0x69>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1152 <main+0x22>
lea    0xeb8(%rip),%rdi
call   1050 <corta_string@plt>
mov    %rax,%rdi
jmp    1159 <main+0x29>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Campos verdes\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [37 x i8] c"Error:Tiene menos de un caracter \C3\82\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
store i32 0, i32* %3
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0
%9 = load i8*, i8** %2
%10 = call i8* @corta_string(i8* %9)
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Campos verdes\00"
@str = [36 x i8] c"Error:Tiene menos de un caracter \C3\82\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = icmp sgt i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i8* @corta_string(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
%6 = phi i8* [ %4, %3 ], [ getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0), %0 ]
%7 = tail call i32 @puts(i8* dereferenceable(1) %6)
ret i32 0
}
void early_boot_irqs_off(void) {}


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

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

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

LLVM IR (-O2):
define void @early_boot_irqs_off() {
ret void
}
void __attribute__((weak)) arm64_cpu_early_setup(void) {}


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

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

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

LLVM IR (-O2):
define weak void @arm64_cpu_early_setup() {
ret void
}
int countchans() { return 0; }


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

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

LLVM IR (-O0):
define i32 @countchans() {
ret i32 0
}

LLVM IR (-O2):
define i32 @countchans() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ CMD_INIT();
int main() { CMD_INIT(); }


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @CMD_INIT()
ret i32 0
}
double ml_div(double n1, double n2) { return n1 / n2; }


x86 assembly (clang, -O0):
<ml_div>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ml_div>:
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ml_div(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @ml_div(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void st_u8_be(void *x, uint8_t u) { ((uint8_t *)x)[0] = u; }


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

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

LLVM IR (-O0):
define void @st_u8_be(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @st_u8_be(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void f() { exit(0); }


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

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

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

LLVM IR (-O2):
define void @f() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
float swapbytes_float(float f) {
  union {
    float f;
    char b[sizeof(float)];
  } in, out;
  int i;
  in.f = f;
  for (i = 0; i < sizeof(float); i++) {
    out.b[i] = in.b[sizeof(float) - i - 1];
  }
  return out.f;
}


x86 assembly (clang, -O0):
<swapbytes_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x4,%rax
jae    1152 <swapbytes_float+0x52>
movslq -0x14(%rbp),%rcx
mov    $0x4,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    -0x8(%rbp,%rax,1),%cl
movslq -0x14(%rbp),%rax
mov    %cl,-0x10(%rbp,%rax,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111a <swapbytes_float+0x1a>
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapbytes_float>:
movd   %xmm0,%eax
bswap  %eax
movd   %eax,%xmm0
ret

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

LLVM IR (-O2):
define float @swapbytes_float(float %0) {
%2 = bitcast float %0 to i32
%3 = call i32 @llvm.bswap.i32(i32 %2)
%4 = bitcast i32 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main(void) {
  char a = 'a';
  printf("%c\n", a);
  printf("%d\n", a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x61,-0x1(%rbp)
lea    0xedd(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8 signext 97)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8 signext 97)
ret i32 0
}
float foo(float x, float y) {
  volatile int i = 0;
  return i <= 0 ? x : y;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    $0x0,%eax
jg     1130 <foo+0x30>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    113a <foo+0x3a>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movl   $0x0,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
jle    1112 <foo+0x12>
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @foo(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
store float %0, float* %3
store float %1, float* %4
store volatile i32 0, i32* %5
%6 = load volatile i32, i32* %5
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load float, float* %3
br label %12
10: ; preds = %2
%11 = load float, float* %4
br label %12
12: ; preds = %10, %8
%13 = phi float [ %9, %8 ], [ %11, %10 ]
ret float %13
}

LLVM IR (-O2):
define float @foo(float %0, float %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store volatile i32 0, i32* %3
%5 = load volatile i32, i32* %3
%6 = icmp slt i32 %5, 1
%7 = select i1 %6, float %0, float %1
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ pmu_adc_enable();
int /*<<< orphan*/ pmu_adc_reset_setting();
int /*<<< orphan*/ pmu_reg_write(int, int);
int /*<<< orphan*/ pmu_set_clk_init();
void pmu_init() {
  pmu_set_clk_init();
  pmu_reg_write(0x45, ((0x00 << 9) | (0x00 << 8) | (0x48 << 0)));
  pmu_reg_write(0x3A,
                ((1 << 20) | (0 << 19) | (1 << 13) | (1 << 12) | (1 << 11)));
  pmu_adc_reset_setting();
  pmu_adc_enable();
}


x86 assembly (clang, -O0):
<pmu_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <pmu_set_clk_init@plt>
mov    $0x45,%edi
mov    $0x48,%esi
call   1030 <pmu_reg_write@plt>
mov    $0x3a,%edi
mov    $0x103800,%esi
call   1030 <pmu_reg_write@plt>
mov    $0x0,%al
call   1050 <pmu_adc_reset_setting@plt>
mov    $0x0,%al
call   1040 <pmu_adc_enable@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmu_init>:
push   %rax
xor    %eax,%eax
call   1060 <pmu_set_clk_init@plt>
mov    $0x45,%edi
mov    $0x48,%esi
call   1030 <pmu_reg_write@plt>
mov    $0x3a,%edi
mov    $0x103800,%esi
call   1030 <pmu_reg_write@plt>
xor    %eax,%eax
call   1050 <pmu_adc_reset_setting@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <pmu_adc_enable@plt>

LLVM IR (-O0):
define void @pmu_init() {
%1 = call i32 (...) @pmu_set_clk_init()
%2 = call i32 @pmu_reg_write(i32 69, i32 72)
%3 = call i32 @pmu_reg_write(i32 58, i32 1062912)
%4 = call i32 (...) @pmu_adc_reset_setting()
%5 = call i32 (...) @pmu_adc_enable()
ret void
}

LLVM IR (-O2):
define void @pmu_init() {
%1 = tail call i32 (...) @pmu_set_clk_init()
%2 = tail call i32 @pmu_reg_write(i32 69, i32 72)
%3 = tail call i32 @pmu_reg_write(i32 58, i32 1062912)
%4 = tail call i32 (...) @pmu_adc_reset_setting()
%5 = tail call i32 (...) @pmu_adc_enable()
ret void
}
/* Variables and functions */
char *getenv(char *);
char *getUserName() {
  char *p = getenv("USER");
  if (p == NULL) {
    return "";
  } else {
    return p;
  }
}


x86 assembly (clang, -O0):
<getUserName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <getUserName+0x33>
lea    0xeca(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114b <getUserName+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getUserName>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
lea    0xedd(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"USER\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @getUserName() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %0
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %9
7: ; preds = %0
%8 = load i8*, i8** %2
store i8* %8, i8** %1
br label %9
9: ; preds = %7, %6
%10 = load i8*, i8** %1
ret i8* %10
}

LLVM IR (-O2):
@.str = [5 x i8] c"USER\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @getUserName() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
%3 = select i1 %2, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %1
ret i8* %3
}
void GaussCol_C() {}


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

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

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

LLVM IR (-O2):
define void @GaussCol_C() {
ret void
}
/* Type definitions */
struct network {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ irc_send_raw(struct network *, char *, char const *, ...);
void irc_part(struct network *net, const char *chan, const char *msg) {
  if (msg)
    irc_send_raw(net, "PART %s :%s", chan, msg);
  else
    irc_send_raw(net, "PART %s", chan);
}


x86 assembly (clang, -O0):
<irc_part>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114e <irc_part+0x3e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xebe(%rip),%rsi
mov    $0x0,%al
call   1030 <irc_send_raw@plt>
jmp    1164 <irc_part+0x54>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeaf(%rip),%rsi
mov    $0x0,%al
call   1030 <irc_send_raw@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_part>:
mov    %rdx,%rcx
mov    %rsi,%rdx
test   %rcx,%rcx
je     1129 <irc_part+0x19>
lea    0xede(%rip),%rsi
xor    %eax,%eax
jmp    1030 <irc_send_raw@plt>
lea    0xedc(%rip),%rsi
xor    %eax,%eax
jmp    1030 <irc_send_raw@plt>

LLVM IR (-O0):
%struct.network = type { i32 }
@.str = [12 x i8] c"PART %s :%s\00"
@.str.1 = [8 x i8] c"PART %s\00"
define void @irc_part(%struct.network* %0, i8* %1, i8* %2) {
%4 = alloca %struct.network*
%5 = alloca i8*
%6 = alloca i8*
store %struct.network* %0, %struct.network** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load %struct.network*, %struct.network** %4
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = call i32 (%struct.network*, i8*, i8*, ...) @irc_send_raw(%struct.network* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
br label %18
14: ; preds = %3
%15 = load %struct.network*, %struct.network** %4
%16 = load i8*, i8** %5
%17 = call i32 (%struct.network*, i8*, i8*, ...) @irc_send_raw(%struct.network* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %14, %9
ret void
}

LLVM IR (-O2):
%struct.network = type { i32 }
@.str = [12 x i8] c"PART %s :%s\00"
@.str.1 = [8 x i8] c"PART %s\00"
define void @irc_part(%struct.network* %0, i8* %1, i8* %2) {
%4 = icmp eq i8* %2, null
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 (%struct.network*, i8*, i8*, ...) @irc_send_raw(%struct.network* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
br label %9
7: ; preds = %3
%8 = tail call i32 (%struct.network*, i8*, i8*, ...) @irc_send_raw(%struct.network* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %9
9: ; preds = %7, %5
ret void
}
void open_streams() {}


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

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

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

LLVM IR (-O2):
define void @open_streams() {
ret void
}
/* Type definitions */
struct iovec {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ syscall(int);
ssize_t test_process_vm_writev(pid_t pid, const struct iovec *lvec,
                               unsigned long liovcnt, const struct iovec *rvec,
                               unsigned long riovcnt, unsigned long flags) {
  return syscall(-1);
}


x86 assembly (clang, -O0):
<test_process_vm_writev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    $0xffffffff,%edi
call   1030 <syscall@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_process_vm_writev>:
mov    $0xffffffff,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.iovec = type { i32 }
define i32 @test_process_vm_writev(i32 %0, %struct.iovec* %1, i64 %2, %struct.iovec* %3, i64 %4, i64 %5) {
%7 = alloca i32
%8 = alloca %struct.iovec*
%9 = alloca i64
%10 = alloca %struct.iovec*
%11 = alloca i64
%12 = alloca i64
store i32 %0, i32* %7
store %struct.iovec* %1, %struct.iovec** %8
store i64 %2, i64* %9
store %struct.iovec* %3, %struct.iovec** %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%13 = call i32 @syscall(i32 -1)
ret i32 %13
}

LLVM IR (-O2):
%struct.iovec = type { i32 }
define i32 @test_process_vm_writev(i32 %0, %struct.iovec* nocapture readnone %1, i64 %2, %struct.iovec* nocapture readnone %3, i64 %4, i64 %5) {
%7 = tail call i32 @syscall(i32 -1)
ret i32 %7
}
/* Variables and functions */
int EXIT_SUCCESS;
int main(int argc, char **argv, char **envp) { return EXIT_SUCCESS; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ec3(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
void up_and_down(int n) {
  printf("Level %d: n location %#x\n", n, &n);
  if (n < 4)
    up_and_down(n + 1);
  printf("Level %d: n location %#p\n", n, &n);
}


x86 assembly (clang, -O0):
<up_and_down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
lea    -0x4(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x4,-0x4(%rbp)
jge    1155 <up_and_down+0x35>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1040 <up_and_down@plt>
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
lea    -0x4(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<up_and_down>:
push   %rax
mov    %edi,%esi
mov    %edi,0x4(%rsp)
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
cmp    $0x3,%esi
jg     1151 <up_and_down+0x31>
add    $0x1,%esi
mov    %esi,%edi
call   1040 <up_and_down@plt>
mov    0x4(%rsp),%esi
lea    0xec2(%rip),%rdi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Level %d: n location %#x\0A\00"
@.str.1 = [26 x i8] c"Level %d: n location %#p\0A\00"
define void @up_and_down(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %2)
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 4
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, 1
br label %10
10: ; preds = %7, %1
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32* %2)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Level %d: n location %#x\0A\00"
@.str.1 = [26 x i8] c"Level %d: n location %#p\0A\00"
define void @up_and_down(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0, i32* %2)
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = add nsw i32 %4, 1
%8 = load i32, i32* %2
br label %9
9: ; preds = %6, %1
%10 = phi i32 [ %8, %6 ], [ %4, %1 ]
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ c3(int);
void c2(int i) { c3(i * 3); }


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

x86 assembly (clang, -O2):
<c2>:
lea    (%rdi,%rdi,2),%edi
jmp    1030 <c3@plt>

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

LLVM IR (-O2):
define void @c2(i32 %0) {
%2 = mul nsw i32 %0, 3
%3 = tail call i32 @c3(i32 %2)
ret void
}
/* Variables and functions */
double cos(double);
double sin(double);
double tan(double x) { return sin(x) / cos(x); }


x86 assembly (clang, -O0):
<tan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tan>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @tan(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @sin(double %3)
%5 = load double, double* %2
%6 = call double @cos(double %5)
%7 = fdiv double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @tan(double %0) {
%2 = tail call double @sin(double %0)
%3 = tail call double @cos(double %0)
%4 = fdiv double %2, %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ LCD4Bit_commandWrite(int);
int /*<<< orphan*/ LCD4Bit_delay(int);
void LCD4Bit_leftScroll(int num_chars, int delay_time) {
  for (int i = 0; i < num_chars; i++) {
    LCD4Bit_commandWrite(0x18);
    LCD4Bit_delay(delay_time);
  }
}


x86 assembly (clang, -O0):
<LCD4Bit_leftScroll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1161 <LCD4Bit_leftScroll+0x41>
mov    $0x18,%edi
call   1030 <LCD4Bit_commandWrite@plt>
mov    -0x8(%rbp),%edi
call   1040 <LCD4Bit_delay@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1135 <LCD4Bit_leftScroll+0x15>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD4Bit_leftScroll>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    1146 <LCD4Bit_leftScroll+0x26>
mov    %esi,%ebx
mov    %edi,%ebp
nopl   0x0(%rax,%rax,1)
mov    $0x18,%edi
call   1030 <LCD4Bit_commandWrite@plt>
mov    %ebx,%edi
call   1040 <LCD4Bit_delay@plt>
add    $0xffffffff,%ebp
jne    1130 <LCD4Bit_leftScroll+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @LCD4Bit_leftScroll(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 = %14, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = call i32 @LCD4Bit_commandWrite(i32 24)
%12 = load i32, i32* %4
%13 = call i32 @LCD4Bit_delay(i32 %12)
br label %14
14: ; preds = %10
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @LCD4Bit_leftScroll(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %5, label %4
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i32 [ %9, %5 ], [ 0, %2 ]
%7 = tail call i32 @LCD4Bit_commandWrite(i32 24)
%8 = tail call i32 @LCD4Bit_delay(i32 %1)
%9 = add nuw nsw i32 %6, 1
%10 = icmp eq i32 %9, %0
br i1 %10, label %4, label %5
}
/* Variables and functions */
int /*<<< orphan*/ free(unsigned char *);
scalar_t__ malloc(int);
int send_msg(int, unsigned char *, int);
int /*<<< orphan*/ sprintf(char *, char *, double);
int send_disconnect(int socket, double delay) {
  unsigned char *buffer = (unsigned char *)malloc(100 * sizeof(unsigned char));
  sprintf((char *)buffer, "%.3f", delay);
  int bytes_sent = send_msg(socket, buffer, 3);
  free(buffer);
  return bytes_sent;
}


x86 assembly (clang, -O0):
<send_disconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
lea    0xe92(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x3,%edx
call   1050 <send_msg@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_disconnect>:
push   %rbp
push   %rbx
push   %rax
movsd  %xmm0,(%rsp)
mov    %edi,%ebp
mov    $0x64,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xea2(%rip),%rsi
mov    %rax,%rdi
movsd  (%rsp),%xmm0
call   1060 <sprintf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1050 <send_msg@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.3f\00"
define i32 @send_disconnect(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %3
store double %1, double* %4
%7 = call i64 @malloc(i32 100)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load double, double* %4
%11 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %10)
%12 = load i32, i32* %3
%13 = load i8*, i8** %5
%14 = call i32 @send_msg(i32 %12, i8* %13, i32 3)
store i32 %14, i32* %6
%15 = load i8*, i8** %5
%16 = call i32 @free(i8* %15)
%17 = load i32, i32* %6
ret i32 %17
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.3f\00"
define i32 @send_disconnect(i32 %0, double %1) {
%3 = tail call i64 @malloc(i32 100)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %1)
%6 = tail call i32 @send_msg(i32 %0, i8* %4, i32 3)
%7 = tail call i32 @free(i8* %4)
ret i32 %6
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int64_t __ROUND_DOWN(int64_t num, int64_t align) {
  if (align == 0) {
    return num;
  }
  return (num - (num % align));
}


x86 assembly (clang, -O0):
<__ROUND_DOWN>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    111f <__ROUND_DOWN+0x1f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1134 <__ROUND_DOWN+0x34>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    -0x10(%rbp),%eax
sub    %edx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ROUND_DOWN>:
test   %esi,%esi
je     110b <__ROUND_DOWN+0xb>
mov    %edi,%eax
cltd
idiv   %esi
sub    %edx,%edi
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @__ROUND_DOWN(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 eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %4
store i32 %9, i32* %3
br label %16
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = srem i32 %12, %13
%15 = sub nsw i32 %11, %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 @__ROUND_DOWN(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = srem i32 %0, %1
%6 = sub nsw i32 %0, %5
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ %6, %4 ], [ %0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void limpaTela() { system("clear"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
define void @limpaTela() {
%1 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @limpaTela() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clear_screen() { printf("\033[2J\033[1;1H"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
define void @clear_screen() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
define void @clear_screen() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
char *read_number(char *s, long long int *n) {
  *n = 0;
  while (*s >= '0' && *s <= '9') {
    *n *= 10;
    *n += *s - '0';
    s++;
  }
  return s;
}


x86 assembly (clang, -O0):
<read_number>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x11(%rbp)
jl     113c <read_number+0x3c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    114c <read_number+0x4c>
jmp    117f <read_number+0x7f>
mov    -0x10(%rbp),%rax
imul   $0xa,(%rax),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
movslq %eax,%rcx
mov    -0x10(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1117 <read_number+0x17>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_number>:
mov    %rdi,%rax
movq   $0x0,(%rsi)
mov    (%rdi),%cl
add    $0xd0,%cl
cmp    $0x9,%cl
ja     1148 <read_number+0x48>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
add    %rcx,%rcx
lea    (%rcx,%rcx,4),%rcx
mov    %rcx,(%rsi)
movsbq (%rax),%rdx
add    %rdx,%rcx
add    $0xffffffffffffffd0,%rcx
mov    %rcx,(%rsi)
movzbl 0x1(%rax),%edx
add    $0x1,%rax
add    $0xd0,%dl
cmp    $0xa,%dl
jb     1120 <read_number+0x20>
ret

LLVM IR (-O0):
define i8* @read_number(i8* %0, i64* %1) {
%3 = alloca i8*
%4 = alloca i64*
store i8* %0, i8** %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
store i64 0, i64* %5
br label %6
6: ; preds = %18, %2
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 48
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp sle i32 %14, 57
br label %16
16: ; preds = %11, %6
%17 = phi i1 [ false, %6 ], [ %15, %11 ]
br i1 %17, label %18, label %32
18: ; preds = %16
%19 = load i64*, i64** %4
%20 = load i64, i64* %19
%21 = mul nsw i64 %20, 10
store i64 %21, i64* %19
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = sub nsw i32 %24, 48
%26 = sext i32 %25 to i64
%27 = load i64*, i64** %4
%28 = load i64, i64* %27
%29 = add nsw i64 %28, %26
store i64 %29, i64* %27
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
br label %6
32: ; preds = %16
%33 = load i8*, i8** %3
ret i8* %33
}

LLVM IR (-O2):
define i8* @read_number(i8* %0, i64* nocapture %1) {
store i64 0, i64* %1
%3 = load i8, i8* %0
%4 = add i8 %3, -48
%5 = icmp ult i8 %4, 10
br i1 %5, label %6, label %18
6: ; preds = %2, %6
%7 = phi i64 [ %13, %6 ], [ 0, %2 ]
%8 = phi i8* [ %14, %6 ], [ %0, %2 ]
%9 = mul nsw i64 %7, 10
store i64 %9, i64* %1
%10 = load i8, i8* %8
%11 = sext i8 %10 to i64
%12 = add i64 %9, -48
%13 = add i64 %12, %11
store i64 %13, i64* %1
%14 = getelementptr inbounds i8, i8* %8, i64 1
%15 = load i8, i8* %14
%16 = add i8 %15, -48
%17 = icmp ult i8 %16, 10
br i1 %17, label %6, label %18
18: ; preds = %6, %2
%19 = phi i8* [ %0, %2 ], [ %14, %6 ]
ret i8* %19
}