xunge/DecIR huggingface dataset:
/* Variables and functions */
int optind;
int /*<<< orphan*/ process_args(int, char **);
int /*<<< orphan*/ process_library(char *);
int main(int argc, char *argv[]) {
  process_args(argc, argv);
  while (optind < argc)
    process_library(argv[optind++]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <process_args@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1180 <main+0x60>
mov    -0x10(%rbp),%rax
mov    0x2e89(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2e7b(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <process_library@plt>
jmp    1142 <main+0x22>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
call   1040 <process_args@plt>
mov    0x2eb3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rbx),%eax
cmp    %ebp,%eax
jge    1158 <main+0x38>
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
cltq
mov    (%r14,%rax,8),%rdi
call   1030 <process_library@plt>
jmp    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @process_args(i32 %0, i8** %1)
%4 = load i32, i32* @optind
%5 = icmp slt i32 %4, %0
br i1 %5, label %6, label %15
6: ; preds = %2, %6
%7 = phi i32 [ %13, %6 ], [ %4, %2 ]
%8 = add nsw i32 %7, 1
store i32 %8, i32* @optind
%9 = sext i32 %7 to i64
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @process_library(i8* %11)
%13 = load i32, i32* @optind
%14 = icmp slt i32 %13, %0
br i1 %14, label %6, label %15
15: ; preds = %6, %2
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ in;

/* Variables and functions */
uint32_t FROM_BE32(uint32_t in) {
  unsigned char *pin = (unsigned char *)&in;
  uint32_t out;
  int i;
  for (i = 0, out = 0; i < sizeof(in); ++i)
    out = (out << 8) + pin[i];
  return out;
}


x86 assembly (clang, -O0):
<FROM_BE32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x4,%rax
jae    1150 <FROM_BE32+0x50>
mov    -0x14(%rbp),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
movzbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    111d <FROM_BE32+0x1d>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FROM_BE32>:
mov    %edi,%eax
bswap  %eax
ret

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

LLVM IR (-O2):
define i32 @FROM_BE32(i32 %0) {
%2 = call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ gl_cleanup();
int strlen(char const *const);
int /*<<< orphan*/ write(int, char const *const, int);
void gl_error(const char *const buf) {
  int len = strlen(buf);
  gl_cleanup();
  write(2, buf, len);
  exit(1);
}


x86 assembly (clang, -O0):
<gl_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <gl_cleanup@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    $0x2,%edi
call   1030 <write@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<gl_error>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <gl_cleanup@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define void @gl_error(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
store i32 %5, i32* %3
%6 = call i32 (...) @gl_cleanup()
%7 = load i8*, i8** %2
%8 = load i32, i32* %3
%9 = call i32 @write(i32 2, i8* %7, i32 %8)
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @gl_error(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 (...) @gl_cleanup()
%4 = tail call i32 @write(i32 2, i8* %0, i32 %2)
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int checkLenght(int argc) {
  if (argc < 4) {
    printf("Not enought argument\nProgram terminated");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<checkLenght>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jge    113d <checkLenght+0x2d>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1144 <checkLenght+0x34>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkLenght>:
mov    $0x1,%eax
cmp    $0x3,%edi
jg     112d <checkLenght+0x1d>
push   %rax
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Not enought argument\0AProgram terminated\00"
define i32 @checkLenght(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %9
8: ; preds = %1
store i32 1, i32* %2
br label %9
9: ; preds = %8, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@.str = [40 x i8] c"Not enought argument\0AProgram terminated\00"
define i32 @checkLenght(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 0, %3 ], [ 1, %1 ]
ret i32 %6
}
long extract_sh6(unsigned long insn, int dialect __attribute__((unused)),
                 int *invalid __attribute__((unused))) {
  return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);
}


x86 assembly (clang, -O0):
<extract_sh6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
shr    $0xb,%rax
and    $0x1f,%rax
mov    -0x8(%rbp),%rcx
shl    $0x4,%rcx
and    $0x20,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_sh6>:
mov    %edi,%eax
shr    $0xb,%eax
and    $0x1f,%eax
shl    $0x4,%edi
and    $0x20,%edi
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @extract_sh6(i64 %0, i32 %1, i32* %2) {
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32*
store i64 %0, i64* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i64, i64* %4
%8 = lshr i64 %7, 11
%9 = and i64 %8, 31
%10 = load i64, i64* %4
%11 = shl i64 %10, 4
%12 = and i64 %11, 32
%13 = or i64 %9, %12
ret i64 %13
}

LLVM IR (-O2):
define i64 @extract_sh6(i64 %0, i32 %1, i32* nocapture readnone %2) {
%4 = lshr i64 %0, 11
%5 = and i64 %4, 31
%6 = shl i64 %0, 4
%7 = and i64 %6, 32
%8 = or i64 %5, %7
ret i64 %8
}
/* Type definitions */
struct rbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rbuf_seek(struct rbuf *, size_t, int, int);
void rbuf_seek_writer(struct rbuf *b, size_t offset, int whence) {
  rbuf_seek(b, offset, whence, 1);
}


x86 assembly (clang, -O0):
<rbuf_seek_writer>:
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
mov    $0x1,%ecx
call   1030 <rbuf_seek@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rbuf_seek_writer>:
mov    $0x1,%ecx
jmp    1030 <rbuf_seek@plt>

LLVM IR (-O0):
%struct.rbuf = type { i32 }
define void @rbuf_seek_writer(%struct.rbuf* %0, i64 %1, i32 %2) {
%4 = alloca %struct.rbuf*
%5 = alloca i64
%6 = alloca i32
store %struct.rbuf* %0, %struct.rbuf** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load %struct.rbuf*, %struct.rbuf** %4
%8 = load i64, i64* %5
%9 = load i32, i32* %6
%10 = call i32 @rbuf_seek(%struct.rbuf* %7, i64 %8, i32 %9, i32 1)
ret void
}

LLVM IR (-O2):
%struct.rbuf = type { i32 }
define void @rbuf_seek_writer(%struct.rbuf* %0, i64 %1, i32 %2) {
%4 = tail call i32 @rbuf_seek(%struct.rbuf* %0, i64 %1, i32 %2, i32 1)
ret void
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int, size_t);
void *falloc(size_t size, int c) {
  void *ptr = malloc(size);
  if (ptr)
    memset(ptr, c, size);
  return ptr;
}


x86 assembly (clang, -O0):
<falloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1157 <falloc+0x37>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<falloc>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1145 <falloc+0x25>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @falloc(i64 %0, i32 %1) {
%3 = tail call i8* @malloc(i64 %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memset(i8* %3, i32 %1, i64 %0)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ test0();
int main() {
  test0();
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test0()
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, size_t);
void str_fill(char *str, char c, size_t len) {
  if (len < 1)
    return;
  memset(str, c, len - 1);
  str[len - 1] = '\0';
}


x86 assembly (clang, -O0):
<str_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
jae    1136 <str_fill+0x26>
jmp    115d <str_fill+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
mov    -0x18(%rbp),%rdx
sub    $0x1,%rdx
movsbl %al,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_fill>:
test   %rdx,%rdx
je     1139 <str_fill+0x29>
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
add    $0xffffffffffffffff,%rdx
movsbl %sil,%esi
call   1030 <memset@plt>
movb   $0x0,-0x1(%r14,%rbx,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @str_fill(i8* %0, i8 signext %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i64
store i8* %0, i8** %4
store i8 %1, i8* %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = icmp ult i64 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %3
br label %20
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i8, i8* %5
%13 = load i64, i64* %6
%14 = sub i64 %13, 1
%15 = call i32 @memset(i8* %11, i8 signext %12, i64 %14)
%16 = load i8*, i8** %4
%17 = load i64, i64* %6
%18 = sub i64 %17, 1
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 0, i8* %19
br label %20
20: ; preds = %10, %9
ret void
}

LLVM IR (-O2):
define void @str_fill(i8* %0, i8 signext %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = add i64 %2, -1
%7 = tail call i32 @memset(i8* %0, i8 signext %1, i64 %6)
%8 = getelementptr inbounds i8, i8* %0, i64 %6
store i8 0, i8* %8
br label %9
9: ; preds = %3, %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int i, f;
  f = 1;
  for (i = 1; i <= 10; i++)
    f = f * i;
  printf("%d\n", f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     114f <main+0x3f>
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xea7(%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    $0x375f00,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3628800)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void element_table_row_output(FILE *output_file) {
  fprintf(output_file, "<tr>\n");
}


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

x86 assembly (clang, -O2):
<element_table_row_output>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"<tr>\0A\00"
define void @element_table_row_output(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 5, i64 1, i32* %0)
ret void
}
void func(void) {
  int a;
  a = 1;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @func() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ungetch(char);
void pushchar(char c) { ungetch(c); }


x86 assembly (clang, -O0):
<pushchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <ungetch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushchar>:
jmp    1030 <ungetch@plt>

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

LLVM IR (-O2):
define void @pushchar(i8 signext %0) {
%2 = tail call i32 @ungetch(i8 signext %0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ror(uint32_t word, uint32_t count) {
  return word >> count | word << (32 - count);
}


x86 assembly (clang, -O0):
<ror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
mov    $0x20,%ecx
sub    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ror>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
neg    %cl
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @ror(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub nsw i32 32, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ror(i32 %0, i32 %1) {
%3 = ashr i32 %0, %1
%4 = sub nsw i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
char serializer_read_wchar(char *src, int *pointer) {
  char value = src[*pointer];
  (*pointer) += 2;
  return value;
}


x86 assembly (clang, -O0):
<serializer_read_wchar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x2,%ecx
mov    %ecx,(%rax)
movsbl -0x11(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<serializer_read_wchar>:
movslq (%rsi),%rcx
mov    (%rdi,%rcx,1),%al
add    $0x2,%ecx
mov    %ecx,(%rsi)
ret

LLVM IR (-O0):
define signext i8 @serializer_read_wchar(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %6, i64 %9
%11 = load i8, i8* %10
store i8 %11, i8* %5
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 2
store i32 %14, i32* %12
%15 = load i8, i8* %5
ret i8 %15
}

LLVM IR (-O2):
define signext i8 @serializer_read_wchar(i8* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = add nsw i32 %3, 2
store i32 %7, i32* %1
ret i8 %6
}
/* Type definitions */
struct termios {
  int dummy;
};

/* Variables and functions */
int tcsetattr(int, int, struct termios *);
int termios_tcsetattr(int fd, int option, struct termios *t) {
  return tcsetattr(fd, option, t);
}


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

x86 assembly (clang, -O2):
<termios_tcsetattr>:
jmp    1030 <tcsetattr@plt>

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

LLVM IR (-O2):
%struct.termios = type { i32 }
define i32 @termios_tcsetattr(i32 %0, i32 %1, %struct.termios* %2) {
%4 = tail call i32 @tcsetattr(i32 %0, i32 %1, %struct.termios* %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ vty_putc(char);
void vty_puts(char *s) {
  char c;
  while ((c = *s++) != '\0')
    vty_putc(c);
}


x86 assembly (clang, -O0):
<vty_puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movsbl %al,%eax
cmp    $0x0,%eax
je     114a <vty_puts+0x3a>
movsbl -0x9(%rbp),%edi
call   1030 <vty_putc@plt>
jmp    111c <vty_puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vty_puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <vty_puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <vty_putc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <vty_puts+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @vty_puts(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 i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = tail call i32 @vty_putc(i8 signext %5)
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int snprintf(char *, int, char *, double);
int json_emit_double(char *buf, int buf_len, double value) {
  return buf_len <= 0 ? 0 : snprintf(buf, buf_len, "%g", value);
}


x86 assembly (clang, -O0):
<json_emit_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1138 <json_emit_double+0x28>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1153 <json_emit_double+0x43>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xeb5(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_emit_double>:
test   %esi,%esi
jle    1120 <json_emit_double+0x10>
lea    0xee5(%rip),%rdx
jmp    1030 <snprintf@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%g\00"
define i32 @json_emit_double(i8* %0, i32 %1, double %2) {
%4 = icmp slt i32 %1, 1
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %2)
br label %7
7: ; preds = %3, %5
%8 = phi i32 [ %6, %5 ], [ 0, %3 ]
ret i32 %8
}
int lowerBound2Pow(int n) {
  int i = 0;
  while (n) {
    n = n >> 1;
    i++;
  }
  return 1 << i;
}


x86 assembly (clang, -O0):
<lowerBound2Pow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     112f <lowerBound2Pow+0x2f>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <lowerBound2Pow+0xe>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowerBound2Pow>:
xor    %ecx,%ecx
test   %edi,%edi
je     111c <lowerBound2Pow+0x1c>
mov    %edi,%eax
nopl   0x0(%rax,%rax,1)
sar    %eax
add    $0x1,%ecx
cmp    $0x1,%edi
mov    %eax,%edi
ja     1110 <lowerBound2Pow+0x10>
mov    $0x1,%eax
shl    %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @lowerBound2Pow(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = ashr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ult i32 %5, 2
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
%11 = shl nuw i32 1, %10
ret i32 %11
}
void test_promote_or_convert3(short _Complex sc) {
  char *cp = promote_or_convert3(sc);
}


x86 assembly (clang, -O0):
<test_promote_or_convert3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%cx
mov    -0x6(%rbp),%ax
mov    %cx,-0x18(%rbp)
mov    %ax,-0x16(%rbp)
mov    -0x18(%rbp),%edi
mov    $0x0,%al
call   1030 <promote_or_convert3@plt>
cltq
mov    %rax,-0x10(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @test_promote_or_convert3(i32 %0) {
%2 = alloca { i16, i16 }
%3 = alloca i8*
%4 = alloca { i16, i16 }
%5 = bitcast { i16, i16 }* %2 to i32*
store i32 %0, i32* %5
%6 = getelementptr inbounds { i16, i16 }, { i16, i16 }* %2, i32 0, i32 0
%7 = load i16, i16* %6
%8 = getelementptr inbounds { i16, i16 }, { i16, i16 }* %2, i32 0, i32 1
%9 = load i16, i16* %8
%10 = getelementptr inbounds { i16, i16 }, { i16, i16 }* %4, i32 0, i32 0
%11 = getelementptr inbounds { i16, i16 }, { i16, i16 }* %4, i32 0, i32 1
store i16 %7, i16* %10
store i16 %9, i16* %11
%12 = bitcast { i16, i16 }* %4 to i32*
%13 = load i32, i32* %12
%14 = call i32 (i32, ...) bitcast (i32 (...)* @promote_or_convert3 to i32 (i32, ...)*)(i32 %13)
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i8*
store i8* %16, i8** %3
ret void
}

LLVM IR (-O2):
define void @test_promote_or_convert3(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @promote_or_convert3 to i32 (i32, ...)*)(i32 %0)
ret void
}
/* Variables and functions */
int not_declared();
int foo() { return not_declared(); }


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

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

LLVM IR (-O0):
define i32 @foo() {
%1 = call i32 (...) @not_declared()
ret i32 %1
}

LLVM IR (-O2):
define i32 @foo() {
%1 = tail call i32 (...) @not_declared()
ret i32 %1
}
void TimerCCUSelect(unsigned long ulBase, unsigned long ulCCUSelect) {
  ;

  ;
  if (ulCCUSelect == 0x00000001) {
    (*((volatile unsigned long *)(ulBase + 0x00000004))) |= 0x00000004;
  } else {
    (*((volatile unsigned long *)(ulBase + 0x00000004))) &= ~0x00000004;
  }
}


x86 assembly (clang, -O0):
<TimerCCUSelect>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
jne    112c <TimerCCUSelect+0x2c>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%rcx
or     $0x4,%rcx
mov    %rcx,0x4(%rax)
jmp    113c <TimerCCUSelect+0x3c>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%rcx
and    $0xfffffffffffffffb,%rcx
mov    %rcx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerCCUSelect>:
xor    %eax,%eax
cmp    $0x1,%rsi
sete   %al
mov    0x4(%rdi),%rcx
and    $0xfffffffffffffffb,%rcx
lea    (%rcx,%rax,4),%rax
mov    %rax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @TimerCCUSelect(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 = icmp eq i64 %5, 1
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i64, i64* %3
%9 = add i64 %8, 4
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
%12 = or i64 %11, 4
store volatile i64 %12, i64* %10
br label %19
13: ; preds = %2
%14 = load i64, i64* %3
%15 = add i64 %14, 4
%16 = inttoptr i64 %15 to i64*
%17 = load volatile i64, i64* %16
%18 = and i64 %17, -5
store volatile i64 %18, i64* %16
br label %19
19: ; preds = %13, %7
ret void
}

LLVM IR (-O2):
define void @TimerCCUSelect(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 1
%4 = add i64 %0, 4
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, -5
%8 = select i1 %3, i64 4, i64 0
%9 = or i64 %7, %8
store volatile i64 %9, i64* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int test_ABI_endian(void) {
  int result = 1;
  {
    printf("C "
           "cmIML_ABI_ENDIAN_ID: unknown, FAILED\n");
    result = 0;
  }
  return result;
}


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

x86 assembly (clang, -O2):
<test_ABI_endian>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"C cmIML_ABI_ENDIAN_ID: unknown, FAILED\0A\00"
define i32 @test_ABI_endian() {
%1 = alloca i32
store i32 1, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [39 x i8] c"C cmIML_ABI_ENDIAN_ID: unknown, FAILED\00"
define i32 @test_ABI_endian() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void mxs_gpio_init(void) {}


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

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

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

LLVM IR (-O2):
define void @mxs_gpio_init() {
ret void
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *prepBST();
int /*<<< orphan*/ printBST(struct node *);
int /*<<< orphan*/ printf(char *);
int main() {
  struct node *root = prepBST();
  printf("node: ");
  printBST(root);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <prepBST@plt>
mov    %rax,-0x10(%rbp)
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <printBST@plt>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <prepBST@plt>
mov    %rax,%rbx
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <printBST@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.node = type { i32 }
@.str = [7 x i8] c"node: \00"
define i32 @main() {
%1 = tail call %struct.node* (...) @prepBST()
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printBST(%struct.node* %1)
%4 = tail call i32 @putchar(i32 10)
ret i32 0
}
void *cmalloc(int size) {
  int i;
  char *p = GO_malloc(size);
  for (i = 0; i < size; i++)
    p[i] = 0;
  return p;
}


x86 assembly (clang, -O0):
<cmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <GO_malloc@plt>
cltq
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1158 <cmalloc+0x48>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <cmalloc+0x22>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i8* @cmalloc(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @GO_malloc to i32 (i32, ...)*)(i32 %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %1
ret i8* %4
}
void quit(n) int n;
{ exit(n); }


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rax
call   1030 <exit@plt>

LLVM IR (-O0):
define void @quit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
unreachable
}

LLVM IR (-O2):
define void @quit(i32 %0) {
tail call void @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ messaggi(int);
int controllo_matrice(int **matrice) {
  int esito_controllo;
  if (matrice == NULL) {
    messaggi(3);
    esito_controllo = 0;
  } else
    esito_controllo = 1;
  return (esito_controllo);
}


x86 assembly (clang, -O0):
<controllo_matrice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113d <controllo_matrice+0x2d>
mov    $0x3,%edi
call   1030 <messaggi@plt>
movl   $0x0,-0xc(%rbp)
jmp    1144 <controllo_matrice+0x34>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<controllo_matrice>:
mov    $0x1,%eax
test   %rdi,%rdi
je     111b <controllo_matrice+0xb>
ret
push   %rax
mov    $0x3,%edi
call   1030 <messaggi@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @controllo_matrice(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
store i32** %0, i32*** %2
%4 = load i32**, i32*** %2
%5 = icmp eq i32** %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @messaggi(i32 3)
store i32 0, i32* %3
br label %9
8: ; preds = %1
store i32 1, i32* %3
br label %9
9: ; preds = %8, %6
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @controllo_matrice(i32** readnone %0) {
%2 = icmp eq i32** %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @messaggi(i32 3)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ 0, %3 ], [ 1, %1 ]
ret i32 %6
}
char *func_posneg(short int numero) {
  if (numero > 0)
    return "Positivo";
  else
    return "Negativo";
}


x86 assembly (clang, -O0):
<func_posneg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
cmp    $0x0,%eax
jle    1128 <func_posneg+0x28>
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1133 <func_posneg+0x33>
lea    0xeda(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_posneg>:
test   %di,%di
lea    0xef6(%rip),%rcx
lea    0xef8(%rip),%rax
cmovg  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Positivo\00"
@.str.1 = [9 x i8] c"Negativo\00"
define i8* @func_posneg(i16 signext %0) {
%2 = alloca i8*
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %2
br label %9
8: ; preds = %1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %9
9: ; preds = %8, %7
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [9 x i8] c"Positivo\00"
@.str.1 = [9 x i8] c"Negativo\00"
define i8* @func_posneg(i16 signext %0) {
%2 = icmp sgt i16 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
ret i8* %3
}
void vlistDefVarDblKey(int vlistID, int varID, const char *name, double value) {
  (void)vlistID;
  (void)varID;
  (void)name;
  (void)value;
}


x86 assembly (clang, -O0):
<vlistDefVarDblKey>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @vlistDefVarDblKey(i32 %0, i32 %1, i8* %2, double %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store double %3, double* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = load i8*, i8** %7
%12 = load double, double* %8
ret void
}

LLVM IR (-O2):
define void @vlistDefVarDblKey(i32 %0, i32 %1, i8* nocapture %2, double %3) {
ret void
}
int PMIi_InitIfSingleton(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @PMIi_InitIfSingleton() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ *strchr(char *, int);
int valid_spec(int spec) { return strchr("ABCDFGIMPQRSTUWX", spec) != NULL; }


x86 assembly (clang, -O0):
<valid_spec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <strchr@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_spec>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <strchr@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"ABCDFGIMPQRSTUWX\00"
define i32 @valid_spec(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32* @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
@.str = [17 x i8] c"ABCDFGIMPQRSTUWX\00"
define i32 @valid_spec(i32 %0) {
%2 = tail call i32* @strchr(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = icmp ne i32* %2, null
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMRF4_get(void) { return U_WMRCORENONE_get("U_WMRF4"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMRF4\00"
define i32 @U_WMRF4_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void pcie_clear_aspm(void) {}


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

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

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

LLVM IR (-O2):
define void @pcie_clear_aspm() {
ret void
}
int ld_ble_mm1(long double *a1, long double *a2) {
  return (__builtin_islessequal(*a1, *a2));
}


x86 assembly (clang, -O0):
<ld_ble_mm1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
mov    -0x10(%rbp),%rax
fldt   (%rax)
fucomip %st(1),%st
fstp   %st(0)
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_ble_mm1>:
fldt   (%rdi)
fldt   (%rsi)
xor    %eax,%eax
fucomip %st(1),%st
fstp   %st(0)
setae  %al
ret

LLVM IR (-O0):
define i32 @ld_ble_mm1(x86_fp80* %0, x86_fp80* %1) {
%3 = alloca x86_fp80*
%4 = alloca x86_fp80*
store x86_fp80* %0, x86_fp80** %3
store x86_fp80* %1, x86_fp80** %4
%5 = load x86_fp80*, x86_fp80** %3
%6 = load x86_fp80, x86_fp80* %5
%7 = load x86_fp80*, x86_fp80** %4
%8 = load x86_fp80, x86_fp80* %7
%9 = fcmp ole x86_fp80 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @ld_ble_mm1(x86_fp80* nocapture %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %0
%4 = load x86_fp80, x86_fp80* %1
%5 = fcmp ole x86_fp80 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t rot32l3(uint32_t x) { return (x << 3) | (x >> 29); }


x86 assembly (clang, -O0):
<rot32l3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
mov    -0x4(%rbp),%ecx
sar    $0x1d,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rot32l3>:
lea    0x0(,%rdi,8),%eax
sar    $0x1d,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rot32l3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 3
%5 = load i32, i32* %2
%6 = ashr i32 %5, 29
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @rot32l3(i32 %0) {
%2 = shl i32 %0, 3
%3 = ashr i32 %0, 29
%4 = or i32 %2, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SEC_VIO_DriverIRQHandler();
__attribute__((weak)) void SEC_VIO_IRQHandler(void) {
  SEC_VIO_DriverIRQHandler();
}


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

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

LLVM IR (-O0):
define weak void @SEC_VIO_IRQHandler() {
%1 = call i32 (...) @SEC_VIO_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @SEC_VIO_IRQHandler() {
%1 = tail call i32 (...) @SEC_VIO_DriverIRQHandler()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ nl();
int /*<<< orphan*/ ot(char *);
int /*<<< orphan*/ outstr(char *);
int /*<<< orphan*/ printlabel(int);
void opjump(char *cc, int label) {
  ot("jp\t");
  outstr(cc);
  printlabel(label);
  nl();
}


x86 assembly (clang, -O0):
<opjump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeaa(%rip),%rdi
call   1050 <ot@plt>
mov    -0x8(%rbp),%rdi
call   1040 <outstr@plt>
mov    -0xc(%rbp),%edi
call   1060 <printlabel@plt>
mov    $0x0,%al
call   1030 <nl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opjump>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xeb1(%rip),%rdi
call   1050 <ot@plt>
mov    %rbx,%rdi
call   1040 <outstr@plt>
mov    %ebp,%edi
call   1060 <printlabel@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <nl@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"jp\09\00"
define void @opjump(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 @ot(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i32 @outstr(i8* %6)
%8 = load i32, i32* %4
%9 = call i32 @printlabel(i32 %8)
%10 = call i32 (...) @nl()
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"jp\09\00"
define void @opjump(i8* %0, i32 %1) {
%3 = tail call i32 @ot(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @outstr(i8* %0)
%5 = tail call i32 @printlabel(i32 %1)
%6 = tail call i32 (...) @nl()
ret void
}
int pad_size(int nof_channels) {
  int bits = 5 + nof_channels * 11;
  return ((8 - (bits & 7)) & 7);
}


x86 assembly (clang, -O0):
<pad_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0xb,-0x4(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
and    $0x7,%ecx
mov    $0x8,%eax
sub    %ecx,%eax
and    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pad_size>:
imul   $0xfffffff5,%edi,%eax
add    $0x3,%eax
and    $0x7,%eax
ret

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

LLVM IR (-O2):
define i32 @pad_size(i32 %0) {
%2 = mul i32 %0, -11
%3 = add i32 %2, 3
%4 = and i32 %3, 7
ret i32 %4
}