xunge/DecIR huggingface dataset:
int ack(int m, int n) {
  if (m == 0)
    return n + 1;
  else if (m > 0 && n == 0)
    return ack(m - 1, 1);
  else
    return ack(m - 1, ack(m, n - 1));
}


x86 assembly (clang, -O0):
<ack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1136 <ack+0x26>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1186 <ack+0x76>
cmpl   $0x0,-0x8(%rbp)
jle    1162 <ack+0x52>
cmpl   $0x0,-0xc(%rbp)
jne    1162 <ack+0x52>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    $0x1,%esi
call   1030 <ack@plt>
mov    %eax,-0x4(%rbp)
jmp    1186 <ack+0x76>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <ack@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1030 <ack@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ack>:
push   %rbx
test   %edi,%edi
je     1140 <ack+0x30>
mov    %edi,%ebx
jmp    1131 <ack+0x21>
nopl   0x0(%rax)
add    $0xffffffff,%esi
mov    %ebx,%edi
call   1030 <ack@plt>
mov    %eax,%esi
add    $0xffffffff,%ebx
je     1142 <ack+0x32>
test   %ebx,%ebx
jle    1120 <ack+0x10>
mov    $0x1,%eax
test   %esi,%esi
je     112a <ack+0x1a>
jmp    1120 <ack+0x10>
mov    %esi,%eax
add    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ack(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %13, %2
%5 = phi i32 [ %1, %2 ], [ %14, %13 ]
%6 = add nsw i32 %5, 1
ret i32 %6
7: ; preds = %2, %13
%8 = phi i32 [ %14, %13 ], [ %1, %2 ]
%9 = phi i32 [ %15, %13 ], [ %0, %2 ]
%10 = icmp sgt i32 %9, 0
%11 = icmp eq i32 %8, 0
%12 = and i1 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %7, %17
%14 = phi i32 [ %19, %17 ], [ 1, %7 ]
%15 = add nsw i32 %9, -1
%16 = icmp eq i32 %15, 0
br i1 %16, label %4, label %7
17: ; preds = %7
%18 = add nsw i32 %8, -1
%19 = tail call i32 @ack(i32 %9, i32 %18)
br label %13
}
/* Variables and functions */
char to_hex_char(int a) {
  char ret;
  if (a < 10) {
    ret = '0' + a;
  } else {
    ret = 'a' + (a - 10);
  }
  return ret;
}


x86 assembly (clang, -O0):
<to_hex_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    111f <to_hex_char+0x1f>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x5(%rbp)
jmp    112b <to_hex_char+0x2b>
mov    -0x4(%rbp),%eax
sub    $0xa,%eax
add    $0x61,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_hex_char>:
cmp    $0xa,%edi
mov    $0x30,%ecx
mov    $0x57,%eax
cmovl  %ecx,%eax
add    %dil,%al
ret

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

