xunge/DecIR huggingface dataset:
unsigned int bits(unsigned int value) {
  unsigned int result = 0;
  unsigned int mask = 1;
  while (mask) {
    result += (value & mask) != 0;
    mask *= 2;
  }
  return result;
}


x86 assembly (clang, -O0):
<bits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1144 <bits+0x44>
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1115 <bits+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits>:
xor    %eax,%eax
mov    $0x1,%ecx
nopw   0x0(%rax,%rax,1)
mov    %ecx,%edx
and    %edi,%edx
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
lea    (%rcx,%rcx,1),%edx
and    %edi,%edx
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
lea    0x0(,%rcx,4),%edx
and    %edi,%edx
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
lea    0x0(,%rcx,8),%edx
and    %edi,%edx
cmp    $0x1,%edx
sbb    $0xffffffff,%eax
shl    $0x4,%ecx
jne    1110 <bits+0x10>
ret

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

LLVM IR (-O2):
define i32 @bits(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %24, %2 ]
%4 = phi i32 [ 0, %1 ], [ %23, %2 ]
%5 = and i32 %3, %0
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
%8 = add i32 %4, %7
%9 = shl i32 %3, 1
%10 = and i32 %9, %0
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
%13 = add i32 %8, %12
%14 = shl i32 %3, 2
%15 = and i32 %14, %0
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
%18 = add i32 %13, %17
%19 = shl i32 %3, 3
%20 = and i32 %19, %0
%21 = icmp ne i32 %20, 0
%22 = zext i1 %21 to i32
%23 = add i32 %18, %22
%24 = shl i32 %3, 4
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %2
26: ; preds = %2
ret i32 %23
}
/* Type definitions */
struct myproc {
  int dummy;
};

/* Variables and functions */
char const *machine_proc_display_line_default(struct myproc *);
const char *machine_proc_display_line(struct myproc *p) {
  return machine_proc_display_line_default(p);
}


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

x86 assembly (clang, -O2):
<machine_proc_display_line>:
jmp    1030 <machine_proc_display_line_default@plt>

LLVM IR (-O0):
%struct.myproc = type { i32 }
define i8* @machine_proc_display_line(%struct.myproc* %0) {
%2 = alloca %struct.myproc*
store %struct.myproc* %0, %struct.myproc** %2
%3 = load %struct.myproc*, %struct.myproc** %2
%4 = call i8* @machine_proc_display_line_default(%struct.myproc* %3)
ret i8* %4
}

