xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ mystrcat(char *, char *);
int /*<<< orphan*/ mystrcpy(char *, char *);
int /*<<< orphan*/ puts(char *);
int main() {
  char buf[50];
  char *src_1 = "hello";
  char *src_2 = "world";
  mystrcpy(buf, src_1);
  puts(buf);
  mystrcat(buf, src_2);
  puts(buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xeb5(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
call   1050 <mystrcpy@plt>
lea    -0x40(%rbp),%rdi
call   1030 <puts@plt>
lea    -0x40(%rbp),%rdi
mov    -0x50(%rbp),%rsi
call   1040 <mystrcat@plt>
lea    -0x40(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xec4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <mystrcpy@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
call   1040 <mystrcat@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"hello\00"
@.str.1 = [6 x i8] c"world\00"
define i32 @main() {
%1 = alloca [50 x i8]
%2 = getelementptr inbounds [50 x i8], [50 x i8]* %1, i64 0, i64 0
%3 = call i32 @mystrcpy(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @puts(i8* %2)
%5 = call i32 @mystrcat(i8* %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
void main() {
  extern enter_string(char str[80]);
  extern delete_string(char str[], char ch);
  extern print_string(char str[]);
  char c;
  char str[80];
  printf("do %d\n", enter_string(str));
  scanf("%c", &c);
  delete_string(str, c);
  print_string(str);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x60(%rbp),%rdi
call   1040 <enter_string@plt>
mov    %eax,%esi
lea    0xe96(%rip),%rdi
call   1050 <printf@plt>
lea    0xe91(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1070 <scanf@plt>
lea    -0x60(%rbp),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <delete_string@plt>
lea    -0x60(%rbp),%rdi
call   1060 <print_string@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <enter_string@plt>
lea    0xe97(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
lea    0xe90(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1070 <scanf@plt>
movsbl 0xf(%rsp),%esi
mov    %rbx,%rdi
call   1030 <delete_string@plt>
mov    %rbx,%rdi
call   1060 <print_string@plt>
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"do %d\0A\00"
@.str.1 = [3 x i8] c"%c\00"
define void @main() {
%1 = alloca i8
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = call i32 @enter_string(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = load i8, i8* %1
%9 = call i32 @delete_string(i8* %7, i8 signext %8)
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%11 = call i32 @print_string(i8* %10)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"do %d\0A\00"
@.str.1 = [3 x i8] c"%c\00"
define void @main() {
%1 = alloca i8
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = call i32 @enter_string(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%7 = load i8, i8* %1
%8 = call i32 @delete_string(i8* %3, i8 signext %7)
%9 = call i32 @print_string(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int chdir(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
char *strerror(int /*<<< orphan*/);
void chdir_parent() {
  int ret = chdir("..");
  if (ret != 0) {
    printf("chdir failed: %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<chdir_parent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1030 <chdir@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     118c <chdir_parent+0x4c>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    %rax,%rsi
lea    0xe8a(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chdir_parent>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <chdir@plt>
test   %eax,%eax
jne    1153 <chdir_parent+0x13>
pop    %rax
ret
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe9b(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"..\00"
@.str.1 = [18 x i8] c"chdir failed: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @chdir_parent() {
%1 = alloca i32
%2 = call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %0
%6 = load i32, i32* @errno
%7 = call i8* @strerror(i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %0
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"..\00"
@.str.1 = [18 x i8] c"chdir failed: %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define void @chdir_parent() {
%1 = tail call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = load i32, i32* @errno
%5 = tail call i8* @strerror(i32 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ ispunct(int);
void t_ispunct_0x3c() {
  Assert_real((ispunct(60)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_ispunct.c",
              305, ("ispunct should be 1 for <"));
}


x86 assembly (clang, -O0):
<t_ispunct_0x3c>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3c,%edi
call   1030 <ispunct@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x131,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_ispunct_0x3c>:
push   %rax
mov    $0x3c,%edi
call   1030 <ispunct@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x131,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 1 for <\00"
define void @t_ispunct_0x3c() {
%1 = call i32 @ispunct(i32 60)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 305, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_ispunct.c\00"
@.str.1 = [26 x i8] c"ispunct should be 1 for <\00"
define void @t_ispunct_0x3c() {
%1 = tail call i32 @ispunct(i32 60)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 305, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int start_command(char *, int /*<<< orphan*/ *, int, int, char *, char *,
                  char *);
int wait_command(int);
int run_command(char *cmd, sigset_t *mask, int infd, int outfd, char *a0,
                char *a1, char *a2) {
  int pid;
  if ((pid = start_command(cmd, mask, infd, outfd, a0, a1, a2)) < 0)
    return (-1);
  return (wait_command(pid));
}


x86 assembly (clang, -O0):
<run_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <start_command@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jge    117d <run_command+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1188 <run_command+0x68>
mov    -0x34(%rbp),%edi
call   1040 <wait_command@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_command>:
push   %rax
mov    0x10(%rsp),%rax
mov    %rax,(%rsp)
call   1030 <start_command@plt>
test   %eax,%eax
js     113b <run_command+0x1b>
mov    %eax,%edi
pop    %rax
jmp    1040 <wait_command@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @run_command(i8* %0, i32* %1, i32 %2, i32 %3, i8* %4, i8* %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
store i8* %0, i8** %9
store i32* %1, i32** %10
store i32 %2, i32* %11
store i32 %3, i32* %12
store i8* %4, i8** %13
store i8* %5, i8** %14
store i8* %6, i8** %15
%17 = load i8*, i8** %9
%18 = load i32*, i32** %10
%19 = load i32, i32* %11
%20 = load i32, i32* %12
%21 = load i8*, i8** %13
%22 = load i8*, i8** %14
%23 = load i8*, i8** %15
%24 = call i32 @start_command(i8* %17, i32* %18, i32 %19, i32 %20, i8* %21, i8* %22, i8* %23)
store i32 %24, i32* %16
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %7
store i32 -1, i32* %8
br label %30
27: ; preds = %7
%28 = load i32, i32* %16
%29 = call i32 @wait_command(i32 %28)
store i32 %29, i32* %8
br label %30
30: ; preds = %27, %26
%31 = load i32, i32* %8
ret i32 %31
}

LLVM IR (-O2):
define i32 @run_command(i8* %0, i32* %1, i32 %2, i32 %3, i8* %4, i8* %5, i8* %6) {
%8 = tail call i32 @start_command(i8* %0, i32* %1, i32 %2, i32 %3, i8* %4, i8* %5, i8* %6)
%9 = icmp slt i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @wait_command(i32 %8)
br label %12
12: ; preds = %7, %10
%13 = phi i32 [ %11, %10 ], [ -1, %7 ]
ret i32 %13
}
__strsep_2c(char **__s, char __reject1, char __reject2) {}


x86 assembly (clang, -O0):
<__strsep_2c>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @__strsep_2c(i8** nocapture readnone %0, i8 signext %1, i8 signext %2) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ Emit1(int);
void emit_brk(void) { Emit1(0xCC); }


x86 assembly (clang, -O0):
<emit_brk>:
push   %rbp
mov    %rsp,%rbp
mov    $0xcc,%edi
call   1030 <Emit1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_brk>:
mov    $0xcc,%edi
jmp    1030 <Emit1@plt>

LLVM IR (-O0):
define void @emit_brk() {
%1 = call i32 @Emit1(i32 204)
ret void
}

LLVM IR (-O2):
define void @emit_brk() {
%1 = tail call i32 @Emit1(i32 204)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ return_struct_vl1();
int /*<<< orphan*/ take_struct_vl1(int /*<<< orphan*/);
void test_struct_vl1() { take_struct_vl1(return_struct_vl1()); }


x86 assembly (clang, -O0):
<test_struct_vl1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <return_struct_vl1@plt>
mov    %eax,%edi
call   1030 <take_struct_vl1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_struct_vl1>:
push   %rax
xor    %eax,%eax
call   1040 <return_struct_vl1@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <take_struct_vl1@plt>

LLVM IR (-O0):
define void @test_struct_vl1() {
%1 = call i32 (...) @return_struct_vl1()
%2 = call i32 @take_struct_vl1(i32 %1)
ret void
}

LLVM IR (-O2):
define void @test_struct_vl1() {
%1 = tail call i32 (...) @return_struct_vl1()
%2 = tail call i32 @take_struct_vl1(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main() {
  int a, b, x, y;
  a = 20;
  b = 30;
  x = a++;
  y = --b;
  printf("%d %d %d %d", x, y, a, b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x14,-0x4(%rbp)
movl   $0x1e,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x14,%esi
mov    $0x1d,%edx
mov    $0x15,%ecx
mov    $0x1d,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 20, i32 29, i32 21, i32 29)
ret i32 0
}
void g_queue_pop_head() {}


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

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

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

LLVM IR (-O2):
define void @g_queue_pop_head() {
ret void
}
/* Variables and functions */
int STC3115_ReadByte(int);
int STC3115_ReadWord(int);
int STC3115_GetStatusWord(void) {
  int value;
  if (STC3115_ReadByte(0x18) != 0x14)
    return (-1);
  value = STC3115_ReadWord(0x00);
  value &= 0x7fff;
  return (value);
}


x86 assembly (clang, -O0):
<STC3115_GetStatusWord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x18,%edi
call   1040 <STC3115_ReadByte@plt>
cmp    $0x14,%eax
je     1147 <STC3115_GetStatusWord+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <STC3115_GetStatusWord+0x42>
xor    %edi,%edi
call   1030 <STC3115_ReadWord@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x7fff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STC3115_GetStatusWord>:
push   %rax
mov    $0x18,%edi
call   1040 <STC3115_ReadByte@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x14,%ecx
jne    1143 <STC3115_GetStatusWord+0x23>
xor    %edi,%edi
call   1030 <STC3115_ReadWord@plt>
and    $0x7fff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @STC3115_GetStatusWord() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @STC3115_ReadByte(i32 24)
%4 = icmp ne i32 %3, 20
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %1
br label %11
6: ; preds = %0
%7 = call i32 @STC3115_ReadWord(i32 0)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = and i32 %8, 32767
store i32 %9, i32* %2
%10 = load i32, i32* %2
store i32 %10, i32* %1
br label %11
11: ; preds = %6, %5
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @STC3115_GetStatusWord() {
%1 = tail call i32 @STC3115_ReadByte(i32 24)
%2 = icmp eq i32 %1, 20
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @STC3115_ReadWord(i32 0)
%5 = and i32 %4, 32767
br label %6
6: ; preds = %0, %3
%7 = phi i32 [ %5, %3 ], [ -1, %0 ]
ret i32 %7
}
/* Variables and functions */
int __builtin_ldex(unsigned char *);
int test_ldex(unsigned char *p1, unsigned char *p2) {
  int a, b, c, d;
  a = __builtin_ldex(p1);
  b = __builtin_ldex(p2);
  c = __builtin_ldex(p2 + 1);
  d = __builtin_ldex(p2 + 2);
  return a + b + c + d;
}


x86 assembly (clang, -O0):
<test_ldex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__builtin_ldex@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <__builtin_ldex@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <__builtin_ldex@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
call   1030 <__builtin_ldex@plt>
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ldex>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <__builtin_ldex@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
call   1030 <__builtin_ldex@plt>
mov    %eax,%ebp
lea    0x1(%rbx),%rdi
call   1030 <__builtin_ldex@plt>
mov    %eax,%r15d
add    $0x2,%rbx
mov    %rbx,%rdi
call   1030 <__builtin_ldex@plt>
add    %r14d,%ebp
add    %r15d,%ebp
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @test_ldex(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @__builtin_ldex(i8* %9)
store i32 %10, i32* %5
%11 = load i8*, i8** %4
%12 = call i32 @__builtin_ldex(i8* %11)
store i32 %12, i32* %6
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = call i32 @__builtin_ldex(i8* %14)
store i32 %15, i32* %7
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 2
%18 = call i32 @__builtin_ldex(i8* %17)
store i32 %18, i32* %8
%19 = load i32, i32* %5
%20 = load i32, i32* %6
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %7
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %8
%25 = add nsw i32 %23, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @test_ldex(i8* %0, i8* %1) {
%3 = tail call i32 @__builtin_ldex(i8* %0)
%4 = tail call i32 @__builtin_ldex(i8* %1)
%5 = getelementptr inbounds i8, i8* %1, i64 1
%6 = tail call i32 @__builtin_ldex(i8* %5)
%7 = getelementptr inbounds i8, i8* %1, i64 2
%8 = tail call i32 @__builtin_ldex(i8* %7)
%9 = add nsw i32 %4, %3
%10 = add nsw i32 %9, %6
%11 = add nsw i32 %10, %8
ret i32 %11
}
int chk(int n) {
  int sum = 0, tmp;
  tmp = n;
  while (n > 0) {
    sum = sum * 10;
    sum += n % 10;
    n /= 10;
  }
  if (tmp == sum)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<chk>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1149 <chk+0x49>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0xc(%rbp),%edx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1114 <chk+0x14>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1161 <chk+0x61>
movl   $0x1,-0x4(%rbp)
jmp    1168 <chk+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chk>:
xor    %edx,%edx
test   %edi,%edi
jle    1133 <chk+0x33>
mov    $0xcccccccd,%r8d
mov    %edi,%ecx
xchg   %ax,%ax
lea    (%rdx,%rdx,4),%r9d
mov    %ecx,%esi
imul   %r8,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ecx,%edx
sub    %eax,%edx
lea    (%rdx,%r9,2),%edx
cmp    $0x9,%ecx
mov    %esi,%ecx
ja     1110 <chk+0x10>
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @chk(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = mul nsw i32 %4, 10
%7 = urem i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = udiv i32 %5, 10
%10 = icmp ult i32 %5, 10
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
%13 = icmp eq i32 %12, %0
%14 = zext i1 %13 to i32
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void kb_wait_2_1(void) {
  unsigned long timeout = 2;
  do {
    (1 ? printf("timeout=%ld\n", timeout) : ({
      do {
        printf("error\n");
      } while (1);
    }));
    timeout--;
  } while (timeout);
}


x86 assembly (clang, -O0):
<kb_wait_2_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1120 <kb_wait_2_1+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kb_wait_2_1>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    $0x2,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%esi
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"timeout=%ld\0A\00"
define void @kb_wait_2_1() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 2)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 1)
ret void
}
/* Variables and functions */
char *strchr(char *, char);
char *next_arg_noskip(char **s) {
  char *r = *s;
  *s = strchr(r, ' ');
  if (*s)
    *(*s)++ = 0;
  return r;
}


x86 assembly (clang, -O0):
<next_arg_noskip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1161 <next_arg_noskip+0x51>
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_arg_noskip>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r14
mov    %r14,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     113c <next_arg_noskip+0x2c>
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,(%rbx)
movb   $0x0,(%rax)
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @next_arg_noskip(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @strchr(i8* %6, i8 signext 32)
%8 = load i8**, i8*** %2
store i8* %7, i8** %8
%9 = load i8**, i8*** %2
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %16
12: ; preds = %1
%13 = load i8**, i8*** %2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %13
store i8 0, i8* %14
br label %16
16: ; preds = %12, %1
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
define i8* @next_arg_noskip(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 32)
store i8* %3, i8** %0
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %6, i8** %0
store i8 0, i8* %3
br label %7
7: ; preds = %5, %1
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int _vscnprintf(char *buf, size_t size, const char *fmt, va_list args) {
  int n;
  n = vsnprintf(buf, size, fmt, args);
  return (n <= 0 ? 0 : (n < (int)size ? n : (int)(size - 1)));
}


x86 assembly (clang, -O0):
<_vscnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <vsnprintf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jg     1152 <_vscnprintf+0x42>
xor    %eax,%eax
mov    %eax,-0x24(%rbp)
jmp    117d <_vscnprintf+0x6d>
mov    -0x20(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    %ecx,%eax
jge    116c <_vscnprintf+0x5c>
mov    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    1177 <_vscnprintf+0x67>
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_vscnprintf>:
push   %rbx
mov    %rsi,%rbx
call   1030 <vsnprintf@plt>
lea    -0x1(%rbx),%edx
cmp    %ebx,%eax
cmovl  %eax,%edx
xor    %ecx,%ecx
test   %eax,%eax
cmovg  %edx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @_vscnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = load i8*, i8** %7
%13 = load i32, i32* %8
%14 = call i32 @vsnprintf(i8* %10, i64 %11, i8* %12, i32 %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp sle i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %4
br label %31
18: ; preds = %4
%19 = load i32, i32* %9
%20 = load i64, i64* %6
%21 = trunc i64 %20 to i32
%22 = icmp slt i32 %19, %21
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = load i32, i32* %9
br label %29
25: ; preds = %18
%26 = load i64, i64* %6
%27 = sub i64 %26, 1
%28 = trunc i64 %27 to i32
br label %29
29: ; preds = %25, %23
%30 = phi i32 [ %24, %23 ], [ %28, %25 ]
br label %31
31: ; preds = %29, %17
%32 = phi i32 [ 0, %17 ], [ %30, %29 ]
ret i32 %32
}

LLVM IR (-O2):
define i32 @_vscnprintf(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
%6 = trunc i64 %1 to i32
%7 = icmp slt i32 %5, %6
%8 = add i32 %6, -1
%9 = select i1 %7, i32 %5, i32 %8
%10 = icmp sgt i32 %5, 0
%11 = select i1 %10, i32 %9, i32 0
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test_pass(int temp) { printf("Test passed\n"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Test passed\0A\00"
define void @test_pass(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"Test passed\00"
define void @test_pass(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *jsonCmdString(char *, char *);
char *jsonCmdSetExtPan(char *extPanID) {
  return (jsonCmdString("setextpanid", extPanID));
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"setextpanid\00"
define i8* @jsonCmdSetExtPan(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @jsonCmdString(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i8* %4
}

LLVM IR (-O2):
@.str = [12 x i8] c"setextpanid\00"
define i8* @jsonCmdSetExtPan(i8* %0) {
%2 = tail call i8* @jsonCmdString(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void *);
int /*<<< orphan*/ stderr;
void rtpp_timed_task_cancel_fin(void *pub) {
  fprintf(stderr,
          "Method rtpp_timed_task@%p::cancel (rtpp_timed_task_cancel) is "
          "invoked after destruction\x0a",
          pub);
  abort();
}


x86 assembly (clang, -O0):
<rtpp_timed_task_cancel_fin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<rtpp_timed_task_cancel_fin>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [89 x i8] c"Method rtpp_timed_task@%p::cancel (rtpp_timed_task_cancel) is invoked after destruction\0A\00"
define void @rtpp_timed_task_cancel_fin(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [89 x i8] c"Method rtpp_timed_task@%p::cancel (rtpp_timed_task_cancel) is invoked after destruction\0A\00"
define void @rtpp_timed_task_cancel_fin(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 (...) @abort()
unreachable
}
tihello() {}


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

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

LLVM IR (-O0):
define i32 @tihello() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @tihello() {
ret i32 undef
}
execv(s, a) char *s, *a[];
{ ; }


x86 assembly (clang, -O0):
<execv>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @execv(i8* nocapture readnone %0, i8** nocapture readnone %1) {
ret i32 undef
}
/* Variables and functions */
int epoll_wait(int, void *, int, int);
int /*<<< orphan*/ vpn_ws_error(char *);
int vpn_ws_event_wait(int queue, void *events) {
  int ret = epoll_wait(queue, events, 64, -1);
  if (ret < 0) {
    vpn_ws_error("vpn_ws_event_wait()/epoll_wait()");
    return -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<vpn_ws_event_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x40,%edx
mov    $0xffffffff,%ecx
call   1040 <epoll_wait@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    116a <vpn_ws_event_wait+0x4a>
lea    0xea7(%rip),%rdi
call   1030 <vpn_ws_error@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1170 <vpn_ws_event_wait+0x50>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpn_ws_event_wait>:
push   %rax
mov    $0x40,%edx
mov    $0xffffffff,%ecx
call   1040 <epoll_wait@plt>
test   %eax,%eax
js     1136 <vpn_ws_event_wait+0x16>
pop    %rcx
ret
lea    0xec3(%rip),%rdi
call   1030 <vpn_ws_error@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"vpn_ws_event_wait()/epoll_wait()\00"
define i32 @vpn_ws_event_wait(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = call i32 @epoll_wait(i32 %7, i8* %8, i32 64, i32 -1)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @vpn_ws_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %16
14: ; preds = %2
%15 = load i32, i32* %6
store i32 %15, i32* %3
br label %16
16: ; preds = %14, %12
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str = [33 x i8] c"vpn_ws_event_wait()/epoll_wait()\00"
define i32 @vpn_ws_event_wait(i32 %0, i8* %1) {
%3 = tail call i32 @epoll_wait(i32 %0, i8* %1, i32 64, i32 -1)
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @vpn_ws_error(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ -1, %5 ], [ %3, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int main() {
  unsigned int a = 0x12fe34dc;
  if (((unsigned char *)&a)[0] != 0xdc) {
    _exit(-1);
  }
  if (((unsigned char *)&a)[1] != 0x34) {
    _exit(-2);
  }
  if (((unsigned char *)&a)[2] != 0xfe) {
    _exit(-3);
  }
  if (((unsigned char *)&a)[3] != 0x12) {
    _exit(-4);
  }
  _exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x12fe34dc,-0x8(%rbp)
movzbl -0x8(%rbp),%eax
cmp    $0xdc,%eax
je     113f <main+0x2f>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>
movzbl -0x7(%rbp),%eax
cmp    $0x34,%eax
je     1156 <main+0x46>
mov    $0xfffffffe,%edi
call   1030 <_exit@plt>
movzbl -0x6(%rbp),%eax
cmp    $0xfe,%eax
je     116f <main+0x5f>
mov    $0xfffffffd,%edi
call   1030 <_exit@plt>
movzbl -0x5(%rbp),%eax
cmp    $0x12,%eax
je     1186 <main+0x76>
mov    $0xfffffffc,%edi
call   1030 <_exit@plt>
xor    %edi,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 318649564, i32* %2
%3 = bitcast i32* %2 to i8*
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = icmp ne i32 %6, 220
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @_exit(i32 -1)
unreachable
10: ; preds = %0
%11 = bitcast i32* %2 to i8*
%12 = getelementptr inbounds i8, i8* %11, i64 1
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = icmp ne i32 %14, 52
br i1 %15, label %16, label %18
16: ; preds = %10
%17 = call i32 @_exit(i32 -2)
unreachable
18: ; preds = %10
%19 = bitcast i32* %2 to i8*
%20 = getelementptr inbounds i8, i8* %19, i64 2
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = icmp ne i32 %22, 254
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @_exit(i32 -3)
unreachable
26: ; preds = %18
%27 = bitcast i32* %2 to i8*
%28 = getelementptr inbounds i8, i8* %27, i64 3
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = icmp ne i32 %30, 18
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = call i32 @_exit(i32 -4)
unreachable
34: ; preds = %26
%35 = call i32 @_exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @_exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0xc9() {
  Assert_real((isalnum(201) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalnum.c",
              1010, ("isalnum should be 0 for 0xc9"));
}


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

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

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

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xc9\00"
define void @t_isalnum_0xc9() {
%1 = tail call i64 @isalnum(i32 201)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1010, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_smoother_pause() {
  printf("NOT IMPLEMENTED:"
         "pa_smoother_pause"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"NOT IMPLEMENTED:pa_smoother_pause\0A\00"
define i32 @pa_smoother_pause() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [34 x i8] c"NOT IMPLEMENTED:pa_smoother_pause\00"
define i32 @pa_smoother_pause() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int pow(float, int);
float calc_volume(float r) { return (4 * 3.14159265 * pow(r, 3)) / 3; }


x86 assembly (clang, -O0):
<calc_volume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
cvtsi2sd %eax,%xmm1
movsd  0xed0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  0xebc(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_volume>:
push   %rax
mov    $0x3,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xed6(%rip),%xmm0
divsd  0xed6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @calc_volume(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @pow(float %3, i32 3)
%5 = sitofp i32 %4 to double
%6 = fmul double 0x402921FB53C8D4F1, %5
%7 = fdiv double %6, 3.000000e+00
%8 = fptrunc double %7 to float
ret float %8
}

LLVM IR (-O2):
define float @calc_volume(float %0) {
%2 = tail call i32 @pow(float %0, i32 3)
%3 = sitofp i32 %2 to double
%4 = fmul double %3, 0x402921FB53C8D4F1
%5 = fdiv double %4, 3.000000e+00
%6 = fptrunc double %5 to float
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdout;
void usage(char *program_name) {
  printf("Usage: %s: -i [IFILE] -o [OFILE]\n", program_name);
  fputs(
      ("             -i | --input         input file                           "
       "           \n             -o | --output        output file             "
       "                        \n             -d | --debug         debug      "
       "                                     \n             -h | --help        "
       "  display help info                               \n\n"),
      stdout);
  exit(0);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%esi
lea    0xec6(%rip),%rdi
call   1040 <fputs@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xed2(%rip),%rdi
call   1040 <fputs@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Usage: %s: -i [IFILE] -o [OFILE]\0A\00"
@.str.1 = [334 x i8] c" -i | --input input file \0A -o | --output output file \0A -d | --debug debug \0A -h | --help display help info \0A\0A\00"
@stdout = global i32 0
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @stdout
%6 = call i32 @fputs(i8* getelementptr inbounds ([334 x i8], [334 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [34 x i8] c"Usage: %s: -i [IFILE] -o [OFILE]\0A\00"
@.str.1 = [334 x i8] c" -i | --input input file \0A -o | --output output file \0A -d | --debug debug \0A -h | --help display help info \0A\0A\00"
@stdout = global i32 0
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @stdout
%4 = tail call i32 @fputs(i8* getelementptr inbounds ([334 x i8], [334 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @exit(i32 0)
unreachable
}
void irq_acknowledge(int interrupt) {
  (*((volatile unsigned int *)((0x12000000 + 0x200) + 0x08))) =
      (1 << interrupt);
}


x86 assembly (clang, -O0):
<irq_acknowledge>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    $0x12000208,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<irq_acknowledge>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,0x12000208
ret

LLVM IR (-O0):
define void @irq_acknowledge(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 1, %3
store volatile i32 %4, i32* inttoptr (i64 301990408 to i32*)
ret void
}

LLVM IR (-O2):
define void @irq_acknowledge(i32 %0) {
%2 = shl nuw i32 1, %0
store volatile i32 %2, i32* inttoptr (i64 301990408 to i32*)
ret void
}
int dd_eq_dd_d(const double *a, double b) {
  return ((a[0] == b) && (a[1] == 0.0)) ? 1 : 0;
}


x86 assembly (clang, -O0):
<dd_eq_dd_d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
xor    %eax,%eax
ucomisd -0x10(%rbp),%xmm0
mov    %al,-0x11(%rbp)
jne    1146 <dd_eq_dd_d+0x46>
jp     1146 <dd_eq_dd_d+0x46>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dd_eq_dd_d>:
movsd  (%rdi),%xmm1
ucomisd %xmm0,%xmm1
jne    111f <dd_eq_dd_d+0x1f>
jp     111f <dd_eq_dd_d+0x1f>
xorpd  %xmm0,%xmm0
cmpeqsd 0x8(%rdi),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @dd_eq_dd_d(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 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double, double* %4
%9 = fcmp oeq double %7, %8
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = fcmp oeq double %13, 0.000000e+00
br label %15
15: ; preds = %10, %2
%16 = phi i1 [ false, %2 ], [ %14, %10 ]
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 1, i32 0
ret i32 %18
}

LLVM IR (-O2):
define i32 @dd_eq_dd_d(double* nocapture %0, double %1) {
%3 = load double, double* %0
%4 = fcmp oeq double %3, %1
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = getelementptr inbounds double, double* %0, i64 1
%7 = load double, double* %6
%8 = fcmp oeq double %7, 0.000000e+00
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %5, %2
%11 = phi i32 [ 0, %2 ], [ %9, %5 ]
ret i32 %11
}