LLVM IR (-O2):
define signext i8 @to_hex_char(i32 %0) {
%2 = icmp slt i32 %0, 10
%3 = trunc i32 %0 to i8
%4 = select i1 %2, i8 48, i8 87
%5 = add i8 %4, %3
ret i8 %5
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
void volatile_fetch_add_u8(uint8_t *dest, uint8_t val) {
  *((volatile uint8_t *)dest) += val;
}


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

x86 assembly (clang, -O2):
<volatile_fetch_add_u8>:
add    %rsi,(%rdi)
ret

LLVM IR (-O0):
define void @volatile_fetch_add_u8(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i64*, i64** %3
%7 = load volatile i64, i64* %6
%8 = add nsw i64 %7, %5
store volatile i64 %8, i64* %6
ret void
}

LLVM IR (-O2):
define void @volatile_fetch_add_u8(i64* %0, i64 %1) {
%3 = load volatile i64, i64* %0
%4 = add nsw i64 %3, %1
store volatile i64 %4, i64* %0
ret void
}
/* Variables and functions */
size_t strlenb(const char *str) {
  size_t len = 0;
  while (*str++) {
    len++;
  }
  return len;
}


x86 assembly (clang, -O0):
<strlenb>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1139 <strlenb+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlenb+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlenb>:
cmpb   $0x0,(%rdi)
je     111f <strlenb+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlenb+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlenb(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i64 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
/* Variables and functions */
int strcmp(void const *, void const *);
int sort_char(const void *a, const void *b) { return (strcmp(a, b)); }


x86 assembly (clang, -O0):
<sort_char>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sort_char>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @sort_char(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 @strcmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @sort_char(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
int int_cmp(const void *a, const void *b) {
  const int *v1 = (int *)a;
  const int *v2 = (int *)b;
  return *v1 - *v2;
}


x86 assembly (clang, -O0):
<int_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @int_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @int_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ f(int);
int main() {
  if (f(-1))
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%edi
call   1040 <f@plt>
cmp    $0x0,%rax
je     115a <main+0x2a>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1040 <f@plt>
test   %rax,%rax
jne    1147 <main+0x17>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @f(i32 -1)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @f(i32 -1)
%2 = icmp eq i64 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int application_unregister(char *);
int unload_module() { return application_unregister("Ping"); }


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

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

LLVM IR (-O0):
@.str = [5 x i8] c"Ping\00"
define i32 @unload_module() {
%1 = call i32 @application_unregister(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [5 x i8] c"Ping\00"
define i32 @unload_module() {
%1 = tail call i32 @application_unregister(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
/* Type definitions */
struct pollfd {
  int fd;
  int events;
};
typedef int /*<<< orphan*/ pfd;

/* Variables and functions */
int POLLIN;
int POLLPRI;
int /*<<< orphan*/ memset(struct pollfd *, int /*<<< orphan*/, int);
struct pollfd initPollerFd(int fileFd) {
  struct pollfd pfd;
  memset(&pfd, 0, sizeof(pfd));
  pfd.fd = fileFd;
  pfd.events = POLLIN | POLLPRI;
  return pfd;
}


x86 assembly (clang, -O0):
<initPollerFd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
mov    0x2eaf(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initPollerFd>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    %ebx,0x8(%rsp)
mov    0x2ead(%rip),%rax
mov    0x2eb6(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,0xc(%rsp)
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.pollfd = type { i32, i32 }
@POLLIN = global i32 0
@POLLPRI = global i32 0
define i64 @initPollerFd(i32 %0) {
%2 = alloca %struct.pollfd
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @memset(%struct.pollfd* %2, i32 0, i32 8)
%5 = load i32, i32* %3
%6 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %2, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* @POLLIN
%8 = load i32, i32* @POLLPRI
%9 = or i32 %7, %8
%10 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %2, i32 0, i32 1
store i32 %9, i32* %10
%11 = bitcast %struct.pollfd* %2 to i64*
%12 = load i64, i64* %11
ret i64 %12
}

LLVM IR (-O2):
%struct.pollfd = type { i32, i32 }
@POLLIN = global i32 0
@POLLPRI = global i32 0
define i64 @initPollerFd(i32 %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to %struct.pollfd*
%4 = call i32 @memset(%struct.pollfd* %3, i32 0, i32 8)
%5 = bitcast i64* %2 to i32*
store i32 %0, i32* %5
%6 = load i32, i32* @POLLIN
%7 = load i32, i32* @POLLPRI
%8 = or i32 %7, %6
%9 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 1
store i32 %8, i32* %9
%10 = load i64, i64* %2
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ test_parser_sourcefile(char *, char *);
int /*<<< orphan*/ test_parser_verify_parse(int /*<<< orphan*/, char *, char *,
                                            char *, int /*<<< orphan*/);
void test_unrealscript_comments() {
  test_parser_verify_parse(test_parser_sourcefile("unrealscript", " //comment"),
                           "unrealscript", "", "//comment", 0);
}


x86 assembly (clang, -O0):
<test_unrealscript_comments>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xedb(%rip),%rsi
call   1030 <test_parser_sourcefile@plt>
mov    %eax,%edi
lea    0xec0(%rip),%rsi
lea    0xed0(%rip),%rdx
lea    0xec0(%rip),%rcx
xor    %r8d,%r8d
call   1040 <test_parser_verify_parse@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unrealscript_comments>:
push   %rbx
lea    0xed8(%rip),%rbx
lea    0xede(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test_parser_sourcefile@plt>
lea    0xed9(%rip),%rdx
lea    0xec9(%rip),%rcx
mov    %eax,%edi
mov    %rbx,%rsi
xor    %r8d,%r8d
pop    %rbx
jmp    1040 <test_parser_verify_parse@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"unrealscript\00"
@.str.1 = [11 x i8] c" //comment\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [10 x i8] c"//comment\00"
define void @test_unrealscript_comments() {
%1 = call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"unrealscript\00"
@.str.1 = [11 x i8] c" //comment\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [10 x i8] c"//comment\00"
define void @test_unrealscript_comments() {
%1 = tail call i32 @test_parser_sourcefile(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test_parser_verify_parse(i32 %1, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret void
}
int is_dma(struct zone *zone) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.zone = type opaque
define i32 @is_dma(%struct.zone* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ struct_by_value_20_x();
int main() {
  struct_by_value_20_x();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <struct_by_value_20_x@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @struct_by_value_20_x()
%2 = tail call i32 @exit(i32 0)
unreachable
}
double foo_01_12(void) {
  return (__extension__((union {
            unsigned __l __attribute__((__mode__(__SI__)));
            float __d;
          }){__l : 0x3f800000UL})
              .__d);
}


x86 assembly (clang, -O0):
<foo_01_12>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3f800000,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_01_12>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define double @foo_01_12() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i32*
store i32 1065353216, i32* %2
%3 = bitcast %union.anon* %1 to float*
%4 = load float, float* %3
%5 = fpext float %4 to double
ret double %5
}

LLVM IR (-O2):
define double @foo_01_12() {
ret double 1.000000e+00
}
/* Type definitions */
struct solve_problem {
  int dummy;
};
struct package {
  int dummy;
};

/* Variables and functions */
struct package *pkg_add(struct solve_problem *, char const *);
int solve_constraint_add(struct solve_problem *p, const char *constraint) {
  struct package *pkg;
  if ((pkg = pkg_add(p, constraint)) == NULL) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<solve_constraint_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <pkg_add@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1147 <solve_constraint_add+0x37>
movl   $0xffffffff,-0x4(%rbp)
jmp    114e <solve_constraint_add+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve_constraint_add>:
push   %rax
call   1030 <pkg_add@plt>
cmp    $0x1,%rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.solve_problem = type { i32 }
%struct.package = type { i32 }
define i32 @solve_constraint_add(%struct.solve_problem* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.solve_problem*
%5 = alloca i8*
%6 = alloca %struct.package*
store %struct.solve_problem* %0, %struct.solve_problem** %4
store i8* %1, i8** %5
%7 = load %struct.solve_problem*, %struct.solve_problem** %4
%8 = load i8*, i8** %5
%9 = call %struct.package* @pkg_add(%struct.solve_problem* %7, i8* %8)
store %struct.package* %9, %struct.package** %6
%10 = icmp eq %struct.package* %9, null
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
%struct.solve_problem = type { i32 }
%struct.package = type { i32 }
define i32 @solve_constraint_add(%struct.solve_problem* %0, i8* %1) {
%3 = tail call %struct.package* @pkg_add(%struct.solve_problem* %0, i8* %1)
%4 = icmp eq %struct.package* %3, null
%5 = sext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ WriteBufferToDisplay(int /*<<< orphan*/ *);
void DisplayImage(uint8_t *img) { WriteBufferToDisplay(img); }


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

x86 assembly (clang, -O2):
<DisplayImage>:
jmp    1030 <WriteBufferToDisplay@plt>

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

LLVM IR (-O2):
define void @DisplayImage(i32* %0) {
%2 = tail call i32 @WriteBufferToDisplay(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parallel_clr_nrfd(int);
int /*<<< orphan*/ parallel_set_nrfd(int);
void parallel_drv0_set_nrfd(unsigned char val) {
  if (val) {
    parallel_set_nrfd(0x04);
  } else {
    parallel_clr_nrfd(~0x04);
  }
}


x86 assembly (clang, -O0):
<parallel_drv0_set_nrfd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
cmpb   $0x0,-0x1(%rbp)
je     1147 <parallel_drv0_set_nrfd+0x27>
mov    $0x4,%edi
call   1040 <parallel_set_nrfd@plt>
jmp    1151 <parallel_drv0_set_nrfd+0x31>
mov    $0xfffffffb,%edi
call   1030 <parallel_clr_nrfd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parallel_drv0_set_nrfd>:
test   %edi,%edi
je     112e <parallel_drv0_set_nrfd+0xe>
mov    $0x4,%edi
jmp    1040 <parallel_set_nrfd@plt>
mov    $0xfffffffb,%edi
jmp    1030 <parallel_clr_nrfd@plt>

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

LLVM IR (-O2):
define void @parallel_drv0_set_nrfd(i8 zeroext %0) {
%2 = icmp eq i8 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @parallel_set_nrfd(i32 4)
br label %7
5: ; preds = %1
%6 = tail call i32 @parallel_clr_nrfd(i32 -5)
br label %7
7: ; preds = %5, %3
ret void
}
/* Type definitions */
struct writer {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ peek_old_byte(struct writer *, unsigned int);
int /*<<< orphan*/ write_byte(struct writer *, int /*<<< orphan*/);
void copy_byte(struct writer *wr, unsigned int offs) {
  write_byte(wr, peek_old_byte(wr, offs));
}


x86 assembly (clang, -O0):
<copy_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <peek_old_byte@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1040 <write_byte@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_byte>:
push   %rbx
mov    %rdi,%rbx
call   1030 <peek_old_byte@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <write_byte@plt>

LLVM IR (-O0):
%struct.writer = type { i32 }
define void @copy_byte(%struct.writer* %0, i32 %1) {
%3 = alloca %struct.writer*
%4 = alloca i32
store %struct.writer* %0, %struct.writer** %3
store i32 %1, i32* %4
%5 = load %struct.writer*, %struct.writer** %3
%6 = load %struct.writer*, %struct.writer** %3
%7 = load i32, i32* %4
%8 = call i32 @peek_old_byte(%struct.writer* %6, i32 %7)
%9 = call i32 @write_byte(%struct.writer* %5, i32 %8)
ret void
}

LLVM IR (-O2):
%struct.writer = type { i32 }
define void @copy_byte(%struct.writer* %0, i32 %1) {
%3 = tail call i32 @peek_old_byte(%struct.writer* %0, i32 %1)
%4 = tail call i32 @write_byte(%struct.writer* %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memcmp(void *, char *, int);
int is_old_par(void *data) {
  if (!memcmp(data, "PAR", 4))
    return 1;
  if (!memcmp(data, "PXX", 4))
    return 2;
  return 0;
}


x86 assembly (clang, -O0):
<is_old_par>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jne    1146 <is_old_par+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1177 <is_old_par+0x67>
mov    -0x10(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
jne    1170 <is_old_par+0x60>
movl   $0x2,-0x4(%rbp)
jmp    1177 <is_old_par+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_old_par>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcmp@plt>
test   %eax,%eax
je     114a <is_old_par+0x3a>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <memcmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    %eax,%eax
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"PAR\00"
@.str.1 = [4 x i8] c"PXX\00"
define i32 @is_old_par(i8* %0) {
%2 = tail call i32 @memcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @memcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i32 2, i32 0
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ clrtoeol();
void gui_clrtoeol() { clrtoeol(); }


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

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

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

LLVM IR (-O2):
define void @gui_clrtoeol() {
%1 = tail call i32 (...) @clrtoeol()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LedsP__Leds__led0On();
void EchoP__Leds__led0On(void) { LedsP__Leds__led0On(); }


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

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

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

LLVM IR (-O2):
define void @EchoP__Leds__led0On() {
%1 = tail call i32 (...) @LedsP__Leds__led0On()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ send_byte(int);
void put_hex(const char c) {
  send_byte('0');
  send_byte('x');
  send_byte(((int)c / 16) + '0');
  send_byte(((int)c % 16) + '0');
}


x86 assembly (clang, -O0):
<put_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x30,%edi
call   1030 <send_byte@plt>
mov    $0x78,%edi
call   1030 <send_byte@plt>
movsbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1030 <send_byte@plt>
movsbl -0x1(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1030 <send_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_hex>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x30,%edi
call   1030 <send_byte@plt>
mov    $0x78,%edi
call   1030 <send_byte@plt>
mov    %ebp,%ebx
sar    $0x7,%bl
shr    $0x4,%bl
add    %bpl,%bl
mov    %ebx,%eax
sar    $0x4,%al
add    $0x30,%al
movzbl %al,%edi
call   1030 <send_byte@plt>
and    $0xf0,%bl
sub    %bl,%bpl
add    $0x30,%bpl
movzbl %bpl,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <send_byte@plt>

LLVM IR (-O0):
define void @put_hex(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @send_byte(i32 48)
%4 = call i32 @send_byte(i32 120)
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = sdiv i32 %6, 16
%8 = add nsw i32 %7, 48
%9 = call i32 @send_byte(i32 %8)
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = srem i32 %11, 16
%13 = add nsw i32 %12, 48
%14 = call i32 @send_byte(i32 %13)
ret void
}

LLVM IR (-O2):
define void @put_hex(i8 signext %0) {
%2 = tail call i32 @send_byte(i32 48)
%3 = tail call i32 @send_byte(i32 120)
%4 = sdiv i8 %0, 16
%5 = add nsw i8 %4, 48
%6 = zext i8 %5 to i32
%7 = tail call i32 @send_byte(i32 %6)
%8 = srem i8 %0, 16
%9 = add nsw i8 %8, 48
%10 = zext i8 %9 to i32
%11 = tail call i32 @send_byte(i32 %10)
ret void
}
int _add(int x, int y, void *garb) { return x + y; }


x86 assembly (clang, -O0):
<_add>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_add>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @_add(i32 %0, i32 %1, i8* nocapture readnone %2) {
%4 = add nsw i32 %1, %0
ret i32 %4
}
void units_set_base(unsigned *units, unsigned base) {
  unsigned mode = *units & ~((1U << (8)) - 1);
  *units = base | mode;
}


x86 assembly (clang, -O0):
<units_set_base>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
and    $0xffffff00,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%ecx
or     -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<units_set_base>:
mov    $0xffffff00,%eax
and    (%rdi),%eax
or     %esi,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @units_set_base(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = and i32 %7, -256
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = or i32 %9, %10
%12 = load i32*, i32** %3
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @units_set_base(i32* nocapture %0, i32 %1) {
%3 = load i32, i32* %0
%4 = and i32 %3, -256
%5 = or i32 %4, %1
store i32 %5, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bcopy(void *, void *, int);
int copyout(void *src, void *dst, int size) {
  bcopy(src, dst, size);
  return 0;
}


x86 assembly (clang, -O0):
<copyout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <bcopy@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyout>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1030 <memmove@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @copyout(i8* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
tail call void @llvm.memmove.p0i8.p0i8.i32(i8* align 1 %1, i8* align 1 %0, i32 %2, i1 false)
ret i32 0
}
/* Variables and functions */
int __builtin_nyuzi_read_control_reg(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int, int, int);
void fault_handler() {
  printf(
      "FAULT %d %08x current flags %02x prev flags %02x\n",
      __builtin_nyuzi_read_control_reg(3), __builtin_nyuzi_read_control_reg(5),
      __builtin_nyuzi_read_control_reg(4), __builtin_nyuzi_read_control_reg(8));
  exit(0);
}


x86 assembly (clang, -O0):
<fault_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,-0xc(%rbp)
mov    $0x5,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,-0x8(%rbp)
mov    $0x4,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,-0x4(%rbp)
mov    $0x8,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    %eax,%r8d
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<fault_handler>:
push   %rbp
push   %r14
push   %rbx
mov    $0x3,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,%r14d
mov    $0x5,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,%ebp
mov    $0x4,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
mov    %eax,%ebx
mov    $0x8,%edi
call   1040 <__builtin_nyuzi_read_control_reg@plt>
lea    0xe96(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"FAULT %d %08x current flags %02x prev flags %02x\0A\00"
define void @fault_handler() {
%1 = call i32 @__builtin_nyuzi_read_control_reg(i32 3)
%2 = call i32 @__builtin_nyuzi_read_control_reg(i32 5)
%3 = call i32 @__builtin_nyuzi_read_control_reg(i32 4)
%4 = call i32 @__builtin_nyuzi_read_control_reg(i32 8)
%5 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4)
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [50 x i8] c"FAULT %d %08x current flags %02x prev flags %02x\0A\00"
define void @fault_handler() {
%1 = tail call i32 @__builtin_nyuzi_read_control_reg(i32 3)
%2 = tail call i32 @__builtin_nyuzi_read_control_reg(i32 5)
%3 = tail call i32 @__builtin_nyuzi_read_control_reg(i32 4)
%4 = tail call i32 @__builtin_nyuzi_read_control_reg(i32 8)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4)
%6 = tail call i32 @exit(i32 0)
unreachable
}
char *memory_get_identity() { return "copying garbage collector"; }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"copying garbage collector\00"
define i8* @memory_get_identity() {
ret i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [26 x i8] c"copying garbage collector\00"
define i8* @memory_get_identity() {
ret i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0)
}
__attribute__((always_)) int
module_param_sysfs_setup(struct module *mod, struct kernel_param *kparam,
                         unsigned int num_params) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.module = type opaque
%struct.kernel_param = type opaque
define i32 @module_param_sysfs_setup(%struct.module* %0, %struct.kernel_param* %1, i32 %2) {
%4 = alloca %struct.module*
%5 = alloca %struct.kernel_param*
%6 = alloca i32
store %struct.module* %0, %struct.module** %4
store %struct.kernel_param* %1, %struct.kernel_param** %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
%struct.module = type opaque
%struct.kernel_param = type opaque
define i32 @module_param_sysfs_setup(%struct.module* nocapture readnone %0, %struct.kernel_param* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ PrintOpcodeStats();
int /*<<< orphan*/ printf(char *);
void printWelcome() {
  printf("SID Companiet - 6510 Emulator\n");
  PrintOpcodeStats();
}


x86 assembly (clang, -O0):
<printWelcome>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <PrintOpcodeStats@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printWelcome>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <PrintOpcodeStats@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"SID Companiet - 6510 Emulator\0A\00"
define void @printWelcome() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @PrintOpcodeStats()
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"SID Companiet - 6510 Emulator\00"
define void @printWelcome() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @PrintOpcodeStats()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_slli_epi32(int /*<<< orphan*/, int);
__m128i __attribute__((no, unused)) test16(__m128i s1) {
  return _mm_slli_epi32(s1, 16);
}


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

x86 assembly (clang, -O2):
<test16>:
mov    $0x10,%esi
jmp    1030 <_mm_slli_epi32@plt>

LLVM IR (-O0):
define i32 @test16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @_mm_slli_epi32(i32 %3, i32 16)
ret i32 %4
}

LLVM IR (-O2):
define i32 @test16(i32 %0) {
%2 = tail call i32 @_mm_slli_epi32(i32 %0, i32 16)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("\p"); }


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

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

LLVM IR (-O0):
@.str = [2 x i8] c"p\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putchar(i32 112)
ret i32 0
}
/* Variables and functions */
int istrsenvisx(char *, size_t *, char const *, size_t, int, char *,
                int /*<<< orphan*/ *);
int strnvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len,
             int flags) {
  return istrsenvisx(mbdst, &dlen, mbsrc, len, flags, "", NULL);
}


x86 assembly (clang, -O0):
<strnvisx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
lea    -0x10(%rbp),%rsi
lea    0xeb9(%rip),%r9
xor    %eax,%eax
movq   $0x0,(%rsp)
call   1030 <istrsenvisx@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnvisx>:
sub    $0x18,%rsp
mov    %rsi,0x10(%rsp)
movq   $0x0,(%rsp)
lea    0xed8(%rip),%r9
lea    0x10(%rsp),%rsi
call   1030 <istrsenvisx@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @strnvisx(i8* %0, i64 %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8* %2, i8** %8
store i64 %3, i64* %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %8
%13 = load i64, i64* %9
%14 = load i32, i32* %10
%15 = call i32 @istrsenvisx(i8* %11, i64* %7, i8* %12, i64 %13, i32 %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 %15
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @strnvisx(i8* %0, i64 %1, i8* %2, i64 %3, i32 %4) {
%6 = alloca i64
store i64 %1, i64* %6
%7 = call i32 @istrsenvisx(i8* %0, i64* %6, i8* %2, i64 %3, i32 %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32* null)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, void *);
void qprint(void *data) { printf("%p ", data); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%p \00"
define void @qprint(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ExceptionTo(int /*<<< orphan*/);
int /*<<< orphan*/ get_long(int);
void Exception(int nr) { ExceptionTo(get_long(4 * nr)); }


x86 assembly (clang, -O0):
<Exception>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
call   1030 <get_long@plt>
mov    %eax,%edi
call   1040 <ExceptionTo@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Exception>:
push   %rax
shl    $0x2,%edi
call   1030 <get_long@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <ExceptionTo@plt>

LLVM IR (-O0):
define void @Exception(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 4, %3
%5 = call i32 @get_long(i32 %4)
%6 = call i32 @ExceptionTo(i32 %5)
ret void
}

LLVM IR (-O2):
define void @Exception(i32 %0) {
%2 = shl nsw i32 %0, 2
%3 = tail call i32 @get_long(i32 %2)
%4 = tail call i32 @ExceptionTo(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
int /*<<< orphan*/ free(void *);
void *malloc(int);
int main(int argc, char **argv) {
  void *p = malloc(1);
  assert(p);
  free(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* @malloc(i32 1)
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = call i32 @assert(i8* %8)
%10 = load i8*, i8** %6
%11 = call i32 @free(i8* %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%4 = tail call i32 @assert(i8* %3)
%5 = tail call i32 @free(i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ dotest(int, double);
int main() {
  {
    dotest(5, 1.275);
    dotest(6, 1.2125);
    dotest(7, 1.173214);
    dotest(8, 1.146651);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
movsd  0xef7(%rip),%xmm0
call   1030 <dotest@plt>
mov    $0x6,%edi
movsd  0xedd(%rip),%xmm0
call   1030 <dotest@plt>
mov    $0x7,%edi
movsd  0xec3(%rip),%xmm0
call   1030 <dotest@plt>
mov    $0x8,%edi
movsd  0xea9(%rip),%xmm0
call   1030 <dotest@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xee7(%rip),%xmm0
mov    $0x5,%edi
call   1030 <dotest@plt>
movsd  0xedd(%rip),%xmm0
mov    $0x6,%edi
call   1030 <dotest@plt>
movsd  0xed3(%rip),%xmm0
mov    $0x7,%edi
call   1030 <dotest@plt>
movsd  0xec9(%rip),%xmm0
mov    $0x8,%edi
call   1030 <dotest@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @dotest(i32 5, double 1.275000e+00)
%2 = call i32 @dotest(i32 6, double 1.212500e+00)
%3 = call i32 @dotest(i32 7, double 0x3FF2C57C0B135979)
%4 = call i32 @dotest(i32 8, double 0x3FF258AEB80ECFA7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @dotest(i32 5, double 1.275000e+00)
%2 = tail call i32 @dotest(i32 6, double 1.212500e+00)
%3 = tail call i32 @dotest(i32 7, double 0x3FF2C57C0B135979)
%4 = tail call i32 @dotest(i32 8, double 0x3FF258AEB80ECFA7)
ret i32 0
}
double minDouble(double a, double b) {
  if (a < b)
    return a;
  else
    return b;
}


x86 assembly (clang, -O0):
<minDouble>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1131 <minDouble+0x31>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    113b <minDouble+0x3b>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<minDouble>:
minsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @minDouble(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
void Reserved_Handler37(void) {
  while (1)
    ;
}


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

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

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

LLVM IR (-O2):
define void @Reserved_Handler37() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ vecNf_sub_new(float *, float const *, float const *, int);
void vec3f_sub_new(float result[3], const float a[3], const float b[3]) {
  vecNf_sub_new(result, a, b, 3);
}


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

x86 assembly (clang, -O2):
<vec3f_sub_new>:
mov    $0x3,%ecx
jmp    1030 <vecNf_sub_new@plt>

LLVM IR (-O0):
define void @vec3f_sub_new(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load float*, float** %4
%8 = load float*, float** %5
%9 = load float*, float** %6
%10 = call i32 @vecNf_sub_new(float* %7, float* %8, float* %9, i32 3)
ret void
}

LLVM IR (-O2):
define void @vec3f_sub_new(float* %0, float* %1, float* %2) {
%4 = tail call i32 @vecNf_sub_new(float* %0, float* %1, float* %2, i32 3)
ret void
}
/* Variables and functions */
void *p(size_t);
void *q(size_t n) { return p(n); }


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

x86 assembly (clang, -O2):
<q>:
jmp    1030 <p@plt>

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

LLVM IR (-O2):
define i8* @q(i64 %0) {
%2 = tail call i8* @p(i64 %0)
ret i8* %2
}