LLVM IR (-O2):
%struct.myproc = type { i32 }
define i8* @machine_proc_display_line(%struct.myproc* %0) {
%2 = tail call i8* @machine_proc_display_line_default(%struct.myproc* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ s_free_(char *, char *, int);
int /*<<< orphan*/ s_hook_memory_close();
int /*<<< orphan*/ s_hook_memory_open();
char *s_malloc_(int, char *, int);
void s_hook_memory_test() {
  char *p;
  s_hook_memory_open();
  p = s_malloc_(1024,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/kujirahand/sakuramml-c/refs/"
                "heads/master/src/s_hook_memory_test.c",
                11);
  s_free_(p,
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/kujirahand/sakuramml-c/refs/heads/master/"
          "src/s_hook_memory_test.c",
          12);
  s_hook_memory_close();
}


x86 assembly (clang, -O0):
<s_hook_memory_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <s_hook_memory_open@plt>
mov    $0x400,%edi
lea    0xea5(%rip),%rsi
mov    $0xb,%edx
call   1050 <s_malloc_@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8c(%rip),%rsi
mov    $0xc,%edx
call   1040 <s_free_@plt>
mov    $0x0,%al
call   1030 <s_hook_memory_close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_hook_memory_test>:
push   %rbx
xor    %eax,%eax
call   1060 <s_hook_memory_open@plt>
lea    0xeb1(%rip),%rbx
mov    $0x400,%edi
mov    %rbx,%rsi
mov    $0xb,%edx
call   1050 <s_malloc_@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
mov    $0xc,%edx
call   1040 <s_free_@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <s_hook_memory_close@plt>

LLVM IR (-O0):
@.str = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kujirahand/sakuramml-c/refs/heads/master/src/s_hook_memory_test.c\00"
define void @s_hook_memory_test() {
%1 = alloca i8*
%2 = call i32 (...) @s_hook_memory_open()
%3 = call i8* @s_malloc_(i32 1024, i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 11)
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @s_free_(i8* %4, i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 12)
%6 = call i32 (...) @s_hook_memory_close()
ret void
}

LLVM IR (-O2):
@.str = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/kujirahand/sakuramml-c/refs/heads/master/src/s_hook_memory_test.c\00"
define void @s_hook_memory_test() {
%1 = tail call i32 (...) @s_hook_memory_open()
%2 = tail call i8* @s_malloc_(i32 1024, i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 11)
%3 = tail call i32 @s_free_(i8* %2, i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0), i32 12)
%4 = tail call i32 (...) @s_hook_memory_close()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Trees(int);
int main() {
  int i;
  for (i = 0; i < 5; i++)
    Trees(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1146 <main+0x36>
mov    -0x8(%rbp),%edi
call   1030 <Trees@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <Trees@plt>
mov    $0x1,%edi
call   1030 <Trees@plt>
mov    $0x2,%edi
call   1030 <Trees@plt>
mov    $0x3,%edi
call   1030 <Trees@plt>
mov    $0x4,%edi
call   1030 <Trees@plt>
xor    %eax,%eax
pop    %rcx
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 = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @Trees(i32 %7)
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @Trees(i32 0)
%2 = tail call i32 @Trees(i32 1)
%3 = tail call i32 @Trees(i32 2)
%4 = tail call i32 @Trees(i32 3)
%5 = tail call i32 @Trees(i32 4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
int get_bits(int /*<<< orphan*/ *, int, int);
int32_t get_bits_signed(uint8_t *data, int pos, int len) {
  uint32_t value, mask = 0;
  value = get_bits(data, pos, len);
  if (value & (1 << (len - 1)))
    mask = 0xffffffff << (len - 32);
  return value | mask;
}


x86 assembly (clang, -O0):
<get_bits_signed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <get_bits@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1168 <get_bits_signed+0x58>
mov    -0x10(%rbp),%ecx
sub    $0x20,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bits_signed>:
push   %rbx
mov    %edx,%ebx
call   1030 <get_bits@plt>
lea    -0x1(%rbx),%ecx
movzbl %cl,%edx
mov    $0xffffffff,%esi
mov    %ebx,%ecx
shl    %cl,%esi
xor    %ecx,%ecx
bt     %edx,%eax
cmovb  %esi,%ecx
or     %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_bits_signed(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
%9 = load i32*, i32** %4
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @get_bits(i32* %9, i32 %10, i32 %11)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 1
%16 = shl i32 1, %15
%17 = and i32 %13, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %3
%20 = load i32, i32* %6
%21 = sub nsw i32 %20, 32
%22 = shl i32 -1, %21
store i32 %22, i32* %8
br label %23
23: ; preds = %19, %3
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = or i32 %24, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @get_bits_signed(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @get_bits(i32* %0, i32 %1, i32 %2)
%5 = add nsw i32 %2, -1
%6 = shl nuw i32 1, %5
%7 = and i32 %4, %6
%8 = icmp eq i32 %7, 0
%9 = add nsw i32 %2, -32
%10 = shl nsw i32 -1, %9
%11 = select i1 %8, i32 0, i32 %10
%12 = or i32 %11, %4
ret i32 %12
}
unsigned char clear_bits(unsigned char b) { return (b & 0b01101011); }


x86 assembly (clang, -O0):
<clear_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x6b,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bits>:
mov    %edi,%eax
and    $0x6b,%al
ret

LLVM IR (-O0):
define zeroext i8 @clear_bits(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, 107
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @clear_bits(i8 zeroext %0) {
%2 = and i8 %0, 107
ret i8 %2
}
unsigned int str_length(char *str) {
  unsigned int i;
  for (i = 0; str[i] != '\0'; i++)
    ;
  i++;
  return i;
}


x86 assembly (clang, -O0):
<str_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1136 <str_length+0x36>
jmp    1128 <str_length+0x28>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <str_length+0xf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_length>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%ecx
add    $0x1,%eax
cmpb   $0x0,(%rdi,%rcx,1)
jne    1110 <str_length+0x10>
ret

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

LLVM IR (-O2):
define i32 @str_length(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 0, %1 ], [ %8, %2 ]
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add i32 %3, 1
br i1 %7, label %9, label %2
9: ; preds = %2
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *, char const *, char const *);
void usage(const char *cmd) {
  printf("run program as daemon\n"
         "COMMAND:\n"
         "  %s OPTIONS PROGRAM [PARAMETERS...]\n"
         "  %s --help\n"
         "OPTIONS:\n"
         "  --std_log: log file for stdout\n"
         "  --err_log: log file for stderr\n"
         "  --pid_file: pid file(supervisor pid)\n"
         "  --retry: PROGRAM restart limit\n"
         "  --help: show this message and exit\n"
         "EXAMPLE:\n"
         "  %s --std_log /var/log/hoge/errlog --err_log /var/log/hoge/stdlog "
         "--pid_file /var/run/hoge.pid --retry 10 hoge param\n",
         cmd, cmd, cmd);
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0x8(%rbp),%rcx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rcx
lea    0xed5(%rip),%rdi
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [392 x i8] c"run program as daemon\0ACOMMAND:\0A %s OPTIONS PROGRAM [PARAMETERS...]\0A %s --help\0AOPTIONS:\0A --std_log: log file for stdout\0A --err_log: log file for stderr\0A --pid_file: pid file(supervisor pid)\0A --retry: PROGRAM restart limit\0A --help: show this message and exit\0AEXAMPLE:\0A %s --std_log /var/log/hoge/errlog --err_log /var/log/hoge/stdlog --pid_file /var/run/hoge.pid --retry 10 hoge param\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([392 x i8], [392 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4, i8* %5)
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [392 x i8] c"run program as daemon\0ACOMMAND:\0A %s OPTIONS PROGRAM [PARAMETERS...]\0A %s --help\0AOPTIONS:\0A --std_log: log file for stdout\0A --err_log: log file for stderr\0A --pid_file: pid file(supervisor pid)\0A --retry: PROGRAM restart limit\0A --help: show this message and exit\0AEXAMPLE:\0A %s --std_log /var/log/hoge/errlog --err_log /var/log/hoge/stdlog --pid_file /var/run/hoge.pid --retry 10 hoge param\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([392 x i8], [392 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0, i8* %0)
%3 = tail call i32 @exit(i32 0)
unreachable
}
char *log_ident() { return "$Id: log_devel.c 230 2007-10-23 17:42:49Z  $"; }


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

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

LLVM IR (-O0):
@.str = [45 x i8] c"$Id: log_devel.c 230 2007-10-23 17:42:49Z $\00"
define i8* @log_ident() {
ret i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [45 x i8] c"$Id: log_devel.c 230 2007-10-23 17:42:49Z $\00"
define i8* @log_ident() {
ret i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ sem_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int sem_wait(int /*<<< orphan*/ *);
void *child_fn(void *semV) {
  int r;
  sem_t *sem = (sem_t *)semV;
  r = sem_wait(sem);
  assert(!r);
  return NULL;
}


x86 assembly (clang, -O0):
<child_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <sem_wait@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_fn>:
push   %rax
call   1030 <sem_wait@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @child_fn(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = call i32 @sem_wait(i32* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
%11 = xor i1 %10, true
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @child_fn(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @sem_wait(i32* %2)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret i8* null
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
void set_uninitialized(struct timespec *ts) { ts->tv_sec = ts->tv_nsec = 0; }


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

x86 assembly (clang, -O2):
<set_uninitialized>:
xorps  %xmm0,%xmm0
movups %xmm0,(%rdi)
ret

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

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define void @set_uninitialized(%struct.timespec* nocapture writeonly %0) {
%2 = bitcast %struct.timespec* %0 to i8*
ret void
}
__attribute__((no, noclone)) signed __int128 t116_3mul(unsigned __int128 y) {
  signed __int128 r;
  if (__builtin_mul_overflow((signed __int128)(-1), y, &r))
    bar();
  return r;
}


x86 assembly (clang, -O0):
<t116_3mul>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdx
mov    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %rdx,%rcx
neg    %rcx
mov    %eax,%ecx
sbb    %rsi,%rcx
neg    %rdx
movabs $0x8000000000000000,%rax
sbb    %rsi,%rax
setb   %al
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x38(%rbp)
test   $0x1,%al
jne    116d <t116_3mul+0x5d>
jmp    1174 <t116_3mul+0x64>
mov    $0x0,%al
call   1030 <bar@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rdx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t116_3mul>:
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
mov    %rdi,%rbx
neg    %rbx
sbb    %rsi,%r14
cmp    $0x1,%rdi
movabs $0x8000000000000000,%rax
sbb    %rax,%rsi
jb     113a <t116_3mul+0x2a>
xor    %eax,%eax
call   1030 <bar@plt>
mov    %rbx,%rax
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define { i64, i64 } @t116_3mul(i64 %0, i64 %1) {
%3 = alloca i128
%4 = alloca i128
%5 = alloca i128
%6 = alloca i128
%7 = bitcast i128* %4 to { i64, i64 }*
%8 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 0
store i64 %0, i64* %8
%9 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %7, i32 0, i32 1
store i64 %1, i64* %9
%10 = load i128, i128* %4
store i128 %10, i128* %5
%11 = load i128, i128* %5
%12 = call { i128, i1 } @llvm.umul.with.overflow.i128(i128 1, i128 %11)
%13 = extractvalue { i128, i1 } %12, 1
%14 = extractvalue { i128, i1 } %12, 0
%15 = icmp ugt i128 %14, -170141183460469231731687303715884105728
%16 = or i1 %13, %15
%17 = sub i128 0, %14
%18 = select i1 true, i128 %17, i128 %14
store i128 %18, i128* %6
br i1 %16, label %19, label %21
19: ; preds = %2
%20 = call i32 (...) @bar()
br label %21
21: ; preds = %19, %2
%22 = load i128, i128* %6
store i128 %22, i128* %3
%23 = bitcast i128* %3 to { i64, i64 }*
%24 = load { i64, i64 }, { i64, i64 }* %23
ret { i64, i64 } %24
}

LLVM IR (-O2):
define { i64, i64 } @t116_3mul(i64 %0, i64 %1) {
%3 = zext i64 %1 to i128
%4 = shl nuw i128 %3, 64
%5 = zext i64 %0 to i128
%6 = or i128 %4, %5
%7 = icmp ugt i128 %6, -170141183460469231731687303715884105728
%8 = sub i128 0, %6
br i1 %7, label %9, label %11
9: ; preds = %2
%10 = tail call i32 (...) @bar()
br label %11
11: ; preds = %9, %2
%12 = trunc i128 %8 to i64
%13 = lshr i128 %8, 64
%14 = trunc i128 %13 to i64
%15 = insertvalue { i64, i64 } poison, i64 %12, 0
%16 = insertvalue { i64, i64 } %15, i64 %14, 1
ret { i64, i64 } %16
}
/* Variables and functions */
scalar_t__ strlen(char *);
int bytes_per_pixel(char *mode) { return (int)strlen(mode); }


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

x86 assembly (clang, -O2):
<bytes_per_pixel>:
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i32 @bytes_per_pixel(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @strlen(i8* %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @bytes_per_pixel(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Type definitions */
struct kb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct kb *);
void kb_delete(struct kb *self) { free(self); }


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

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

LLVM IR (-O0):
%struct.kb = type { i32 }
define void @kb_delete(%struct.kb* %0) {
%2 = alloca %struct.kb*
store %struct.kb* %0, %struct.kb** %2
%3 = load %struct.kb*, %struct.kb** %2
%4 = call i32 @free(%struct.kb* %3)
ret void
}

LLVM IR (-O2):
%struct.kb = type { i32 }
define void @kb_delete(%struct.kb* nocapture %0) {
%2 = tail call i32 @free(%struct.kb* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int **, unsigned long);
int /*<<< orphan*/ test_assert(int);
int main(void) {
  int c;
  int *p;
  foo(&p, (unsigned long)&c);
  *p = 3;
  test_assert(c == 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
call   1030 <foo@plt>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
cmpl   $0x3,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <test_assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1030 <foo@plt>
mov    0x10(%rsp),%rax
movl   $0x3,(%rax)
xor    %edi,%edi
cmpl   $0x3,0xc(%rsp)
sete   %dil
call   1040 <test_assert@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = ptrtoint i32* %2 to i64
%5 = call i32 @foo(i32** %3, i64 %4)
%6 = load i32*, i32** %3
store i32 3, i32* %6
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 3
%9 = zext i1 %8 to i32
%10 = call i32 @test_assert(i32 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32** %2 to i8*
%5 = ptrtoint i32* %1 to i64
%6 = call i32 @foo(i32** %2, i64 %5)
%7 = load i32*, i32** %2
store i32 3, i32* %7
%8 = load i32, i32* %1
%9 = icmp eq i32 %8, 3
%10 = zext i1 %9 to i32
%11 = call i32 @test_assert(i32 %10)
ret i32 0
}
signed char foo1() { return 1; }


x86 assembly (clang, -O0):
<foo1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%al
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo1>:
mov    $0x1,%al
ret

LLVM IR (-O0):
define signext i8 @foo1() {
ret i8 1
}

LLVM IR (-O2):
define signext i8 @foo1() {
ret i8 1
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
uint16_t readShort(FILE *file) {
  uint32_t c1 = (uint32_t)(getc(file) << 8);
  uint32_t c2 = (uint32_t)(getc(file));
  return (uint16_t)(c1 | c2);
}


x86 assembly (clang, -O0):
<readShort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readShort>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <getc@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
mov    %rbx,%rdi
call   1030 <getc@plt>
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @readShort(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = call i32 @getc(i32* %5)
%7 = shl i32 %6, 8
store i32 %7, i32* %3
%8 = load i32*, i32** %2
%9 = call i32 @getc(i32* %8)
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = or i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @readShort(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = shl i32 %2, 8
%4 = tail call i32 @getc(i32* %0)
%5 = or i32 %3, %4
ret i32 %5
}
/* Variables and functions */
scalar_t__ memcpy(void *, void const *, size_t);
void *mempcpy(void *dst, const void *src, size_t len) {
  return (void *)((char *)memcpy(dst, src, len) + len);
}


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

x86 assembly (clang, -O2):
<mempcpy>:
push   %rbx
mov    %rdx,%rbx
call   1030 <memcpy@plt>
add    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @mempcpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i64 @memcpy(i8* %7, i8* %8, i64 %9)
%11 = inttoptr i64 %10 to i8*
%12 = load i64, i64* %6
%13 = getelementptr inbounds i8, i8* %11, i64 %12
ret i8* %13
}

LLVM IR (-O2):
define i8* @mempcpy(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @memcpy(i8* %0, i8* %1, i64 %2)
%5 = inttoptr i64 %4 to i8*
%6 = getelementptr inbounds i8, i8* %5, i64 %2
ret i8* %6
}
double dp_div(double a, double b) { return a / b; }


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

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

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

LLVM IR (-O2):
define double @dp_div(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
int total_motifs(int length) {
  int i;
  int n_motifs;
  n_motifs = 1;
  for (i = 1; i <= length; i++)
    n_motifs = n_motifs * 4;
  return n_motifs;
}


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

x86 assembly (clang, -O2):
<total_motifs>:
test   %edi,%edi
jle    1118 <total_motifs+0x18>
lea    -0x1(%rdi),%eax
mov    %edi,%ecx
and    $0x7,%ecx
cmp    $0x7,%eax
jae    111e <total_motifs+0x1e>
mov    $0x1,%eax
jmp    1138 <total_motifs+0x38>
mov    $0x1,%eax
ret
and    $0xfffffff8,%edi
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
shl    $0x10,%eax
add    $0xfffffff8,%edi
jne    1130 <total_motifs+0x30>
test   %ecx,%ecx
je     1148 <total_motifs+0x48>
nopl   0x0(%rax)
shl    $0x2,%eax
add    $0xffffffff,%ecx
jne    1140 <total_motifs+0x40>
ret

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

LLVM IR (-O2):
define i32 @total_motifs(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %25, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = and i32 %0, 7
%6 = icmp ult i32 %4, 7
br i1 %6, label %15, label %7
7: ; preds = %3
%8 = and i32 %0, -8
br label %9
9: ; preds = %9, %7
%10 = phi i32 [ 1, %7 ], [ %12, %9 ]
%11 = phi i32 [ 0, %7 ], [ %13, %9 ]
%12 = shl i32 %10, 16
%13 = add i32 %11, 8
%14 = icmp eq i32 %13, %8
br i1 %14, label %15, label %9
15: ; preds = %9, %3
%16 = phi i32 [ undef, %3 ], [ %12, %9 ]
%17 = phi i32 [ 1, %3 ], [ %12, %9 ]
%18 = icmp eq i32 %5, 0
br i1 %18, label %25, label %19
19: ; preds = %15, %19
%20 = phi i32 [ %22, %19 ], [ %17, %15 ]
%21 = phi i32 [ %23, %19 ], [ 0, %15 ]
%22 = shl nsw i32 %20, 2
%23 = add i32 %21, 1
%24 = icmp eq i32 %23, %5
br i1 %24, label %25, label %19
25: ; preds = %15, %19, %1
%26 = phi i32 [ 1, %1 ], [ %16, %15 ], [ %22, %19 ]
ret i32 %26
}
/* Variables and functions */
int PAPI_num_events(int);
void PAPIF_NUM_EVENTS(int *EventCode, int *count) {
  *count = PAPI_num_events(*EventCode);
}


x86 assembly (clang, -O0):
<PAPIF_NUM_EVENTS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <PAPI_num_events@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAPIF_NUM_EVENTS>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_num_events@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @PAPIF_NUM_EVENTS(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @PAPI_num_events(i32 %3)
store i32 %4, i32* %1
ret void
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
void SSIIntEnable(uint32_t ui32Base, uint32_t ui32IntFlags) {
  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000014))) |= ui32IntFlags;
}


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

x86 assembly (clang, -O2):
<SSIIntEnable>:
mov    %rdi,-0x8(%rsp)
mov    %rsi,-0x10(%rsp)
mov    -0x10(%rsp),%rax
mov    -0x8(%rsp),%rcx
or     %rax,0x14(%rcx)
ret

LLVM IR (-O0):
define void @SSIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add i64 %6, 20
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @SSIIntEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store volatile i64 %0, i64* %3
store volatile i64 %1, i64* %4
%5 = load volatile i64, i64* %4
%6 = load volatile i64, i64* %3
%7 = add i64 %6, 20
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}
void delay_ms(int j) {
  int k_max = clk_get_cpu_rate() / 1000 / 3;
  int k = k_max;
  for (; j > 0; j--) {
    for (k = k_max; k > 0; k--) {
      __asm__("nop");
    }
  }
  return;
}


x86 assembly (clang, -O0):
<delay_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clk_get_cpu_rate@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1177 <delay_ms+0x67>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1164 <delay_ms+0x54>
nop
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    114b <delay_ms+0x3b>
jmp    1169 <delay_ms+0x59>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    113b <delay_ms+0x2b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay_ms>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <clk_get_cpu_rate@plt>
test   %ebx,%ebx
jle    116b <delay_ms+0x5b>
movslq %eax,%rcx
imul   $0x57619f1,%rcx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
add    $0x1,%ecx
jmp    114a <delay_ms+0x3a>
nopw   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%edx
cmp    $0x1,%ebx
mov    %edx,%ebx
jle    116b <delay_ms+0x5b>
cmp    $0xbb8,%eax
jl     1140 <delay_ms+0x30>
mov    %ecx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
nop
add    $0xffffffff,%edx
cmp    $0x1,%edx
jg     1160 <delay_ms+0x50>
jmp    1140 <delay_ms+0x30>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @delay_ms(i32 %0) {
%2 = tail call i32 (...) @clk_get_cpu_rate()
%3 = sdiv i32 %2, 3000
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %16
5: ; preds = %1
%6 = icmp sgt i32 %2, 2999
br label %7
7: ; preds = %5, %13
%8 = phi i32 [ %0, %5 ], [ %14, %13 ]
br i1 %6, label %9, label %13
9: ; preds = %7, %9
%10 = phi i32 [ %11, %9 ], [ %3, %7 ]
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
%11 = add nsw i32 %10, -1
%12 = icmp sgt i32 %10, 1
br i1 %12, label %9, label %13
13: ; preds = %9, %7
%14 = add nsw i32 %8, -1
%15 = icmp sgt i32 %8, 1
br i1 %15, label %7, label %16
16: ; preds = %13, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ compileFactor();
int /*<<< orphan*/ compileTerm2();
void compileTerm(void) {
  compileFactor();
  compileTerm2();
}


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

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

LLVM IR (-O0):
define void @compileTerm() {
%1 = call i32 (...) @compileFactor()
%2 = call i32 (...) @compileTerm2()
ret void
}

LLVM IR (-O2):
define void @compileTerm() {
%1 = tail call i32 (...) @compileFactor()
%2 = tail call i32 (...) @compileTerm2()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ genraw(char *);
char *gsym(char *);
void genname(char *name) {
  genraw(gsym(name));
  genraw(":\n");
}


x86 assembly (clang, -O0):
<genname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <gsym@plt>
mov    %rax,%rdi
call   1040 <genraw@plt>
lea    0xebc(%rip),%rdi
call   1040 <genraw@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genname>:
push   %rax
call   1030 <gsym@plt>
mov    %rax,%rdi
call   1040 <genraw@plt>
lea    0xecb(%rip),%rdi
pop    %rax
jmp    1040 <genraw@plt>

LLVM IR (-O0):
@.str = [3 x i8] c":\0A\00"
define void @genname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @gsym(i8* %3)
%5 = call i32 @genraw(i8* %4)
%6 = call i32 @genraw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c":\0A\00"
define void @genname(i8* %0) {
%2 = tail call i8* @gsym(i8* %0)
%3 = tail call i32 @genraw(i8* %2)
%4 = tail call i32 @genraw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
void __attribute__((weak)) __libc_init_array(void) {}


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

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

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

LLVM IR (-O2):
define weak void @__libc_init_array() {
ret void
}
/* Variables and functions */
scalar_t__ ceil(int);
int log(int);
int bitof(int n) { return (int)(ceil(log(n) / log(2))); }


x86 assembly (clang, -O0):
<bitof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <log@plt>
mov    %eax,-0x8(%rbp)
mov    $0x2,%edi
call   1040 <log@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <ceil@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitof>:
push   %rbx
call   1040 <log@plt>
mov    %eax,%ebx
mov    $0x2,%edi
call   1040 <log@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%edi
pop    %rbx
jmp    1030 <ceil@plt>

LLVM IR (-O0):
define i32 @bitof(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @log(i32 %3)
%5 = call i32 @log(i32 2)
%6 = sdiv i32 %4, %5
%7 = call i64 @ceil(i32 %6)
%8 = trunc i64 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @bitof(i32 %0) {
%2 = tail call i32 @log(i32 %0)
%3 = tail call i32 @log(i32 2)
%4 = sdiv i32 %2, %3
%5 = tail call i64 @ceil(i32 %4)
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ yygen_tokdesc();
int /*<<< orphan*/ yygen_toktyp();
int /*<<< orphan*/ yygen_typdefs();
int main(void) {
  yygen_typdefs();
  yygen_toktyp();
  yygen_tokdesc();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @yygen_typdefs()
%2 = tail call i32 (...) @yygen_toktyp()
%3 = tail call i32 (...) @yygen_tokdesc()
ret i32 0
}
/* Variables and functions */
int countSwaps(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr[] = {1, 7, 3, 2, 4, 5, 6};
  int totalSwapsReq = countSwaps(arr, 7);
  printf("Total swaps required to sort the array is %d\n", totalSwapsReq);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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   1030 <countSwaps@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <countSwaps@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [7 x i32] [i32 1, i32 7, i32 3, i32 2, i32 4, i32 5, i32 6]
@.str = [46 x i8] c"Total swaps required to sort the array is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x i32]* %2 to i8*
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%6 = call i32 @countSwaps(i32* %5, i32 7)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [7 x i32] [i32 1, i32 7, i32 3, i32 2, i32 4, i32 5, i32 6]
@.str = [46 x i8] c"Total swaps required to sort the array is %d\0A\00"
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 @countSwaps(i32* %3, i32 7)
%5 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void kotlinclib_print_double(double message) { printf("%lf", message); }


x86 assembly (clang, -O0):
<kotlinclib_print_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define void @kotlinclib_print_double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define void @kotlinclib_print_double(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void dispArray(int *target, int index) {
  if (index == 0) {
    printf("\n");
    return;
  } else {
    printf("%d", *target);
    dispArray(++target, --index);
  }
}


x86 assembly (clang, -O0):
<dispArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114c <dispArray+0x2c>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    117a <dispArray+0x5a>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    %rdi,-0x8(%rbp)
mov    -0xc(%rbp),%esi
add    $0xffffffff,%esi
mov    %esi,-0xc(%rbp)
call   1030 <dispArray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dispArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     1157 <dispArray+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1140 <dispArray+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
define void @dispArray(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %2
%5 = tail call i32 @putchar(i32 10)
ret void
6: ; preds = %2, %6
%7 = phi i32 [ %12, %6 ], [ %1, %2 ]
%8 = phi i32* [ %11, %6 ], [ %0, %2 ]
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds i32, i32* %8, i64 1
%12 = add nsw i32 %7, -1
%13 = icmp eq i32 %12, 0
br i1 %13, label %4, label %6
}
/* Type definitions */
struct sched_param {
  int dummy;
};
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int pthread_getschedparam(pthread_t a, int *b, struct sched_param *c) {
  assert(0);
}


x86 assembly (clang, -O0):
<pthread_getschedparam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.sched_param = type { i32 }
define i32 @pthread_getschedparam(i32 %0, i32* %1, %struct.sched_param* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca %struct.sched_param*
store i32 %0, i32* %5
store i32* %1, i32** %6
store %struct.sched_param* %2, %struct.sched_param** %7
%8 = call i32 @assert(i32 0)
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
define i32 @pthread_getschedparam(i32 %0, i32* nocapture readnone %1, %struct.sched_param* nocapture readnone %2) {
%4 = tail call i32 @assert(i32 0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int system(const char *command) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<system>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec0(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<system>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @system(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @system(i8* nocapture readnone %0) {
%2 = load i32, i32* @ENOSYS
store i32 %2, i32* @errno
ret i32 -1
}