xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ sx_set_mode(int);
void sx_sleep() { sx_set_mode(0x0); }


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

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

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

LLVM IR (-O2):
define void @sx_sleep() {
%1 = tail call i32 @sx_set_mode(i32 0)
ret void
}
void profil(unsigned short *buff, unsigned int bufsiz, unsigned int offset,
            unsigned int scale) {
  long __res;
  __asm__ __volatile__("int $0x80"
                       : "=a"(__res)
                       : "0"(98), "b"((long)(buff)), "c"((long)(bufsiz)),
                         "d"((long)(offset)), "S"((long)(scale)));
  return (void)__res;
}


x86 assembly (clang, -O0):
<profil>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rbx
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
mov    %eax,%edx
mov    -0x1c(%rbp),%eax
mov    %eax,%esi
mov    $0x62,%eax
int    $0x80
mov    %rax,-0x28(%rbp)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<profil>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
mov    %edx,%edx
mov    %ecx,%esi
mov    $0x62,%eax
mov    %rdi,%rcx
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
define void @profil(i16* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i16*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
store i16* %0, i16** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i16*, i16** %5
%11 = ptrtoint i16* %10 to i64
%12 = load i32, i32* %6
%13 = zext i32 %12 to i64
%14 = load i32, i32* %7
%15 = zext i32 %14 to i64
%16 = load i32, i32* %8
%17 = zext i32 %16 to i64
%18 = call i64 asm sideeffect "int $$0x80", "={ax},0,{bx},{cx},{dx},{si},~{dirflag},~{fpsr},~{flags}"(i64 98, i64 %11, i64 %13, i64 %15, i64 %17)
store i64 %18, i64* %9
%19 = load i64, i64* %9
ret void
}

LLVM IR (-O2):
define void @profil(i16* %0, i32 %1, i32 %2, i32 %3) {
%5 = ptrtoint i16* %0 to i64
%6 = zext i32 %1 to i64
%7 = zext i32 %2 to i64
%8 = zext i32 %3 to i64
%9 = tail call i64 asm sideeffect "int $$0x80", "={ax},0,{bx},{cx},{dx},{si},~{dirflag},~{fpsr},~{flags}"(i64 98, i64 %5, i64 %6, i64 %7, i64 %8)
ret void
}
/* Variables and functions */
int ece391_read(int, char *, int);
int read(int file, char *ptr, int len) { return ece391_read(file, ptr, len); }


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

x86 assembly (clang, -O2):
<read>:
jmp    1030 <ece391_read@plt>

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

