xunge/DecIR huggingface dataset:
int test_imm_C1uint8_reg(unsigned char val) {
  return ((val) & (0xC1 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_C1uint8_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, 193
%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_C1uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -63
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *memchr(char const *, char, size_t);
char *oml_memdupz(char const *, size_t);
char *oml_strndup(const char *str, size_t len) {
  char *p = memchr(str, '\0', len);
  return oml_memdupz(str, p ? (size_t)(p - str) : len);
}


x86 assembly (clang, -O0):
<oml_strndup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1040 <memchr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     116a <oml_strndup+0x4a>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x28(%rbp)
jmp    1172 <oml_strndup+0x52>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1030 <oml_memdupz@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oml_strndup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memchr@plt>
mov    %rax,%rsi
sub    %rbx,%rsi
test   %rax,%rax
cmove  %r14,%rsi
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <oml_memdupz@plt>

LLVM IR (-O0):
define i8* @oml_strndup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @memchr(i8* %6, i8 signext 0, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %3
%10 = load i8*, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = load i8*, i8** %3
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
br label %20
18: ; preds = %2
%19 = load i64, i64* %4
br label %20
20: ; preds = %18, %12
%21 = phi i64 [ %17, %12 ], [ %19, %18 ]
%22 = call i8* @oml_memdupz(i8* %9, i64 %21)
ret i8* %22
}

LLVM IR (-O2):
define i8* @oml_strndup(i8* %0, i64 %1) {
%3 = tail call i8* @memchr(i8* %0, i8 signext 0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = select i1 %4, i64 %1, i64 %7
%9 = tail call i8* @oml_memdupz(i8* %0, i64 %8)
ret i8* %9
}
int biz22w_dialer(num, acu)
char *num, *acu;
{ return (biz_dialer(num, "W")); }


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

x86 assembly (clang, -O2):
<biz22w_dialer>:
lea    0xee9(%rip),%rsi
xor    %eax,%eax
jmp    1030 <biz_dialer@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"W\00"
define i32 @biz22w_dialer(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @biz_dialer to i32 (i8*, i8*, ...)*)(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 %6
}

LLVM IR (-O2):
@.str = [2 x i8] c"W\00"
define i32 @biz22w_dialer(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @biz_dialer to i32 (i8*, i8*, ...)*)(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ is_serial_ready_to_write(unsigned short);
int /*<<< orphan*/ write_port(unsigned short, char);
void write_serial_data_until_is_empty(unsigned short com, char data) {
  while (!is_serial_ready_to_write(com)) {
    continue;
  }
  write_port((com), data);
}


x86 assembly (clang, -O0):
<write_serial_data_until_is_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movzwl -0x2(%rbp),%edi
call   1040 <is_serial_ready_to_write@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1153 <write_serial_data_until_is_empty+0x33>
jmp    1158 <write_serial_data_until_is_empty+0x38>
jmp    1135 <write_serial_data_until_is_empty+0x15>
mov    -0x2(%rbp),%ax
movzwl %ax,%edi
movsbl -0x3(%rbp),%esi
call   1030 <write_port@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_serial_data_until_is_empty>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
movzwl %di,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1040 <is_serial_ready_to_write@plt>
test   %eax,%eax
je     1130 <write_serial_data_until_is_empty+0x10>
movsbl %bl,%esi
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <write_port@plt>

LLVM IR (-O0):
define void @write_serial_data_until_is_empty(i16 zeroext %0, i8 signext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
br label %5
5: ; preds = %10, %2
%6 = load i16, i16* %3
%7 = call i32 @is_serial_ready_to_write(i16 zeroext %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %11
10: ; preds = %5
br label %5
11: ; preds = %5
%12 = load i16, i16* %3
%13 = load i8, i8* %4
%14 = call i32 @write_port(i16 zeroext %12, i8 signext %13)
ret void
}

LLVM IR (-O2):
define void @write_serial_data_until_is_empty(i16 zeroext %0, i8 signext %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @is_serial_ready_to_write(i16 zeroext %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %3, label %6
6: ; preds = %3
%7 = tail call i32 @write_port(i16 zeroext %0, i8 signext %1)
ret void
}
char next(char c) {
  switch (c) {
  case '(':
    return ')';
  default:
    return '\0';
  }
}


x86 assembly (clang, -O0):
<next>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
sub    $0x28,%al
jne    1123 <next+0x23>
jmp    111a <next+0x1a>
movb   $0x29,-0x1(%rbp)
jmp    1127 <next+0x27>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next>:
xor    %ecx,%ecx
cmp    $0x28,%dil
mov    $0x29,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define signext i8 @next(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 40, label %6
]
6: ; preds = %1
store i8 41, i8* %2
br label %8
7: ; preds = %1
store i8 0, i8* %2
br label %8
8: ; preds = %7, %6
%9 = load i8, i8* %2
ret i8 %9
}

LLVM IR (-O2):
define signext i8 @next(i8 signext %0) {
%2 = icmp eq i8 %0, 40
%3 = select i1 %2, i8 41, i8 0
ret i8 %3
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
int main(void) {
  void *ptr = malloc(5555);
  if (ptr == NULL) {
    return 1;
  }
  int a = 3;
  while (a-- > 0) {
    ptr = malloc(2222);
    if (ptr == NULL) {
      break;
    }
  }
  free(malloc(1111));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x15b3,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <main+0x34>
movl   $0x1,-0x4(%rbp)
jmp    11ab <main+0x8b>
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jle    1192 <main+0x72>
mov    $0x8ae,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    118d <main+0x6d>
jmp    1192 <main+0x72>
jmp    115b <main+0x3b>
mov    $0x457,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call dereferenceable_or_null(1111) i8* @malloc(i32 1111)
%2 = tail call i32 @free(i8* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ malloc(int);
int main() {
  char str[10];
  malloc(123);
  gets(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7b,%edi
call   1040 <malloc@plt>
lea    -0xe(%rbp),%rdi
call   1030 <gets@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    $0x7b,%edi
call   1040 <malloc@plt>
lea    0xe(%rsp),%rdi
call   1030 <gets@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = call i32 @malloc(i32 123)
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @malloc(i32 123)
%4 = call i32 @gets(i8* %2)
ret i32 0
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int fork();
int /*<<< orphan*/ perror(char *);
pid_t xfork(void) {
  pid_t pid;
  if ((pid = fork()) == -1) {
    perror("Error in fork() :");
    return (-1);
  }
  return (pid);
}


x86 assembly (clang, -O0):
<xfork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fork@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    1153 <xfork+0x33>
lea    0xebe(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <xfork+0x39>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfork>:
push   %rbx
xor    %eax,%eax
call   1040 <fork@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     1133 <xfork+0x13>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xec6(%rip),%rdi
call   1030 <perror@plt>
jmp    112f <xfork+0xf>

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

LLVM IR (-O2):
@.str = [18 x i8] c"Error in fork() :\00"
define i32 @xfork() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %0, %3
ret i32 %1
}
/* Variables and functions */
int Add(int, int);
int AddReg(int, int);
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", AddReg(10, 15));
  printf("%d\n", Add(10, 15));
  int a = 10, b = 15, sum;
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
mov    $0xf,%esi
call   1040 <AddReg@plt>
mov    %eax,%esi
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0xf,%esi
call   1050 <Add@plt>
mov    %eax,%esi
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
movl   $0xa,-0x8(%rbp)
movl   $0xf,-0xc(%rbp)
mov    0x2e52(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
mov    $0xf,%esi
call   1040 <AddReg@plt>
lea    0xeb9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0xf,%esi
call   1050 <Add@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e6f(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @AddReg(i32 10, i32 15)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @Add(i32 10, i32 15)
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
store i32 10, i32* %2
store i32 15, i32* %3
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @AddReg(i32 10, i32 15)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @Add(i32 10, i32 15)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
int fexecve(int fd, char *const argv[], char *const envp[]) {
  anvil_syslog(0, "%s unimplemented\n", __FUNCTION__);
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<fexecve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
lea    0xed4(%rip),%rsi
lea    0xedf(%rip),%rdx
mov    $0x0,%al
call   1030 <anvil_syslog@plt>
jmp    113a <fexecve+0x2a>

x86 assembly (clang, -O2):
<fexecve>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0xef3(%rip),%rdx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <anvil_syslog@plt>
nopl   0x0(%rax,%rax,1)
jmp    1130 <fexecve+0x20>

LLVM IR (-O0):
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.fexecve = [8 x i8] c"fexecve\00"
define i32 @fexecve(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__FUNCTION__.fexecve, i64 0, i64 0))
br label %8
8: ; preds = %3, %8
br label %8
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.fexecve = [8 x i8] c"fexecve\00"
define i32 @fexecve(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = tail call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @__FUNCTION__.fexecve, i64 0, i64 0))
br label %5
5: ; preds = %3, %5
br label %5
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
extern short guess(int min, int max) {
  srand((unsigned)time(NULL));
  return (rand() % min) + max;
}


x86 assembly (clang, -O0):
<guess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
cltd
idivl  -0x4(%rbp)
add    -0x8(%rbp),%edx
mov    %dx,%ax
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<guess>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
cltd
idiv   %ebp
add    %edx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define signext i16 @guess(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i64 @time(i32* null)
%6 = trunc i64 %5 to i32
%7 = call i32 @srand(i32 %6)
%8 = call i32 (...) @rand()
%9 = load i32, i32* %3
%10 = srem i32 %8, %9
%11 = load i32, i32* %4
%12 = add nsw i32 %10, %11
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define signext i16 @guess(i32 %0, i32 %1) {
%3 = tail call i64 @time(i32* null)
%4 = trunc i64 %3 to i32
%5 = tail call i32 @srand(i32 %4)
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, %0
%8 = add nsw i32 %7, %1
%9 = trunc i32 %8 to i16
ret i16 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *argv[]) {
  printf("%s [-f] [-w <sec>] [-k <sec>] [-s] [-h|--help]\n"
         "A simple watchdog daemon that send WDIOC_KEEPALIVE ioctl every some\n"
         "\"heartbeat of keepalives\" seconds.\n"
         "Options:\n"
         "\t-f        start in foreground (background is default)\n"
         "\t-w <sec>  set the watchdog counter to <sec> in seconds\n"
         "\t-k <sec>  set the \"heartbeat of keepalives\" to <sec> in seconds\n"
         "\t-s        safe exit (disable Watchdog) for CTRL-c and kill "
         "-SIGTERM signals\n"
         "\t--help|-h write this help message and exit\n",
         argv[0]);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    (%rdi),%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [457 x i8] c"%s [-f] [-w <sec>] [-k <sec>] [-s] [-h|--help]\0AA simple watchdog daemon that send WDIOC_KEEPALIVE ioctl every some\0A\22heartbeat of keepalives\22 seconds.\0AOptions:\0A\09-f start in foreground (background is default)\0A\09-w <sec> set the watchdog counter to <sec> in seconds\0A\09-k <sec> set the \22heartbeat of keepalives\22 to <sec> in seconds\0A\09-s safe exit (disable Watchdog) for CTRL-c and kill -SIGTERM signals\0A\09--help|-h write this help message and exit\0A\00"
define void @usage(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([457 x i8], [457 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [457 x i8] c"%s [-f] [-w <sec>] [-k <sec>] [-s] [-h|--help]\0AA simple watchdog daemon that send WDIOC_KEEPALIVE ioctl every some\0A\22heartbeat of keepalives\22 seconds.\0AOptions:\0A\09-f start in foreground (background is default)\0A\09-w <sec> set the watchdog counter to <sec> in seconds\0A\09-k <sec> set the \22heartbeat of keepalives\22 to <sec> in seconds\0A\09-s safe exit (disable Watchdog) for CTRL-c and kill -SIGTERM signals\0A\09--help|-h write this help message and exit\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([457 x i8], [457 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}
/* Variables and functions */
bool nrf52_errata_134(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf52_errata_134() {
ret i32 0
}
/* Variables and functions */
double M_PI;
double sin(double);
double myfun_param(double x, void *data) {
  double omega = *((double *)data);
  return sin(omega * M_PI * x);
}


x86 assembly (clang, -O0):
<myfun_param>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    0x2eae(%rip),%rax
mulsd  (%rax),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfun_param>:
movsd  (%rdi),%xmm1
mov    0x2ecd(%rip),%rax
mulsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
jmp    1030 <sin@plt>

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @myfun_param(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca double
store double %0, double* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to double*
%8 = load double, double* %7
store double %8, double* %5
%9 = load double, double* %5
%10 = load double, double* @M_PI
%11 = fmul double %9, %10
%12 = load double, double* %3
%13 = fmul double %11, %12
%14 = call double @sin(double %13)
ret double %14
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @myfun_param(double %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to double*
%4 = load double, double* %3
%5 = load double, double* @M_PI
%6 = fmul double %4, %5
%7 = fmul double %6, %0
%8 = tail call double @sin(double %7)
ret double %8
}
/* Variables and functions */
int settty(int, char const *);
int setTTyMode(int fd, const char *mode) {
  int rcode;
  rcode = settty(fd, mode);
  return rcode;
}


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

x86 assembly (clang, -O2):
<setTTyMode>:
jmp    1030 <settty@plt>

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

LLVM IR (-O2):
define i32 @setTTyMode(i32 %0, i8* %1) {
%3 = tail call i32 @settty(i32 %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  printf("decimal\thexadecimal\toctal\t\tchar\n");
  printf("%d\t%x\t%o\t%c\n", EOF, EOF, EOF, EOF);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
mov    0x2ead(%rip),%rax
mov    (%rax),%ecx
mov    0x2ea4(%rip),%rax
mov    (%rax),%r8d
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eb4(%rip),%rax
mov    (%rax),%ecx
lea    0xec3(%rip),%rdi
mov    %ecx,%esi
mov    %ecx,%edx
mov    %ecx,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"decimal\09hexadecimal\09octal\09\09char\0A\00"
@.str.1 = [13 x i8] c"%d\09%x\09%o\09%c\0A\00"
@EOF = global i32 0
define i32 @main() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EOF
%3 = load i32, i32* @EOF
%4 = load i32, i32* @EOF
%5 = load i32, i32* @EOF
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3, i32 %4, i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"%d\09%x\09%o\09%c\0A\00"
@EOF = global i32 0
@str = [32 x i8] c"decimal\09hexadecimal\09octal\09\09char\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EOF
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %2, i32 %2, i32 %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
__attribute__((always_)) void XXH_free(void *p) { free(p); }


x86 assembly (clang, -O0):
<XXH_free>:
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):
<XXH_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @XXH_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
unsigned short fn5(unsigned short a) { return a >> 0xff03; }


x86 assembly (clang, -O0):
<fn5>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    $0xff03,%ecx
sar    %cl,%eax
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @fn5(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 65283
%6 = trunc i32 %5 to i16
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @fn5(i16 zeroext %0) {
ret i16 poison
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ transition(char *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "Usage: %s [exp]\n", *argv);
    return 1;
  }
  transition(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1168 <main+0x48>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xea9(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    117c <main+0x5c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <transition@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1133 <main+0x13>
mov    0x8(%rsi),%rdi
call   1040 <transition@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Usage: %s [exp]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %12
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @transition(i8* %10)
br label %12
12: ; preds = %8, %4
%13 = phi i32 [ 1, %4 ], [ 0, %8 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *PrintHello(void *thread_id) {
  long tid = (long)thread_id;
  ;
  printf("Hello World! It's thread #%ld!\n", tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<PrintHello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [32 x i8] c"Hello World! It's thread #%ld!\0A\00"
define i8* @PrintHello(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = call i32 @pthread_exit(i32* null)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [32 x i8] c"Hello World! It's thread #%ld!\0A\00"
define noalias i8* @PrintHello(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
int main(void) {
  int val1 = 0177;
  printf("%o, %#o\n", val1, val1);
  int val2 = 0xff;
  printf("%x, %X, %#x, %#X\n", val2, val2, val2, val2);
  _Bool val3 = 0;
  printf("%i\n", val3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7f,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xff,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x0,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%esi
lea    0xeac(%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    0xee8(%rip),%rdi
mov    $0x7f,%esi
mov    $0x7f,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
mov    $0xff,%esi
mov    $0xff,%edx
mov    $0xff,%ecx
mov    $0xff,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%o, %#o\0A\00"
@.str.1 = [18 x i8] c"%x, %X, %#x, %#X\0A\00"
@.str.2 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 127, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
store i32 255, i32* %3
%8 = load i32, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* %3
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9, i32 %10, i32 %11)
store i8 0, i8* %4
%13 = load i8, i8* %4
%14 = trunc i8 %13 to i1
%15 = zext i1 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%o, %#o\0A\00"
@.str.1 = [18 x i8] c"%x, %X, %#x, %#X\0A\00"
@.str.2 = [4 x i8] c"%i\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 127, i32 127)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 255, i32 255, i32 255, i32 255)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 0)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ safe_printf(char *);
int /*<<< orphan*/ safe_vprintf(char const *, int /*<<< orphan*/);
void tap_bail_out_va(const char *desc, va_list ap) {
  safe_printf("Bail out!");
  if (!desc) {
    goto out;
  }
  safe_printf(" ");
  safe_vprintf(desc, ap);
out:
  safe_printf("\n");
}


x86 assembly (clang, -O0):
<tap_bail_out_va>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <safe_printf@plt>
cmpq   $0x0,-0x8(%rbp)
jne    114b <tap_bail_out_va+0x2b>
jmp    1163 <tap_bail_out_va+0x43>
lea    0xeb8(%rip),%rdi
call   1030 <safe_printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <safe_vprintf@plt>
lea    0xea2(%rip),%rdi
call   1030 <safe_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tap_bail_out_va>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xed1(%rip),%rdi
call   1030 <safe_printf@plt>
test   %rbx,%rbx
je     114f <tap_bail_out_va+0x2f>
lea    0xeca(%rip),%rdi
call   1030 <safe_printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <safe_vprintf@plt>
lea    0xeb6(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <safe_printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"Bail out!\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @tap_bail_out_va(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @safe_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %2
br label %14
9: ; preds = %2
%10 = call i32 @safe_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = call i32 @safe_vprintf(i8* %11, i32 %12)
br label %14
14: ; preds = %9, %8
%15 = call i32 @safe_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Bail out!\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [2 x i8] c"\0A\00"
define void @tap_bail_out_va(i8* %0, i32 %1) {
%3 = tail call i32 @safe_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %0, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @safe_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @safe_vprintf(i8* %0, i32 %1)
br label %8
8: ; preds = %2, %5
%9 = tail call i32 @safe_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hexnum2(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int time(int /*<<< orphan*/);
void hexnum(char dst[]) {
  if (!hexnum2(dst))
    sprintf(dst, "%x", time(0));
}


x86 assembly (clang, -O0):
<hexnum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <hexnum2@plt>
cmp    $0x0,%eax
jne    116f <hexnum+0x3f>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %edi,%edi
call   1040 <time@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
lea    0xe96(%rip),%rsi
call   1050 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexnum>:
push   %rbx
mov    %rdi,%rbx
call   1030 <hexnum2@plt>
test   %eax,%eax
je     113f <hexnum+0xf>
pop    %rbx
ret
xor    %edi,%edi
call   1040 <time@plt>
lea    0xeb3(%rip),%rsi
mov    %rbx,%rdi
mov    %eax,%edx
pop    %rbx
jmp    1050 <sprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
define void @hexnum(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @hexnum2(i8* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @time(i32 0)
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define void @hexnum(i8* %0) {
%2 = tail call i32 @hexnum2(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @time(i32 0)
%6 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %7
7: ; preds = %4, %1
ret void
}
double divide2(double num1, double num2) { return num1 / num2; }


x86 assembly (clang, -O0):
<divide2>:
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):
<divide2>:
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @divide2(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 @divide2(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef void const *b;
typedef void *a;

/* Variables and functions */
int /*<<< orphan*/ cpy6(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int cpy8(void *, void const *);
void cpy14(void *a, const void *b) {
  cpy8(a, b), cpy6((uint8_t *)a + 8, (uint8_t *)b + 8);
}


x86 assembly (clang, -O0):
<cpy14>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <cpy8@plt>
mov    -0x8(%rbp),%rdi
add    $0x20,%rdi
mov    -0x10(%rbp),%rsi
add    $0x20,%rsi
call   1040 <cpy6@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpy14>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <cpy8@plt>
add    $0x20,%rbx
add    $0x20,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <cpy6@plt>

LLVM IR (-O0):
define void @cpy14(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @cpy8(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
%10 = getelementptr inbounds i32, i32* %9, i64 8
%11 = load i8*, i8** %4
%12 = bitcast i8* %11 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 8
%14 = call i32 @cpy6(i32* %10, i32* %13)
ret void
}

LLVM IR (-O2):
define void @cpy14(i8* %0, i8* %1) {
%3 = tail call i32 @cpy8(i8* %0, i8* %1)
%4 = getelementptr inbounds i8, i8* %0, i64 32
%5 = bitcast i8* %4 to i32*
%6 = getelementptr inbounds i8, i8* %1, i64 32
%7 = bitcast i8* %6 to i32*
%8 = tail call i32 @cpy6(i32* %5, i32* %7)
ret void
}
void av_frame_set_pkt_pos() {}


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

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

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

LLVM IR (-O2):
define void @av_frame_set_pkt_pos() {
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
void *calloc(int length) {
  char *space = (char *)malloc(length);
  for (int i = 0; i < length; i++) {
    space[i] = (char)0;
  }
  return (void *)space;
}


x86 assembly (clang, -O0):
<calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1154 <calloc+0x44>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <calloc+0x1e>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %ebp,%ebp
jle    113d <calloc+0x1d>
mov    %ebp,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @calloc(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = inttoptr i64 %2 to i8*
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %5, %1
ret i8* %3
}
/* Variables and functions */
double DBL_EPSILON;
double epsilondbl_(double *x) { return DBL_EPSILON; }


x86 assembly (clang, -O0):
<epsilondbl_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ed9(%rip),%rax
movsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<epsilondbl_>:
mov    0x2ee1(%rip),%rax
movsd  (%rax),%xmm0
ret

LLVM IR (-O0):
@DBL_EPSILON = global double 0.000000e+00
define double @epsilondbl_(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double, double* @DBL_EPSILON
ret double %3
}

LLVM IR (-O2):
@DBL_EPSILON = global double 0.000000e+00
define double @epsilondbl_(double* nocapture readnone %0) {
%2 = load double, double* @DBL_EPSILON
ret double %2
}
int exact_square(int number) {
  int i;
  if (number <= 2)
    return 0;
  for (i = 2; i <= number; ++i) {
    if (number == i * i) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     111d <exact_square+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1168 <exact_square+0x68>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1161 <exact_square+0x61>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0xc(%rbp),%ecx
cmp    %ecx,%eax
jne    114e <exact_square+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1168 <exact_square+0x68>
jmp    1153 <exact_square+0x53>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <exact_square+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
xor    %eax,%eax
cmp    $0x3,%edi
jl     1127 <exact_square+0x27>
mov    %edi,%ecx
neg    %ecx
mov    $0x2,%edx
mov    %edx,%esi
imul   %edx,%esi
cmp    %edi,%esi
je     1128 <exact_square+0x28>
lea    (%rcx,%rdx,1),%esi
add    $0x1,%esi
add    $0x1,%edx
cmp    $0x1,%esi
jne    1110 <exact_square+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp slt i32 %0, 3
br i1 %2, label %10, label %6
3: ; preds = %6
%4 = add nuw i32 %7, 1
%5 = icmp eq i32 %7, %0
br i1 %5, label %10, label %6
6: ; preds = %1, %3
%7 = phi i32 [ %4, %3 ], [ 2, %1 ]
%8 = mul nsw i32 %7, %7
%9 = icmp eq i32 %8, %0
br i1 %9, label %10, label %3
10: ; preds = %6, %3, %1
%11 = phi i32 [ 0, %1 ], [ 1, %6 ], [ 0, %3 ]
ret i32 %11
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int trace_grid_diagnostics(double *err, double *dis) {
  int *a, *b, fail;
  double c[2];
  fail = _ada_use_c2phc(56, a, b, c);
  *err = c[0];
  *dis = c[1];
  return fail;
}


x86 assembly (clang, -O0):
<trace_grid_diagnostics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    -0x40(%rbp),%rcx
mov    $0x38,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x24(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x24(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trace_grid_diagnostics>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rcx
mov    $0x38,%edi
call   1030 <_ada_use_c2phc@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @trace_grid_diagnostics(double* nocapture writeonly %0, double* nocapture writeonly %1) {
%3 = alloca [2 x double]
%4 = bitcast [2 x double]* %3 to i8*
%5 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%6 = call i32 @_ada_use_c2phc(i32 56, i32* undef, i32* undef, double* %5)
%7 = load double, double* %5
store double %7, double* %0
%8 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%9 = load double, double* %8
store double %9, double* %1
ret i32 %6
}