xunge/DecIR huggingface dataset:
/* Type definitions */
struct timespec {
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ get_mono(struct timespec *);
unsigned monotonic_sec(void) {
  struct timespec ts;
  get_mono(&ts);
  return ts.tv_sec;
}


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

x86 assembly (clang, -O2):
<monotonic_sec>:
push   %rax
mov    %rsp,%rdi
call   1030 <get_mono@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
define i32 @monotonic_sec() {
%1 = alloca %struct.timespec
%2 = call i32 @get_mono(%struct.timespec* %1)
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%4 = load i32, i32* %3
ret i32 %4
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
define i32 @monotonic_sec() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = call i32 @get_mono(%struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int divisors_count(int);
void divisors_count_test(void) {
  assert(divisors_count(1) == 1);
  assert(divisors_count(2) == 2);
  assert(divisors_count(9) == 3);
  assert(divisors_count(-9) == 3);
}


x86 assembly (clang, -O0):
<divisors_count_test>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <divisors_count@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x2,%edi
call   1030 <divisors_count@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x9,%edi
call   1030 <divisors_count@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0xfffffff7,%edi
call   1030 <divisors_count@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<divisors_count_test>:
push   %rax
mov    $0x1,%edi
call   1030 <divisors_count@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0x2,%edi
call   1030 <divisors_count@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0x9,%edi
call   1030 <divisors_count@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <assert@plt>
mov    $0xfffffff7,%edi
call   1030 <divisors_count@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
pop    %rax
jmp    1040 <assert@plt>

LLVM IR (-O0):
define void @divisors_count_test() {
%1 = call i32 @divisors_count(i32 1)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = call i32 @assert(i32 %3)
%5 = call i32 @divisors_count(i32 2)
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = call i32 @divisors_count(i32 9)
%10 = icmp eq i32 %9, 3
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i32 @divisors_count(i32 -9)
%14 = icmp eq i32 %13, 3
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
ret void
}

LLVM IR (-O2):
define void @divisors_count_test() {
%1 = tail call i32 @divisors_count(i32 1)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @divisors_count(i32 2)
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32 @divisors_count(i32 9)
%10 = icmp eq i32 %9, 3
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @divisors_count(i32 -9)
%14 = icmp eq i32 %13, 3
%15 = zext i1 %14 to i32
%16 = tail call i32 @assert(i32 %15)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ mbstate_t;

/* Variables and functions */
size_t mbrtowc(int /*<<< orphan*/, char const *, size_t, int /*<<< orphan*/ *);
size_t mbrlen(const char *restrict s, size_t n, mbstate_t *restrict st) {
  static unsigned internal;
  return mbrtowc(0, s, n, st ? st : (mbstate_t *)&internal);
}


x86 assembly (clang, -O0):
<mbrlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114c <mbrlen+0x3c>
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    115c <mbrlen+0x4c>
lea    0x2ed9(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    115c <mbrlen+0x4c>
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rcx
xor    %edi,%edi
call   1030 <mbrtowc@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mbrlen>:
mov    %rsi,%rax
mov    %rdi,%rsi
test   %rdx,%rdx
lea    0x2f0c(%rip),%rcx
cmovne %rdx,%rcx
xor    %edi,%edi
mov    %rax,%rdx
jmp    1030 <mbrtowc@plt>

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

LLVM IR (-O2):
@mbrlen.internal = internal global i32 0
define i64 @mbrlen(i8* noalias %0, i64 %1, i32* noalias %2) {
%4 = icmp eq i32* %2, null
%5 = select i1 %4, i32* @mbrlen.internal, i32* %2
%6 = tail call i64 @mbrtowc(i32 0, i8* %0, i64 %1, i32* %5)
ret i64 %6
}
void callback(float progress) {}


x86 assembly (clang, -O0):
<callback>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @callback(float %0) {
%2 = alloca float
store float %0, float* %2
ret void
}

LLVM IR (-O2):
define void @callback(float %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ encrypt(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printArray(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *toArray(int);
int main(int argc, char **argv) {
  uint8_t *key = toArray(0x0000000000000000);
  uint8_t *message = toArray(0xFFFFFFFFFFFFFFFF);
  printArray(encrypt(key, message));
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <toArray@plt>
mov    %rax,-0x18(%rbp)
mov    $0xffffffff,%edi
call   1030 <toArray@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <encrypt@plt>
mov    %eax,%edi
call   1060 <printArray@plt>
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1040 <toArray@plt>
mov    %rax,%rbx
mov    $0xffffffff,%edi
call   1040 <toArray@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <encrypt@plt>
mov    %eax,%edi
call   1060 <printArray@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @toArray(i32 0)
%4 = tail call i32* @toArray(i32 -1)
%5 = tail call i32 @encrypt(i32* %3, i32* %4)
%6 = tail call i32 @printArray(i32 %5)
%7 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ heapSortArray(int *, int, int);
int /*<<< orphan*/ printArray(int *, int);
int main(void) {
  int a[] = {100, 4, 0, 9, 5, 6, 100};
  printArray(a, 7);
  heapSortArray(a, 1, 5);
  printArray(a, 7);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1040 <printArray@plt>
lea    -0x20(%rbp),%rdi
mov    $0x1,%esi
mov    $0x5,%edx
call   1030 <heapSortArray@plt>
lea    -0x20(%rbp),%rdi
mov    $0x7,%esi
call   1040 <printArray@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movups 0xee0(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec8(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <printArray@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x5,%edx
call   1030 <heapSortArray@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1040 <printArray@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [7 x i32] [i32 100, i32 4, i32 0, i32 9, i32 5, i32 6, i32 100]
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
store i32 0, i32* %1
%3 = bitcast [7 x i32]* %2 to i8*
%4 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%5 = call i32 @printArray(i32* %4, i32 7)
%6 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%7 = call i32 @heapSortArray(i32* %6, i32 1, i32 5)
%8 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%9 = call i32 @printArray(i32* %8, i32 7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [7 x i32] [i32 100, i32 4, i32 0, i32 9, i32 5, i32 6, i32 100]
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @printArray(i32* %3, i32 7)
%5 = call i32 @heapSortArray(i32* %3, i32 1, i32 5)
%6 = call i32 @printArray(i32* %3, i32 7)
ret i32 0
}
int get_int_size() {
  unsigned int c = ~0;
  int i = 0;
  do {
    ++i;
    c ^= 1;
    c >>= 1;
  } while (c);
  return i;
}


x86 assembly (clang, -O0):
<get_int_size>:
push   %rbp
mov    %rsp,%rbp
movl   $0xffffffff,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1112 <get_int_size+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @get_int_size() {
ret i32 32
}
void P_bufferinit() {}


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

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

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

LLVM IR (-O2):
define void @P_bufferinit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int fn() { print("whoa"); }


x86 assembly (clang, -O0):
<fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <print@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"whoa\00"
define i32 @fn() {
%1 = alloca i32
%2 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [5 x i8] c"whoa\00"
define i32 @fn() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int c, n;
  n = 0;
  while (getchar() != EOF) {
    ++n;
  }
  printf("%d\n", n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2e9d(%rip),%rcx
cmp    (%rcx),%rax
je     1162 <main+0x42>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    113d <main+0x1d>
mov    -0x18(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
mov    0x2eb8(%rip),%r14
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%ebx
cmp    (%r14),%rax
jne    1130 <main+0x10>
lea    0xeba(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 0, %2 ], [ %8, %3 ]
%5 = tail call i64 (...) @getchar()
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
%8 = add nuw nsw i32 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
void NAND_FREE_BAD_BLOCK_MEM(unsigned int *pBadBlock) { return; }


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

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

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

LLVM IR (-O2):
define void @NAND_FREE_BAD_BLOCK_MEM(i32* nocapture %0) {
ret void
}
void unipiAnalogWrite(int value) {}


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

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

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

LLVM IR (-O2):
define void @unipiAnalogWrite(i32 %0) {
ret void
}
int fun_coverage_while(int x) {
  int ret = 0;
  int iloop = 0;
  while (iloop < x) {
    ret += 2;
    iloop++;
  }
  return ret;
}


x86 assembly (clang, -O0):
<fun_coverage_while>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1138 <fun_coverage_while+0x38>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <fun_coverage_while+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_coverage_while>:
lea    (%rdi,%rdi,1),%ecx
xor    %eax,%eax
test   %edi,%edi
cmovg  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @fun_coverage_while(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = shl nuw i32 %0, 1
%4 = select i1 %2, i32 %3, i32 0
ret i32 %4
}
int test_imm_29uint8_mem(unsigned char *val) {
  return ((*val) & (0x29 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_29uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 41
%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_29uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 41
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int write(int, char *, int);
int send_region_info(int dev_fd, char *host_region) {
  int ret;
  ret = write(dev_fd, host_region, 1);
  if (ret != 1) {
    printf("Sending region info failed, ret = %d\n", ret);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<send_region_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
je     1168 <send_region_info+0x48>
mov    -0x14(%rbp),%esi
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116f <send_region_info+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_region_info>:
push   %rax
mov    $0x1,%edx
call   1030 <write@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
je     1145 <send_region_info+0x25>
lea    0xec7(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0xffffffff,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Sending region info failed, ret = %d\0A\00"
define i32 @send_region_info(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = call i32 @write(i32 %7, i8* %8, i32 1)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %6
%14 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %13)
store i32 -1, i32* %3
br label %16
15: ; preds = %2
store i32 0, i32* %3
br label %16
16: ; preds = %15, %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [38 x i8] c"Sending region info failed, ret = %d\0A\00"
define i32 @send_region_info(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @write(i32 %0, i8* %1, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i32 %3)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ -1, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ carregar(char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  if (argc != 3) {
    printf("parametros incorretos, usar : ./grep <arquivo> <palavra>\n");
    exit(1);
  } else {
    carregar(argv);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1166 <main+0x36>
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1030 <carregar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x3,%edi
jne    1142 <main+0x12>
mov    %rsi,%rdi
call   1030 <carregar@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [58 x i8] c"parametros incorretos, usar : ./grep <arquivo> <palavra>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 3
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = call i32 @carregar(i8** %12)
br label %14
14: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@str = [57 x i8] c"parametros incorretos, usar : ./grep <arquivo> <palavra>\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %2
%8 = tail call i32 @carregar(i8** %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ render_hex(char *, int, unsigned char const *, int,
                              int /*<<< orphan*/);
void printhex(const unsigned char *buf, int n, FILE *f) {
  char tmpbuf[512];
  render_hex(tmpbuf, sizeof tmpbuf, buf, n, 0);
  fprintf(f, "%s", tmpbuf);
}


x86 assembly (clang, -O0):
<printhex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    $0x200,%esi
xor    %r8d,%r8d
call   1030 <render_hex@plt>
mov    -0x18(%rbp),%rdi
lea    -0x220(%rbp),%rdx
lea    0xe9d(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printhex>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdx,%rbx
mov    %esi,%ecx
mov    %rdi,%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x200,%esi
xor    %r8d,%r8d
call   1030 <render_hex@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <fputs@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @printhex(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [512 x i8]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @render_hex(i8* %8, i32 512, i8* %9, i32 %10, i32 0)
%12 = load i32*, i32** %6
%13 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%14 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %13)
ret void
}

LLVM IR (-O2):
define void @printhex(i8* %0, i32 %1, i32* nocapture %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @render_hex(i8* %5, i32 512, i8* %0, i32 %1, i32 0)
%7 = call i32 @fputs(i8* %5, i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scrprintf(char *, int);
void attrsetbg(int bg) { scrprintf("\033[%dm", bg + 40); }


x86 assembly (clang, -O0):
<attrsetbg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
add    $0x28,%esi
lea    0xed8(%rip),%rdi
call   1030 <scrprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<attrsetbg>:
lea    0x28(%rdi),%esi
lea    0xee6(%rip),%rdi
jmp    1030 <scrprintf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[%dm\00"
define void @attrsetbg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 40
%5 = call i32 @scrprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dm\00"
define void @attrsetbg(i32 %0) {
%2 = add nsw i32 %0, 40
%3 = tail call i32 @scrprintf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
int strange_order(int a, int b) {
  if (a == 0 || b == 0)
    return 0;
  else
    return a % b;
}


x86 assembly (clang, -O0):
<strange_order>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     111e <strange_order+0x1e>
cmpl   $0x0,-0xc(%rbp)
jne    112a <strange_order+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1134 <strange_order+0x34>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strange_order>:
xor    %eax,%eax
test   %edi,%edi
je     1111 <strange_order+0x11>
test   %esi,%esi
je     1111 <strange_order+0x11>
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @strange_order(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 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 0, i32* %3
br label %16
12: ; preds = %8
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = srem i32 %13, %14
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %11
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @strange_order(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = srem i32 %0, %1
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 0, %2 ]
ret i32 %9
}
int main(void) {
  int counter;
  for (counter = 0; counter < 5; counter++) {
    if (2 == counter) {
      continue;
    }
    if (3 == counter) {
      continue;
    }
    if (4 == counter) {
      continue;
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1168 <main+0x68>
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
jne    112f <main+0x2f>
jmp    115a <main+0x5a>
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jne    1142 <main+0x42>
jmp    115a <main+0x5a>
mov    $0x4,%eax
cmp    -0x8(%rbp),%eax
jne    1155 <main+0x55>
jmp    115a <main+0x5a>
jmp    115a <main+0x5a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct rw_semaphore {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __down_read(struct rw_semaphore *);
__attribute__((always_)) void down_read(struct rw_semaphore *sem) {
  do {
    do {
    } while (0);
  } while (0);
  ;
  __down_read(sem);
  ;
}


x86 assembly (clang, -O0):
<down_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
jmp    1121 <down_read+0x11>
jmp    1126 <down_read+0x16>
jmp    112b <down_read+0x1b>
mov    -0x8(%rbp),%rdi
call   1030 <__down_read@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<down_read>:
jmp    1030 <__down_read@plt>

LLVM IR (-O0):
%struct.rw_semaphore = type { i32 }
define void @down_read(%struct.rw_semaphore* %0) {
%2 = alloca %struct.rw_semaphore*
store %struct.rw_semaphore* %0, %struct.rw_semaphore** %2
br label %3
3: ; preds = %1
br label %4
4: ; preds = %3
br label %5
5: ; preds = %4
br label %6
6: ; preds = %5
%7 = load %struct.rw_semaphore*, %struct.rw_semaphore** %2
%8 = call i32 @__down_read(%struct.rw_semaphore* %7)
ret void
}

LLVM IR (-O2):
%struct.rw_semaphore = type { i32 }
define void @down_read(%struct.rw_semaphore* %0) {
%2 = tail call i32 @__down_read(%struct.rw_semaphore* %0)
ret void
}
unsigned char VIM_LCDIF_GetDeInterVal(unsigned short wcy) {
  unsigned char len;
  len = (unsigned char)(wcy & 0x1f);
  wcy >>= 5;
  len = (unsigned char)(len + (wcy & 0x1f) + 1);
  wcy >>= 5;
  len = (unsigned char)(len + (wcy & 0x1f));
  return len;
}


x86 assembly (clang, -O0):
<VIM_LCDIF_GetDeInterVal>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0x1f,%eax
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x5,%eax
mov    %ax,-0x2(%rbp)
movzbl -0x3(%rbp),%eax
movzwl -0x2(%rbp),%ecx
and    $0x1f,%ecx
add    %ecx,%eax
add    $0x1,%eax
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x5,%eax
mov    %ax,-0x2(%rbp)
movzbl -0x3(%rbp),%eax
movzwl -0x2(%rbp),%ecx
and    $0x1f,%ecx
add    %ecx,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<VIM_LCDIF_GetDeInterVal>:
mov    %edi,%ecx
and    $0x1f,%ecx
mov    %edi,%eax
shr    $0x5,%eax
and    $0x1f,%eax
add    %ecx,%eax
shr    $0xa,%edi
and    $0x1f,%edi
add    %edi,%eax
add    $0x1,%al
ret

LLVM IR (-O0):
define zeroext i8 @VIM_LCDIF_GetDeInterVal(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = and i32 %5, 31
%7 = trunc i32 %6 to i8
store i8 %7, i8* %3
%8 = load i16, i16* %2
%9 = zext i16 %8 to i32
%10 = ashr i32 %9, 5
%11 = trunc i32 %10 to i16
store i16 %11, i16* %2
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = load i16, i16* %2
%15 = zext i16 %14 to i32
%16 = and i32 %15, 31
%17 = add nsw i32 %13, %16
%18 = add nsw i32 %17, 1
%19 = trunc i32 %18 to i8
store i8 %19, i8* %3
%20 = load i16, i16* %2
%21 = zext i16 %20 to i32
%22 = ashr i32 %21, 5
%23 = trunc i32 %22 to i16
store i16 %23, i16* %2
%24 = load i8, i8* %3
%25 = zext i8 %24 to i32
%26 = load i16, i16* %2
%27 = zext i16 %26 to i32
%28 = and i32 %27, 31
%29 = add nsw i32 %25, %28
%30 = trunc i32 %29 to i8
store i8 %30, i8* %3
%31 = load i8, i8* %3
ret i8 %31
}

LLVM IR (-O2):
define zeroext i8 @VIM_LCDIF_GetDeInterVal(i16 zeroext %0) {
%2 = and i16 %0, 31
%3 = lshr i16 %0, 5
%4 = and i16 %3, 31
%5 = lshr i16 %0, 10
%6 = and i16 %5, 31
%7 = add nuw nsw i16 %2, 1
%8 = add nuw nsw i16 %7, %4
%9 = add nuw nsw i16 %8, %6
%10 = trunc i16 %9 to i8
ret i8 %10
}
/* Variables and functions */
double exp(double);
double boltz(double dist_change, double temp) {
  return exp(-dist_change / temp);
}


x86 assembly (clang, -O0):
<boltz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boltz>:
xorpd  0xee8(%rip),%xmm0
divsd  %xmm1,%xmm0
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @boltz(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 = fneg double %5
%7 = load double, double* %4
%8 = fdiv double %6, %7
%9 = call double @exp(double %8)
ret double %9
}

LLVM IR (-O2):
define double @boltz(double %0, double %1) {
%3 = fneg double %0
%4 = fdiv double %3, %1
%5 = tail call double @exp(double %4)
ret double %5
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ range(int *, int, int);
int *rangeAlloc(int inicio, int ate) {
  int *vet = (int *)malloc((ate - inicio) * sizeof(int));
  range(vet, inicio, ate);
  return vet;
}


x86 assembly (clang, -O0):
<rangeAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
call   1040 <range@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rangeAlloc>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    %esi,%edi
sub    %ebp,%edi
shl    $0x2,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <range@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32* @rangeAlloc(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = shl i32 %3, 2
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i32*
%7 = tail call i32 @range(i32* %6, i32 %0, i32 %1)
ret i32* %6
}
double Max(x, y)
double x, y;
{
  if (x > y)
    return (x);
  return (y);
}


x86 assembly (clang, -O0):
<Max>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    112d <Max+0x2d>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1137 <Max+0x37>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Max>:
maxsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @Max(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load double, double* %4
store double %10, double* %3
br label %13
11: ; preds = %2
%12 = load double, double* %5
store double %12, double* %3
br label %13
13: ; preds = %11, %9
%14 = load double, double* %3
ret double %14
}

LLVM IR (-O2):
define double @Max(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int seg_crash() {
  int *a = 0;
  *a = 3;
  return 1;
}


x86 assembly (clang, -O0):
<seg_crash>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @seg_crash() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = load i32*, i32** %1
store i32 3, i32* %2
ret i32 1
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_usage() { printf("usage: tmnsh [filename]\n"); }


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

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

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

LLVM IR (-O2):
@str = [24 x i8] c"usage: tmnsh [filename]\00"
define void @show_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void __close_handle(int handle) {
  if (handle > 0)
    close(handle);
}


x86 assembly (clang, -O0):
<__close_handle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    112d <__close_handle+0x1d>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__close_handle>:
test   %edi,%edi
jle    1119 <__close_handle+0x9>
jmp    1030 <close@plt>
ret

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

LLVM IR (-O2):
define void @__close_handle(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @close(i32 %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int isdigit(unsigned char);
int nat_isdigit(char a) { return isdigit((unsigned char)a); }


x86 assembly (clang, -O0):
<nat_isdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <isdigit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nat_isdigit>:
movzbl %dil,%edi
jmp    1030 <isdigit@plt>

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

LLVM IR (-O2):
define i32 @nat_isdigit(i8 signext %0) {
%2 = tail call i32 @isdigit(i8 zeroext %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 10;
  int b, c;
  a = a + 15;
  b = a + 200;
  c = a + b;
  printf("The result is %d\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xf,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xc8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xeb3(%rip),%rdi
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    $0xfa,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 15
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 200
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 250)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int prompt(const char *str) {
  printf("%s", str);
  printf(" Press any key to continue...");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<prompt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [30 x i8] c" Press any key to continue...\00"
define i32 @prompt(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [30 x i8] c" Press any key to continue...\00"
define i32 @prompt(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @getchar()
ret i32 0
}
void gtk_ui_manager_get_action() {}


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

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

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

LLVM IR (-O2):
define void @gtk_ui_manager_get_action() {
ret void
}
/* Variables and functions */
double sqrt(double);
double dist(double x1, double y1, double x2, double y2) {
  double dx = x1 - x2;
  double dy = y1 - y2;
  return sqrt(dx * dx + dy * dy);
}


x86 assembly (clang, -O0):
<dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist>:
subsd  %xmm2,%xmm0
subsd  %xmm3,%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1133 <dist+0x23>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @dist(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%11 = load double, double* %5
%12 = load double, double* %7
%13 = fsub double %11, %12
store double %13, double* %9
%14 = load double, double* %6
%15 = load double, double* %8
%16 = fsub double %14, %15
store double %16, double* %10
%17 = load double, double* %9
%18 = load double, double* %9
%19 = load double, double* %10
%20 = load double, double* %10
%21 = fmul double %19, %20
%22 = call double @llvm.fmuladd.f64(double %17, double %18, double %21)
%23 = call double @sqrt(double %22)
ret double %23
}

LLVM IR (-O2):
define double @dist(double %0, double %1, double %2, double %3) {
%5 = fsub double %0, %2
%6 = fsub double %1, %3
%7 = fmul double %6, %6
%8 = tail call double @llvm.fmuladd.f64(double %5, double %5, double %7)
%9 = tail call double @sqrt(double %8)
ret double %9
}
/* Variables and functions */
char *strcat(char *, char *);
int strlen(char *);
char *path_join(char *a, char *b) {
  if (a[strlen(a) - 1] != '/') {
    return strcat(strcat(a, "/"), b);
  } else {
    return strcat(a, b);
  }
}


x86 assembly (clang, -O0):
<path_join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2f,%eax
je     117f <path_join+0x5f>
mov    -0x10(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1040 <strcat@plt>
mov    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
mov    %rax,-0x8(%rbp)
jmp    1190 <path_join+0x70>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <strcat@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_join>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0x2f,-0x1(%rax,%rbx,1)
je     1146 <path_join+0x26>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movw   $0x2f,(%rbx,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strcat@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
define i8* @path_join(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = sub nsw i32 %8, 1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %6, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 47
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = call i8* @strcat(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = load i8*, i8** %5
%19 = call i8* @strcat(i8* %17, i8* %18)
store i8* %19, i8** %3
br label %24
20: ; preds = %2
%21 = load i8*, i8** %4
%22 = load i8*, i8** %5
%23 = call i8* @strcat(i8* %21, i8* %22)
store i8* %23, i8** %3
br label %24
24: ; preds = %20, %15
%25 = load i8*, i8** %3
ret i8* %25
}

LLVM IR (-O2):
define i8* @path_join(i8* returned %0, i8* nocapture %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = add nsw i32 %3, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 47
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = tail call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %0)
%11 = getelementptr i8, i8* %0, i64 %10
%12 = bitcast i8* %11 to i16*
store i16 47, i16* %12
br label %13
13: ; preds = %2, %9
%14 = tail call i8* @strcat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ write(int /*<<< orphan*/, char const *, int);
int clearScreen() {
  const char *CLEAR_SCREE_ANSI = "\e[1;1H\e[2J";
  write(STDOUT_FILENO, CLEAR_SCREE_ANSI, 12);
}


x86 assembly (clang, -O0):
<clearScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    $0xc,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearScreen>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
mov    $0xc,%edx
jmp    1030 <write@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[1;1H\1B[2J\00"
@STDOUT_FILENO = global i32 0
define i32 @clearScreen() {
%1 = alloca i32
%2 = alloca i8*
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
%3 = load i32, i32* @STDOUT_FILENO
%4 = load i8*, i8** %2
%5 = call i32 @write(i32 %3, i8* %4, i32 12)
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[1;1H\1B[2J\00"
@STDOUT_FILENO = global i32 0
define i32 @clearScreen() {
%1 = load i32, i32* @STDOUT_FILENO
%2 = tail call i32 @write(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 12)
ret i32 undef
}