LLVM IR (-O2):
define i32 @read(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @ece391_read(i32 %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Hello!"); }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"Hello!\00"
define void @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
double log(int);
double log2(double i) { return log(i) / log(2); }


x86 assembly (clang, -O0):
<log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0x2,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2>:
push   %rax
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1030 <log@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = call double @log(i32 %4)
%6 = call double @log(i32 2)
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @log2(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @log(i32 %2)
%4 = tail call double @log(i32 2)
%5 = fdiv double %3, %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void __gnat_raise_storage_error(void) { abort(); }


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

x86 assembly (clang, -O2):
<__gnat_raise_storage_error>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @__gnat_raise_storage_error() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @__gnat_raise_storage_error() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ test(char *);
int main(void) {
  test("C:\\Windows\\System and stuff/bah, foo, baz/kk");
  test("");
  test(".");
  test("/etc/group-by-things/1rf/a/f/b/e/2/xx");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [45 x i8] c"C:\\Windows\\System and stuff/bah, foo, baz/kk\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c".\00"
@.str.3 = [38 x i8] c"/etc/group-by-things/1rf/a/f/b/e/2/xx\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @test(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"C:\\Windows\\System and stuff/bah, foo, baz/kk\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c".\00"
@.str.3 = [38 x i8] c"/etc/group-by-things/1rf/a/f/b/e/2/xx\00"
define i32 @main() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @test(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @test(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double wtime() {
  struct timeval t;
  gettimeofday(&t, NULL);
  return (double)t.tv_sec + (double)t.tv_usec * 1E-6;
}


x86 assembly (clang, -O0):
<wtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wtime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @wtime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %9
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @wtime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %6)
ret double %10
}
long int labs(long int val) {
  if (val < 0) {
    return -val;
  }
  return val;
}


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1122 <labs+0x22>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112a <labs+0x2a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<labs>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void test_align(int len) {
  for (int i = 0; i < len; ++i) {
    putchar('.');
  }
}


x86 assembly (clang, -O0):
<test_align>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1146 <test_align+0x36>
mov    $0x2e,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <test_align+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_align>:
push   %rbx
test   %edi,%edi
jle    112f <test_align+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x2e,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <test_align+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @test_align(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 @putchar(i8 signext 46)
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @test_align(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @putchar(i8 signext 46)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
}
int dns_cache_submit(struct dns_packet *query __attribute__((unused)),
                     struct dns_cache *cache __attribute__((unused))) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.dns_packet = type opaque
%struct.dns_cache = type opaque
define i32 @dns_cache_submit(%struct.dns_packet* %0, %struct.dns_cache* %1) {
%3 = alloca %struct.dns_packet*
%4 = alloca %struct.dns_cache*
store %struct.dns_packet* %0, %struct.dns_packet** %3
store %struct.dns_cache* %1, %struct.dns_cache** %4
ret i32 0
}

LLVM IR (-O2):
%struct.dns_packet = type opaque
%struct.dns_cache = type opaque
define i32 @dns_cache_submit(%struct.dns_packet* nocapture readnone %0, %struct.dns_cache* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
scalar_t__ strlen(char *);
int ischarMatch(char *word, char lettre, int indice) {
  if ((int)strlen(word) <= indice)
    return 0;
  if (word[indice] == lettre)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ischarMatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x18(%rbp),%eax
jg     1143 <ischarMatch+0x33>
movl   $0x0,-0x4(%rbp)
jmp    116e <ischarMatch+0x5e>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jne    1167 <ischarMatch+0x57>
movl   $0x1,-0x4(%rbp)
jmp    116e <ischarMatch+0x5e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ischarMatch>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %ebp,%ecx
jle    1136 <ischarMatch+0x26>
movslq %ebp,%rcx
xor    %eax,%eax
cmp    %r14b,(%rbx,%rcx,1)
sete   %al
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ischarMatch(i8* nocapture %0, i8 signext %1, i32 %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = trunc i64 %4 to i32
%6 = icmp sgt i32 %5, %2
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = sext i32 %2 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, %1
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %7, %3
%14 = phi i32 [ 0, %3 ], [ %12, %7 ]
ret i32 %14
}
/* Type definitions */
struct vec4 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ vec4_snap(float *, float *, float *);
__attribute__((always_)) struct vec4 *
psvec4_snap(struct vec4 *result, struct vec4 *a, struct vec4 *b) {
  vec4_snap((float *)result, (float *)a, (float *)b);
  return result;
}


x86 assembly (clang, -O0):
<psvec4_snap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <vec4_snap@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec4_snap>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec4_snap@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec4 = type { i32 }
define %struct.vec4* @psvec4_snap(%struct.vec4* %0, %struct.vec4* %1, %struct.vec4* %2) {
%4 = alloca %struct.vec4*
%5 = alloca %struct.vec4*
%6 = alloca %struct.vec4*
store %struct.vec4* %0, %struct.vec4** %4
store %struct.vec4* %1, %struct.vec4** %5
store %struct.vec4* %2, %struct.vec4** %6
%7 = load %struct.vec4*, %struct.vec4** %4
%8 = bitcast %struct.vec4* %7 to float*
%9 = load %struct.vec4*, %struct.vec4** %5
%10 = bitcast %struct.vec4* %9 to float*
%11 = load %struct.vec4*, %struct.vec4** %6
%12 = bitcast %struct.vec4* %11 to float*
%13 = call i32 @vec4_snap(float* %8, float* %10, float* %12)
%14 = load %struct.vec4*, %struct.vec4** %4
ret %struct.vec4* %14
}

LLVM IR (-O2):
%struct.vec4 = type { i32 }
define %struct.vec4* @psvec4_snap(%struct.vec4* returned %0, %struct.vec4* %1, %struct.vec4* %2) {
%4 = bitcast %struct.vec4* %0 to float*
%5 = bitcast %struct.vec4* %1 to float*
%6 = bitcast %struct.vec4* %2 to float*
%7 = tail call i32 @vec4_snap(float* %4, float* %5, float* %6)
ret %struct.vec4* %0
}
unsigned long insert_ram(unsigned long insn, long value,
                         int dialect __attribute__((unused)),
                         const char **errmsg) {
  if ((unsigned long)value >= ((insn >> 21) & 0x1f))
    *errmsg = "index register in load range";
  return insn | ((value & 0x1f) << 16);
}


x86 assembly (clang, -O0):
<insert_ram>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
shr    $0x15,%rcx
and    $0x1f,%rcx
cmp    %rcx,%rax
jb     113a <insert_ram+0x3a>
mov    -0x20(%rbp),%rax
lea    0xec9(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x1f,%rcx
shl    $0x10,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_ram>:
mov    %rsi,%rax
mov    %edi,%edx
shr    $0x15,%edx
and    $0x1f,%edx
cmp    %rsi,%rdx
ja     111a <insert_ram+0x1a>
lea    0xee9(%rip),%rdx
mov    %rdx,(%rcx)
and    $0x1f,%eax
shl    $0x10,%rax
or     %rdi,%rax
ret

LLVM IR (-O0):
@.str = [29 x i8] c"index register in load range\00"
define i64 @insert_ram(i64 %0, i64 %1, i32 %2, i8** %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8**
store i64 %0, i64* %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i8** %3, i8*** %8
%9 = load i64, i64* %6
%10 = load i64, i64* %5
%11 = lshr i64 %10, 21
%12 = and i64 %11, 31
%13 = icmp uge i64 %9, %12
br i1 %13, label %14, label %16
14: ; preds = %4
%15 = load i8**, i8*** %8
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %15
br label %16
16: ; preds = %14, %4
%17 = load i64, i64* %5
%18 = load i64, i64* %6
%19 = and i64 %18, 31
%20 = shl i64 %19, 16
%21 = or i64 %17, %20
ret i64 %21
}

LLVM IR (-O2):
@.str = [29 x i8] c"index register in load range\00"
define i64 @insert_ram(i64 %0, i64 %1, i32 %2, i8** nocapture writeonly %3) {
%5 = lshr i64 %0, 21
%6 = and i64 %5, 31
%7 = icmp ugt i64 %6, %1
br i1 %7, label %9, label %8
8: ; preds = %4
store i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8** %3
br label %9
9: ; preds = %8, %4
%10 = shl i64 %1, 16
%11 = and i64 %10, 2031616
%12 = or i64 %11, %0
ret i64 %12
}
/* Variables and functions */
long rand();
long TestingRandom(long index, long total) { return rand(); }


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

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

LLVM IR (-O0):
define i64 @TestingRandom(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i64 (...) @rand()
ret i64 %5
}

LLVM IR (-O2):
define i64 @TestingRandom(i64 %0, i64 %1) {
%3 = tail call i64 (...) @rand()
ret i64 %3
}
/* Variables and functions */
int isnan(double const);
int gsl_isnan(const double x) { return isnan(x); }


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

x86 assembly (clang, -O2):
<gsl_isnan>:
jmp    1030 <isnan@plt>

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

LLVM IR (-O2):
define i32 @gsl_isnan(double %0) {
%2 = tail call i32 @isnan(double %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/ *);
void tga_write_byte(FILE *fp, uint8_t byte) { fputc(byte, fp); }


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

x86 assembly (clang, -O2):
<tga_write_byte>:
mov    %rdi,%rax
mov    %esi,%edi
mov    %rax,%rsi
jmp    1030 <fputc@plt>

LLVM IR (-O0):
define void @tga_write_byte(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = call i32 @fputc(i32 %5, i32* %6)
ret void
}

LLVM IR (-O2):
define void @tga_write_byte(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @fputc(i32 %1, i32* %0)
ret void
}
/* Variables and functions */
void *CommonAlloc(size_t);
void *HoloStor_TableAlloc(size_t size) { return CommonAlloc(size); }


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

x86 assembly (clang, -O2):
<HoloStor_TableAlloc>:
jmp    1030 <CommonAlloc@plt>

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

LLVM IR (-O2):
define i8* @HoloStor_TableAlloc(i64 %0) {
%2 = tail call i8* @CommonAlloc(i64 %0)
ret i8* %2
}
/* Type definitions */
typedef char int32_t;

/* Variables and functions */
int32_t convertCharToInt(char ch) {
  if (ch >= '0' && ch <= '9')
    return ch - '0';
  return 0;
}


x86 assembly (clang, -O0):
<convertCharToInt>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x30,%eax
jl     1133 <convertCharToInt+0x33>
movsbl -0x2(%rbp),%eax
cmp    $0x39,%eax
jg     1133 <convertCharToInt+0x33>
movsbl -0x2(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x1(%rbp)
jmp    1137 <convertCharToInt+0x37>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertCharToInt>:
add    $0xd0,%dil
xor    %ecx,%ecx
cmp    $0xa,%dil
movzbl %dil,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @convertCharToInt(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
%15 = trunc i32 %14 to i8
store i8 %15, i8* %2
br label %17
16: ; preds = %7, %1
store i8 0, i8* %2
br label %17
17: ; preds = %16, %11
%18 = load i8, i8* %2
ret i8 %18
}

LLVM IR (-O2):
define signext i8 @convertCharToInt(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = select i1 %3, i8 %2, i8 0
ret i8 %4
}
int next_triangle() {
  static int acc = 0;
  static int n = 1;
  return acc += n++;
}


x86 assembly (clang, -O0):
<next_triangle>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f16(%rip),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2f0b(%rip)
add    0x2f0d(%rip),%eax
mov    %eax,0x2f07(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_triangle>:
mov    0x2f1a(%rip),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x2f11(%rip)
add    0x2f13(%rip),%eax
mov    %eax,0x2f0d(%rip)
ret

LLVM IR (-O0):
@next_triangle.acc = internal global i32 0
@next_triangle.n = internal global i32 1
define i32 @next_triangle() {
%1 = load i32, i32* @next_triangle.n
%2 = add nsw i32 %1, 1
store i32 %2, i32* @next_triangle.n
%3 = load i32, i32* @next_triangle.acc
%4 = add nsw i32 %3, %1
store i32 %4, i32* @next_triangle.acc
ret i32 %4
}

LLVM IR (-O2):
@next_triangle.acc = internal unnamed_addr global i32 0
@next_triangle.n = internal unnamed_addr global i32 1
define i32 @next_triangle() {
%1 = load i32, i32* @next_triangle.n
%2 = add nsw i32 %1, 1
store i32 %2, i32* @next_triangle.n
%3 = load i32, i32* @next_triangle.acc
%4 = add nsw i32 %3, %1
store i32 %4, i32* @next_triangle.acc
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int);
int main() {
  int pass;
  printf("Enter a value here: ");
  scanf("%d", pass);
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"Enter a value here: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter a value here: \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 undef)
ret i32 0
}
/* Variables and functions */
void *malloc(int);
void *f14(int n) {
  if (n < 0)
    return ((void *)0);
  return malloc(n * sizeof(int));
}


x86 assembly (clang, -O0):
<f14>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1132 <f14+0x22>
movq   $0x0,-0x8(%rbp)
jmp    1145 <f14+0x35>
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f14>:
test   %edi,%edi
js     111c <f14+0xc>
shl    $0x2,%edi
jmp    1030 <malloc@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @f14(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* null, i8** %2
br label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 4
%11 = trunc i64 %10 to i32
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %2
br label %13
13: ; preds = %7, %6
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
define noalias i8* @f14(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = shl i32 %0, 2
%5 = tail call i8* @malloc(i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i8* [ %5, %3 ], [ null, %1 ]
ret i8* %7
}
int foo2(float a, float b) { return (a > b); }


x86 assembly (clang, -O0):
<foo2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
ucomiss -0x8(%rbp),%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo2>:
xor    %eax,%eax
ucomiss %xmm1,%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @foo2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ogt float %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @foo2(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ readFileDateTime(char *);
int /*<<< orphan*/ time(int /*<<< orphan*/);
int main() {
  time_t t = time(0);
  printf("open:%s\n", ctime(&t));
  readFileDateTime("../file.txt");
  t = time(0);
  printf("open:%s\n", ctime(&t));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <ctime@plt>
mov    %rax,%rsi
lea    0xe94(%rip),%rdi
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
call   1030 <readFileDateTime@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <ctime@plt>
mov    %rax,%rsi
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <ctime@plt>
lea    0xe9d(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
lea    0xe94(%rip),%rdi
call   1030 <readFileDateTime@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0x4(%rsp)
mov    %r14,%rdi
call   1040 <ctime@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"open:%s\0A\00"
@.str.1 = [12 x i8] c"../file.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @time(i32 0)
store i32 %3, i32* %2
%4 = call i8* @ctime(i32* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @readFileDateTime(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @time(i32 0)
store i32 %7, i32* %2
%8 = call i8* @ctime(i32* %2)
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"open:%s\0A\00"
@.str.1 = [12 x i8] c"../file.txt\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32 0)
store i32 %3, i32* %1
%4 = call i8* @ctime(i32* %1)
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @readFileDateTime(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @time(i32 0)
store i32 %7, i32* %1
%8 = call i8* @ctime(i32* %1)
%9 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ write(int, char const *, int);
void ft_putendl(const char *s) {
  int i;
  i = 0;
  while (s[i] != '\0') {
    write(1, &s[i], 1);
    i++;
  }
  write(1, "\n", 1);
}


x86 assembly (clang, -O0):
<ft_putendl>:
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     115d <ft_putendl+0x4d>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <ft_putendl+0x13>
mov    $0x1,%edx
lea    0xe97(%rip),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putendl>:
push   %rbx
cmpb   $0x0,(%rdi)
je     113c <ft_putendl+0x2c>
mov    %rdi,%rbx
nopl   0x0(%rax)
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
cmpb   $0x0,0x1(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <ft_putendl+0x10>
lea    0xebd(%rip),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @ft_putendl(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %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 %20
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 = call i32 @write(i32 1, i8* %16, i32 1)
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %4
20: ; preds = %4
%21 = call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @ft_putendl(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %9, %4 ], [ %0, %1 ]
%7 = tail call i32 @write(i32 1, i8* %6, i32 1)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 1)
ret void
}
int test_imm_40int8_mem(signed char *val) {
  return ((*val) & (0x40 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_40int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0x40,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_40int8_mem>:
testb  $0x40,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_40int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 64
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_40int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 64
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
float absvalue(float x) {
  if (x < 0.0)
    return -x;
  else
    return x;
}


x86 assembly (clang, -O0):
<absvalue>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    113b <absvalue+0x3b>
movss  -0x8(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1145 <absvalue+0x45>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<absvalue>:
movaps 0xef9(%rip),%xmm2
xorps  %xmm0,%xmm2
xorps  %xmm3,%xmm3
movaps %xmm0,%xmm1
cmpltss %xmm3,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @absvalue(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load float, float* %3
%9 = fneg float %8
store float %9, float* %2
br label %12
10: ; preds = %1
%11 = load float, float* %3
store float %11, float* %2
br label %12
12: ; preds = %10, %7
%13 = load float, float* %2
ret float %13
}

LLVM IR (-O2):
define float @absvalue(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %3, float %0
ret float %4
}
char *GJstrblank(char *string, int len) {
  --len;
  string[len] = '\0';
  --len;
  while (len > -1) {
    string[len] = ' ';
    --len;
  }
  return string;
}


x86 assembly (clang, -O0):
<GJstrblank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jle    114d <GJstrblank+0x4d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <GJstrblank+0x29>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GJstrblank>:
push   %rbx
mov    %rdi,%rbx
lea    -0x1(%rsi),%eax
movslq %eax,%rcx
movb   $0x0,(%rdi,%rcx,1)
cmp    $0x2,%esi
jl     1132 <GJstrblank+0x22>
mov    %eax,%edx
mov    %rbx,%rdi
mov    $0x20,%esi
call   1030 <memset@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @GJstrblank(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 = add nsw i32 %5, -1
store i32 %6, i32* %4
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %7, i64 %9
store i8 0, i8* %10
%11 = load i32, i32* %4
%12 = add nsw i32 %11, -1
store i32 %12, i32* %4
br label %13
13: ; preds = %16, %2
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, -1
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 32, i8* %20
%21 = load i32, i32* %4
%22 = add nsw i32 %21, -1
store i32 %22, i32* %4
br label %13
23: ; preds = %13
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
define i8* @GJstrblank(i8* returned writeonly %0, i32 %1) {
%3 = add i32 %1, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 0, i8* %5
%6 = icmp sgt i32 %1, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %2
ret i8* %0
}
/* Variables and functions */
int RAND_MAX;
int rand_r(unsigned int *);
int rand_lim(int limit, unsigned int *seedp) {
  int divisor;
  int retval;
  divisor = RAND_MAX / (limit + 1);
  do {
    retval = rand_r(seedp) / divisor;
  } while (retval > limit);
  return retval;
}


x86 assembly (clang, -O0):
<rand_lim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <rand_r@plt>
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1134 <rand_lim+0x24>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_lim>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x2ec8(%rip),%rax
mov    (%rax),%eax
lea    0x1(%rbx),%ecx
cltd
idiv   %ecx
mov    %eax,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <rand_r@plt>
cltd
idiv   %ebp
cmp    %ebx,%eax
jg     1130 <rand_lim+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @rand_lim(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32, i32* @RAND_MAX
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = sdiv i32 %7, %9
store i32 %10, i32* %5
br label %11
11: ; preds = %16, %2
%12 = load i32*, i32** %4
%13 = call i32 @rand_r(i32* %12)
%14 = load i32, i32* %5
%15 = sdiv i32 %13, %14
store i32 %15, i32* %6
br label %16
16: ; preds = %11
%17 = load i32, i32* %6
%18 = load i32, i32* %3
%19 = icmp sgt i32 %17, %18
br i1 %19, label %11, label %20
20: ; preds = %16
%21 = load i32, i32* %6
ret i32 %21
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @rand_lim(i32 %0, i32* %1) {
%3 = load i32, i32* @RAND_MAX
%4 = add nsw i32 %0, 1
%5 = sdiv i32 %3, %4
br label %6
6: ; preds = %6, %2
%7 = tail call i32 @rand_r(i32* %1)
%8 = sdiv i32 %7, %5
%9 = icmp sgt i32 %8, %0
br i1 %9, label %6, label %10
10: ; preds = %6
ret i32 %8
}
y(y) { return y; }


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

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

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

LLVM IR (-O2):
define i32 @y(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int euclides_mdc(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
void run_test() {
  int a, b;
  scanf("%d %d", &a, &b);
  printf("%d\n", euclides_mdc(a, b));
}


x86 assembly (clang, -O0):
<run_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <euclides_mdc@plt>
mov    %eax,%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_test>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <euclides_mdc@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @run_test() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @euclides_mdc(i32 %6, i32 %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
void USBDevDisconnect(uint32_t ui32Base) {
  ;
  (*((volatile unsigned char *)(ui32Base + 0x00000001))) &= (~0x00000040);
}


x86 assembly (clang, -O0):
<USBDevDisconnect>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
movzbl %cl,%ecx
and    $0xffffffbf,%ecx
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBDevDisconnect>:
andb   $0xbf,0x1(%rdi)
ret

LLVM IR (-O0):
define void @USBDevDisconnect(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 1
%5 = inttoptr i64 %4 to i8*
%6 = load volatile i8, i8* %5
%7 = zext i8 %6 to i32
%8 = and i32 %7, -65
%9 = trunc i32 %8 to i8
store volatile i8 %9, i8* %5
ret void
}

LLVM IR (-O2):
define void @USBDevDisconnect(i64 %0) {
%2 = add nsw i64 %0, 1
%3 = inttoptr i64 %2 to i8*
%4 = load volatile i8, i8* %3
%5 = and i8 %4, -65
store volatile i8 %5, i8* %3
ret void
}
/* Variables and functions */
int add(int, int);
int main() {
  int k;
  k = add(1, 3);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @add(i32 1, i32 3)
ret i32 0
}
/* Variables and functions */
char *update_buffer(int /*<<< orphan*/, int);
char *copy_str_to_buffer(char *str) {
  char *new_str = NULL;
  while (*str != '\0') {
    new_str = update_buffer(*str++, false);
    if (new_str == NULL)
      return NULL;
  }
  return new_str;
}


x86 assembly (clang, -O0):
<copy_str_to_buffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116e <copy_str_to_buffer+0x5e>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
xor    %esi,%esi
call   1030 <update_buffer@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1169 <copy_str_to_buffer+0x59>
movq   $0x0,-0x8(%rbp)
jmp    1176 <copy_str_to_buffer+0x66>
jmp    1124 <copy_str_to_buffer+0x14>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_str_to_buffer>:
push   %rbx
mov    (%rdi),%cl
test   %cl,%cl
je     113c <copy_str_to_buffer+0x2c>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %cl,%edi
xor    %esi,%esi
call   1030 <update_buffer@plt>
test   %rax,%rax
je     113c <copy_str_to_buffer+0x2c>
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1120 <copy_str_to_buffer+0x10>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @copy_str_to_buffer(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %7
4: ; preds = %7
%5 = load i8, i8* %11
%6 = icmp eq i8 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %11, %4 ], [ %0, %1 ]
%10 = sext i8 %8 to i32
%11 = getelementptr inbounds i8, i8* %9, i64 1
%12 = tail call i8* @update_buffer(i32 %10, i32 0)
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %4
14: ; preds = %7, %4, %1
%15 = phi i8* [ null, %1 ], [ %12, %4 ], [ null, %7 ]
ret i8* %15
}