xunge/DecIR huggingface dataset:
/* Type definitions */
struct rlimit {
  unsigned int rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_FSIZE;
scalar_t__ getrlimit(int /*<<< orphan*/, struct rlimit *);
unsigned int getfilemaxsize() {
  struct rlimit ret;
  unsigned int val;
  if (getrlimit(RLIMIT_FSIZE, &ret) != 0)
    return 0;
  val = ret.rlim_cur;
  return val;
}


x86 assembly (clang, -O0):
<getfilemaxsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <getrlimit@plt>
cmp    $0x0,%rax
je     1140 <getfilemaxsize+0x30>
movl   $0x0,-0x4(%rbp)
jmp    114c <getfilemaxsize+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfilemaxsize>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <getrlimit@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    112f <getfilemaxsize+0x1f>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.rlimit = type { i32 }
@RLIMIT_FSIZE = global i32 0
define i32 @getfilemaxsize() {
%1 = alloca i32
%2 = alloca %struct.rlimit
%3 = alloca i32
%4 = load i32, i32* @RLIMIT_FSIZE
%5 = call i64 @getrlimit(i32 %4, %struct.rlimit* %2)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 0, i32* %1
br label %12
8: ; preds = %0
%9 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %2, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
store i32 %11, i32* %1
br label %12
12: ; preds = %8, %7
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
%struct.rlimit = type { i32 }
@RLIMIT_FSIZE = global i32 0
define i32 @getfilemaxsize() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i32, i32* @RLIMIT_FSIZE
%4 = call i64 @getrlimit(i32 %3, %struct.rlimit* %1)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 %7, i32 0
ret i32 %8
}
/* Variables and functions */
int arp_test();
int checksum_test();
int mbuf_test();
int main(int argc, char *argv[]) {
  int retval = 0;
  retval |= arp_test();
  retval |= mbuf_test();
  retval |= checksum_test();
  return retval;
}


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,-0x14(%rbp)
mov    $0x0,%al
call   1050 <arp_test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <mbuf_test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <checksum_test@plt>
or     -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <arp_test@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <mbuf_test@plt>
mov    %eax,%ebp
or     %ebx,%ebp
xor    %eax,%eax
call   1040 <checksum_test@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = call i32 (...) @arp_test()
%8 = load i32, i32* %6
%9 = or i32 %8, %7
store i32 %9, i32* %6
%10 = call i32 (...) @mbuf_test()
%11 = load i32, i32* %6
%12 = or i32 %11, %10
store i32 %12, i32* %6
%13 = call i32 (...) @checksum_test()
%14 = load i32, i32* %6
%15 = or i32 %14, %13
store i32 %15, i32* %6
%16 = load i32, i32* %6
ret i32 %16
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @arp_test()
%4 = tail call i32 (...) @mbuf_test()
%5 = or i32 %4, %3
%6 = tail call i32 (...) @checksum_test()
%7 = or i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int print_bus_write(char *, char const *, char const *, int);
int /*<<< orphan*/ strconcat(char *, char const *, char const *, int);
int print_bus_write_(const char *func, const char *str, const char *address,
                     const char *val, int size) {
  char prefix[(100)];
  strconcat(prefix, func, str, (100));
  return print_bus_write(prefix, address, val, size);
}


x86 assembly (clang, -O0):
<print_bus_write_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x64,%ecx
call   1030 <strconcat@plt>
lea    -0x90(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1040 <print_bus_write@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_bus_write_>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %r8d,%r14d
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x64,%ecx
call   1030 <strconcat@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r14d,%ecx
call   1040 <print_bus_write@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @print_bus_write_(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [100 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%13 = load i8*, i8** %6
%14 = load i8*, i8** %7
%15 = call i32 @strconcat(i8* %12, i8* %13, i8* %14, i32 100)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%17 = load i8*, i8** %8
%18 = load i8*, i8** %9
%19 = load i32, i32* %10
%20 = call i32 @print_bus_write(i8* %16, i8* %17, i8* %18, i32 %19)
ret i32 %20
}

LLVM IR (-O2):
define i32 @print_bus_write_(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca [100 x i8]
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%8 = call i32 @strconcat(i8* %7, i8* %0, i8* %1, i32 100)
%9 = call i32 @print_bus_write(i8* %7, i8* %2, i8* %3, i32 %4)
ret i32 %9
}
/* Type definitions */
struct packet {
  int dummy;
};

/* Variables and functions */
unsigned char *create_kv_packet(unsigned char const *, int,
                                unsigned char const *, size_t, struct packet *,
                                unsigned char *);
unsigned char *create_cid_packet(const unsigned char *cid, size_t cid_sz,
                                 struct packet *pkt, unsigned char *ptr) {
  return create_kv_packet((const unsigned char *)"cid", (sizeof("cid") - 1),
                          cid, cid_sz, pkt, ptr);
}


x86 assembly (clang, -O0):
<create_cid_packet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
lea    0xec1(%rip),%rdi
mov    $0x3,%esi
call   1030 <create_kv_packet@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_cid_packet>:
mov    %rcx,%r9
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xedd(%rip),%rdi
mov    $0x3,%esi
jmp    1030 <create_kv_packet@plt>

LLVM IR (-O0):
%struct.packet = type { i32 }
@.str = [4 x i8] c"cid\00"
define i8* @create_cid_packet(i8* %0, i64 %1, %struct.packet* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.packet*
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store %struct.packet* %2, %struct.packet** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = load %struct.packet*, %struct.packet** %7
%12 = load i8*, i8** %8
%13 = call i8* @create_kv_packet(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3, i8* %9, i64 %10, %struct.packet* %11, i8* %12)
ret i8* %13
}

LLVM IR (-O2):
%struct.packet = type { i32 }
@.str = [4 x i8] c"cid\00"
define i8* @create_cid_packet(i8* %0, i64 %1, %struct.packet* %2, i8* %3) {
%5 = tail call i8* @create_kv_packet(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3, i8* %0, i64 %1, %struct.packet* %2, i8* %3)
ret i8* %5
}
void check_for_orphaned_services(void) {}


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

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

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

LLVM IR (-O2):
define void @check_for_orphaned_services() {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ ts_x_origin;
};
typedef TYPE_1__ XGCValues;

/* Variables and functions */
int get_XGCValues_ts_x_origin(void *_p) {
  return (int)((XGCValues *)_p)->ts_x_origin;
}


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

x86 assembly (clang, -O2):
<get_XGCValues_ts_x_origin>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XGCValues_ts_x_origin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XGCValues_ts_x_origin(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
void wait_impl(unsigned int term_millisec) {}


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

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

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

LLVM IR (-O2):
define void @wait_impl(i32 %0) {
ret void
}
/* Variables and functions */
int foo(int, int);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int result;
  printf("Main\n");
  result = foo(5, 7);
  printf("Result: %d\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0x7,%esi
call   1040 <foo@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
mov    $0x7,%esi
call   1050 <foo@plt>
lea    0xead(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str.1 = [12 x i8] c"Result: %d\0A\00"
@str = [5 x i8] c"Main\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @foo(i32 5, i32 7)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %2)
ret i32 0
}
void EUSCIB2_IRQHandler(void) {
  while (1) {
  }
}


x86 assembly (clang, -O0):
<EUSCIB2_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <EUSCIB2_IRQHandler+0x9>
jmp    1109 <EUSCIB2_IRQHandler+0x9>

x86 assembly (clang, -O2):
<EUSCIB2_IRQHandler>:
jmp    1100 <EUSCIB2_IRQHandler>

LLVM IR (-O0):
define void @EUSCIB2_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @EUSCIB2_IRQHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ f_data();
int main() {
  f();
  f_data();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
mov    $0x0,%al
call   1040 <f_data@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 (...) @f_data()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isupper(int);
void t_isupper_0xcc() {
  Assert_real((isupper(204) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isupper.c",
              1025, ("isupper should be 0 for 0xcc"));
}


x86 assembly (clang, -O0):
<t_isupper_0xcc>:
push   %rbp
mov    %rsp,%rbp
mov    $0xcc,%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x401,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isupper_0xcc>:
push   %rax
mov    $0xcc,%edi
call   1030 <isupper@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x401,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xcc\00"
define void @t_isupper_0xcc() {
%1 = call i64 @isupper(i32 204)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1025, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isupper.c\00"
@.str.1 = [29 x i8] c"isupper should be 0 for 0xcc\00"
define void @t_isupper_0xcc() {
%1 = tail call i64 @isupper(i32 204)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1025, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_line(int, char *);
int main(int argc, char *argv[]) {
  int k;
  for (k = 0; k < argc; k++) {
    print_line(1, argv[k]);
  }
  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,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115d <main+0x4d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x1,%edi
call   1030 <print_line@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @print_line(i32 1, i8* %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret i32 0
}
int addr_to_frameidx(unsigned int addr) { return addr / 0x1000; }


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

x86 assembly (clang, -O2):
<addr_to_frameidx>:
mov    %edi,%eax
shr    $0xc,%eax
ret

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

LLVM IR (-O2):
define i32 @addr_to_frameidx(i32 %0) {
%2 = lshr i32 %0, 12
ret i32 %2
}
void Swap(int *x, int *y) {
  int temp;
  temp = *x;
  *x = *y;
  *y = temp;
}


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

x86 assembly (clang, -O2):
<Swap>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @Swap(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** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @Swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
unsigned short _EndianSwapUnsignedShort(unsigned short s) {
  unsigned char b1, b2;
  b1 = s & 255;
  b2 = (s >> 8) & 255;
  return (b1 << 8) + b2;
}


x86 assembly (clang, -O0):
<_EndianSwapUnsignedShort>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,-0x4(%rbp)
movzbl -0x3(%rbp),%eax
shl    $0x8,%eax
movzbl -0x4(%rbp),%ecx
add    %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_EndianSwapUnsignedShort>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @_EndianSwapUnsignedShort(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i8
%4 = alloca i8
store i16 %0, i16* %2
%5 = load i16, i16* %2
%6 = zext i16 %5 to i32
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
store i8 %8, i8* %3
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = ashr i32 %10, 8
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
store i8 %13, i8* %4
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 8
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = add nsw i32 %16, %18
%20 = trunc i32 %19 to i16
ret i16 %20
}

LLVM IR (-O2):
define zeroext i16 @_EndianSwapUnsignedShort(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
int test_imm_39uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x39 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_39uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0x39,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_39uint64_midword_reg>:
test   $0x390000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_39uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 3735552
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
void main() { int32_t a[10]; }


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

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

LLVM IR (-O0):
define void @main() {
%1 = alloca [10 x i32]
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
int test_imm_34uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x34 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_34uint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0x34,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_34uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 52
%7 = icmp ne i64 %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_34uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 3407872
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *langDbgDevRam() { return "RAM"; }


x86 assembly (clang, -O0):
<langDbgDevRam>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langDbgDevRam>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"RAM\00"
define i8* @langDbgDevRam() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"RAM\00"
define i8* @langDbgDevRam() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
int main() {
  const char *names[] = {"Martin", "Alejandro", "Noblia"};
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    0x2d1e(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2d1b(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2d18(%rip),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"Martin\00"
@.str.1 = [10 x i8] c"Alejandro\00"
@.str.2 = [7 x i8] c"Noblia\00"
@__const.main.names = [3 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i32 0, i32 0)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8*]
store i32 0, i32* %1
%3 = bitcast [3 x i8*]* %2 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ sounder(int, int);
void tapDash() { sounder(1, (1200 * 3 / 8)); }


x86 assembly (clang, -O0):
<tapDash>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x1c2,%esi
call   1030 <sounder@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tapDash>:
mov    $0x1,%edi
mov    $0x1c2,%esi
jmp    1030 <sounder@plt>

LLVM IR (-O0):
define void @tapDash() {
%1 = call i32 @sounder(i32 1, i32 450)
ret void
}

LLVM IR (-O2):
define void @tapDash() {
%1 = tail call i32 @sounder(i32 1, i32 450)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sync();
void success(void) {
  printf("SUCCESS\n");
  fflush(NULL);
  sync();
  _exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<success>:
push   %rbp
mov    %rsp,%rbp
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <fflush@plt>
mov    $0x0,%al
call   1050 <sync@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<success>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
xor    %edi,%edi
call   1060 <fflush@plt>
xor    %eax,%eax
call   1050 <sync@plt>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"SUCCESS\0A\00"
@EXIT_SUCCESS = global i32 0
define void @success() {
%1 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @fflush(i32* null)
%3 = call i32 (...) @sync()
%4 = load i32, i32* @EXIT_SUCCESS
%5 = call i32 @_exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [8 x i8] c"SUCCESS\00"
define void @success() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @fflush(i32* null)
%3 = tail call i32 (...) @sync()
%4 = load i32, i32* @EXIT_SUCCESS
%5 = tail call i32 @_exit(i32 %4)
unreachable
}
unsigned point_index(const unsigned x) {
  return ((x >> 1) & 1u) | ((x >> 2) & 2u);
}


x86 assembly (clang, -O0):
<point_index>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
and    $0x1,%eax
mov    -0x4(%rbp),%ecx
shr    $0x2,%ecx
and    $0x2,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<point_index>:
mov    %edi,%eax
shr    %eax
and    $0x1,%eax
shr    $0x2,%edi
and    $0x2,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @point_index(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = and i32 %4, 1
%6 = load i32, i32* %2
%7 = lshr i32 %6, 2
%8 = and i32 %7, 2
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @point_index(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1
%4 = lshr i32 %0, 2
%5 = and i32 %4, 2
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
char putchar(char);
int sleep(int);
int recur_put(char *pstr) {
  return putchar(*pstr) != '\0' ? recur_put(++pstr) : sleep(1);
}


x86 assembly (clang, -O0):
<recur_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
movsbl %al,%eax
cmp    $0x0,%eax
je     116d <recur_put+0x3d>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x8(%rbp)
call   1040 <recur_put@plt>
mov    %eax,-0xc(%rbp)
jmp    117a <recur_put+0x4a>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recur_put>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
test   %al,%al
jne    1130 <recur_put+0x10>
mov    $0x1,%edi
pop    %rbx
jmp    1040 <sleep@plt>

LLVM IR (-O0):
define i32 @recur_put(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = call signext i8 @putchar(i8 signext %4)
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = call i32 @recur_put(i8* %10)
br label %14
12: ; preds = %1
%13 = call i32 @sleep(i32 1)
br label %14
14: ; preds = %12, %8
%15 = phi i32 [ %11, %8 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @recur_put(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call signext i8 @putchar(i8 signext %4)
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = tail call i32 @sleep(i32 1)
ret i32 %9
}
int f(int y) { return y & ~(y & -y); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
xor    %edx,%edx
sub    -0x4(%rbp),%edx
and    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    -0x1(%rdi),%eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* %2
%6 = sub nsw i32 0, %5
%7 = and i32 %4, %6
%8 = xor i32 %7, -1
%9 = and i32 %3, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = add i32 %0, -1
%3 = and i32 %2, %0
ret i32 %3
}
void iwl3945_led_background(struct iwl3945_priv *priv) {}


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

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

LLVM IR (-O0):
%struct.iwl3945_priv = type opaque
define void @iwl3945_led_background(%struct.iwl3945_priv* %0) {
%2 = alloca %struct.iwl3945_priv*
store %struct.iwl3945_priv* %0, %struct.iwl3945_priv** %2
ret void
}

LLVM IR (-O2):
%struct.iwl3945_priv = type opaque
define void @iwl3945_led_background(%struct.iwl3945_priv* nocapture %0) {
ret void
}
void RGBColorTable() {}


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

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

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

LLVM IR (-O2):
define void @RGBColorTable() {
ret void
}
int fun1209() { return 1209; }


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

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

LLVM IR (-O0):
define i32 @fun1209() {
ret i32 1209
}

LLVM IR (-O2):
define i32 @fun1209() {
ret i32 1209
}
f(struct A *p) {
  struct A {
    int i;
  };
  p->i = 5;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movl   $0x5,(%rdi)
ret

LLVM IR (-O0):
%struct.A = type { i32 }
define i32 @f(%struct.A* %0) {
%2 = alloca i32
%3 = alloca %struct.A*
store %struct.A* %0, %struct.A** %3
%4 = load %struct.A*, %struct.A** %3
%5 = getelementptr inbounds %struct.A, %struct.A* %4, i32 0, i32 0
store i32 5, i32* %5
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
%struct.A = type { i32 }
define i32 @f(%struct.A* nocapture writeonly %0) {
%2 = getelementptr inbounds %struct.A, %struct.A* %0, i64 0, i32 0
store i32 5, i32* %2
ret i32 undef
}
void setI1(unsigned char *p, char i) { *p = (unsigned char)i; }


x86 assembly (clang, -O0):
<setI1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setI1>:
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @setI1(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8*, i8** %3
store i8 %5, i8* %6
ret void
}

LLVM IR (-O2):
define void @setI1(i8* nocapture writeonly %0, i8 signext %1) {
store i8 %1, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void bm_sleep(int iters) { sleep(1); }


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

x86 assembly (clang, -O2):
<bm_sleep>:
mov    $0x1,%edi
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define void @bm_sleep(i32 %0) {
%2 = tail call i32 @sleep(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ blinkdash();
int /*<<< orphan*/ blinkdot();
int /*<<< orphan*/ sleep(double);
int blinkW() {
  blinkdot();
  blinkdash();
  blinkdash();
  sleep(1.5);
  return 0;
}


x86 assembly (clang, -O0):
<blinkW>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <blinkdot@plt>
mov    $0x0,%al
call   1040 <blinkdash@plt>
mov    $0x0,%al
call   1040 <blinkdash@plt>
movsd  0xeaf(%rip),%xmm0
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blinkW>:
push   %rax
xor    %eax,%eax
call   1030 <blinkdot@plt>
xor    %eax,%eax
call   1040 <blinkdash@plt>
xor    %eax,%eax
call   1040 <blinkdash@plt>
movsd  0xeb2(%rip),%xmm0
call   1050 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @blinkW() {
%1 = call i32 (...) @blinkdot()
%2 = call i32 (...) @blinkdash()
%3 = call i32 (...) @blinkdash()
%4 = call i32 @sleep(double 1.500000e+00)
ret i32 0
}

LLVM IR (-O2):
define i32 @blinkW() {
%1 = tail call i32 (...) @blinkdot()
%2 = tail call i32 (...) @blinkdash()
%3 = tail call i32 (...) @blinkdash()
%4 = tail call i32 @sleep(double 1.500000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ countSort(int *, int, int);
int getMax(int *, int);
void radixsort(int arr[], int n) {
  int m = getMax(arr, n);
  int exp;
  for (exp = 1; m / exp > 0; exp *= 10)
    countSort(arr, n, exp);
}


x86 assembly (clang, -O0):
<radixsort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <getMax@plt>
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cmp    $0x0,%eax
jle    1170 <radixsort+0x50>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <countSort@plt>
imul   $0xa,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1145 <radixsort+0x25>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<radixsort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%r15
call   1040 <getMax@plt>
test   %eax,%eax
jle    115b <radixsort+0x3b>
mov    %eax,%ebp
mov    $0x1,%ebx
nopl   (%rax)
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
call   1030 <countSort@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%ebx
mov    %ebp,%eax
cltd
idiv   %ebx
test   %eax,%eax
jg     1140 <radixsort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @radixsort(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** %3
%8 = load i32, i32* %4
%9 = call i32 @getMax(i32* %7, i32 %8)
store i32 %9, i32* %5
store i32 1, i32* %6
br label %10
10: ; preds = %20, %2
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = sdiv i32 %11, %12
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %10
%16 = load i32*, i32** %3
%17 = load i32, i32* %4
%18 = load i32, i32* %6
%19 = call i32 @countSort(i32* %16, i32 %17, i32 %18)
br label %20
20: ; preds = %15
%21 = load i32, i32* %6
%22 = mul nsw i32 %21, 10
store i32 %22, i32* %6
br label %10
23: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @radixsort(i32* %0, i32 %1) {
%3 = tail call i32 @getMax(i32* %0, i32 %1)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ 1, %2 ]
%7 = tail call i32 @countSort(i32* %0, i32 %1, i32 %6)
%8 = mul nsw i32 %6, 10
%9 = sdiv i32 %3, %8
%10 = icmp sgt i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ err_check(scalar_t__);
scalar_t__ errno;
int /*<<< orphan*/ printf(char *, ...);
int test_gcd();
int main(void) {
  int x;
  errno = 0;
  printf("\nEuclid's GCD\n");
  x = test_gcd();
  printf("\nThe GCD is %d\n", x);
  err_check(errno);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
movq   $0x0,(%rax)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <test_gcd@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e63(%rip),%rax
mov    (%rax),%rdi
call   1030 <err_check@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2e98(%rip),%rbx
movq   $0x0,(%rbx)
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <test_gcd@plt>
lea    0xe97(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%rdi
call   1030 <err_check@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i64 0
@.str = [15 x i8] c"\0AEuclid's GCD\0A\00"
@.str.1 = [16 x i8] c"\0AThe GCD is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i64 0, i64* @errno
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @test_gcd()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i64, i64* @errno
%8 = call i32 @err_check(i64 %7)
ret i32 0
}

LLVM IR (-O2):
@errno = global i64 0
@.str.1 = [16 x i8] c"\0AThe GCD is %d\0A\00"
@str = [14 x i8] c"\0AEuclid's GCD\00"
define i32 @main() {
store i64 0, i64* @errno
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @test_gcd()
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%4 = load i64, i64* @errno
%5 = tail call i32 @err_check(i64 %4)
ret i32 0
}
int d_blg_cr1(double a1) { return (__builtin_islessgreater(100, a1)); }


x86 assembly (clang, -O0):
<d_blg_cr1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_blg_cr1>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm0
setne  %al
ret

LLVM IR (-O0):
define i32 @d_blg_cr1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp one double 1.000000e+02, %3
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @d_blg_cr1(double %0) {
%2 = fcmp one double %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
const char *String_Name(void) { return "String"; }


x86 assembly (clang, -O0):
<String_Name>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<String_Name>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"String\00"
define i8* @String_Name() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"String\00"
define i8* @String_Name() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
void foo753() {}


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

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

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

LLVM IR (-O2):
define void @foo753() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ iconv_t;

/* Variables and functions */
iconv_t iconv_open(const char *tocode __attribute__((unused)),
                   const char *fromcode __attribute__((unused))) {
  return (iconv_t)0xacce55ed;
}


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

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

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

LLVM IR (-O2):
define i32 @iconv_open(i8* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 -1395763731
}
int queue_work(struct workqueue_struct *wq, struct work_struct *work) {
  int a;
  return a;
}


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

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

LLVM IR (-O0):
%struct.workqueue_struct = type opaque
%struct.work_struct = type opaque
define i32 @queue_work(%struct.workqueue_struct* %0, %struct.work_struct* %1) {
%3 = alloca %struct.workqueue_struct*
%4 = alloca %struct.work_struct*
%5 = alloca i32
store %struct.workqueue_struct* %0, %struct.workqueue_struct** %3
store %struct.work_struct* %1, %struct.work_struct** %4
%6 = load i32, i32* %5
ret i32 %6
}

LLVM IR (-O2):
%struct.workqueue_struct = type opaque
%struct.work_struct = type opaque
define i32 @queue_work(%struct.workqueue_struct* nocapture readnone %0, %struct.work_struct* nocapture readnone %1) {
ret i32 undef
}
int ad7887_register_ring_funcs_and_init(struct iio_dev *indio_dev) { return 0; }


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

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

LLVM IR (-O0):
%struct.iio_dev = type opaque
define i32 @ad7887_register_ring_funcs_and_init(%struct.iio_dev* %0) {
%2 = alloca %struct.iio_dev*
store %struct.iio_dev* %0, %struct.iio_dev** %2
ret i32 0
}

LLVM IR (-O2):
%struct.iio_dev = type opaque
define i32 @ad7887_register_ring_funcs_and_init(%struct.iio_dev* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint64_t;

/* Variables and functions */
scalar_t__ get32_le(int /*<<< orphan*/ *);
uint64_t get64_le(void *p) {
  return (uint64_t)get32_le((uint8_t *)p + 4) << 32 |
         (uint64_t)get32_le((uint8_t *)p);
}


x86 assembly (clang, -O0):
<get64_le>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x10,%rdi
call   1030 <get32_le@plt>
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <get32_le@plt>
mov    %rax,%rcx
mov    -0xc(%rbp),%eax
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get64_le>:
push   %rbx
mov    %rdi,%rbx
add    $0x10,%rdi
call   1030 <get32_le@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <get32_le@plt>

LLVM IR (-O0):
define i32 @get64_le(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = getelementptr inbounds i32, i32* %4, i64 4
%6 = call i64 @get32_le(i32* %5)
%7 = trunc i64 %6 to i32
%8 = shl i32 %7, 32
%9 = load i8*, i8** %2
%10 = bitcast i8* %9 to i32*
%11 = call i64 @get32_le(i32* %10)
%12 = trunc i64 %11 to i32
%13 = or i32 %8, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @get64_le(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = getelementptr inbounds i8, i8* %0, i64 16
%4 = bitcast i8* %3 to i32*
%5 = tail call i64 @get32_le(i32* %4)
%6 = tail call i64 @get32_le(i32* %2)
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
int /*<<< orphan*/ sleep(int);
void think(unsigned long i) {
  printf("P   %ld pensando...\n", i);
  sleep(1);
}


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

x86 assembly (clang, -O2):
<think>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"P %ld pensando...\0A\00"
define void @think(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"P %ld pensando...\0A\00"
define void @think(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %0)
%3 = tail call i32 @sleep(i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ usb_ep_pending(int /*<<< orphan*/);
void usb_ep_wait_for_pending(uint8_t ep) {
  while (!usb_ep_pending(ep)) {
  };
}


x86 assembly (clang, -O0):
<usb_ep_wait_for_pending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <usb_ep_pending@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1138 <usb_ep_wait_for_pending+0x28>
jmp    113d <usb_ep_wait_for_pending+0x2d>
jmp    111b <usb_ep_wait_for_pending+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usb_ep_wait_for_pending>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <usb_ep_pending@plt>
test   %eax,%eax
je     1120 <usb_ep_wait_for_pending+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @usb_ep_wait_for_pending(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @usb_ep_pending(i32 %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %2, label %5
5: ; preds = %2
ret void
}
int test_imm_D5uint8_reg(unsigned char val) {
  return ((val) & (-0xD5 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D5uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffff2b,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D5uint8_reg>:
test   $0x2b,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D5uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 43
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
char *stringCopy(char *s) {
  char *r = s;
  return r;
}


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

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

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

LLVM IR (-O2):
define i8* @stringCopy(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ pthread_yield();
void apr_thread_yield(void) { pthread_yield(); }


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

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

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

LLVM IR (-O2):
define void @apr_thread_yield() {
%1 = tail call i32 (...) @pthread_yield()
ret void
}