xunge/DecIR huggingface dataset:
extern void __outwc_p(unsigned short value, unsigned short port) {
  __asm__ __volatile__("out"
                       "w"
                       " %"
                       "w"
                       "0,%"
                       ""
                       "1"
                       :
                       : "a"(value), "id"(port));
  __asm__ __volatile__("jmp 1f\n1:\tjmp 1f\n1:");
}


x86 assembly (clang, -O0):
<__outwc_p>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%ax
mov    -0x4(%rbp),%dx
out    %ax,(%dx)
jmp    1121 <__outwc_p+0x21>
jmp    1126 <__outwc_p+0x26>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__outwc_p>:
mov    %esi,%edx
mov    %edi,%eax
out    %ax,(%dx)
jmp    1108 <__outwc_p+0x8>
jmp    110a <__outwc_p+0xa>
ret

LLVM IR (-O0):
define void @__outwc_p(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @__outwc_p(i16 zeroext %0, i16 zeroext %1) {
tail call void asm sideeffect "outw ${0:w},$1", "{ax},i{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0, i16 %1)
tail call void asm sideeffect "jmp 1f\0A1:\09jmp 1f\0A1:", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
int gpio_export(int pin) { return 0; }


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

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

LLVM IR (-O0):
define i32 @gpio_export(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @gpio_export(i32 %0) {
ret i32 0
}
void test(struct Blend_Map_Entry *Foo) {}


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

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

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

LLVM IR (-O2):
%struct.Blend_Map_Entry = type opaque
define void @test(%struct.Blend_Map_Entry* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_base_type_declarator();
int /*<<< orphan*/ test_malloc_free();
void test_SECTION_1() {
  test_base_type_declarator();
  test_malloc_free();
}


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

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

LLVM IR (-O0):
define void @test_SECTION_1() {
%1 = call i32 (...) @test_base_type_declarator()
%2 = call i32 (...) @test_malloc_free()
ret void
}

LLVM IR (-O2):
define void @test_SECTION_1() {
%1 = tail call i32 (...) @test_base_type_declarator()
%2 = tail call i32 (...) @test_malloc_free()
ret void
}
unsigned long long clz(unsigned long long x) {
  if (x != 0)
    return __builtin_clzll(x);
  return sizeof(unsigned long long) * 8;
}


x86 assembly (clang, -O0):
<clz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     112a <clz+0x2a>
mov    -0x10(%rbp),%rax
bsr    %rax,%rax
xor    $0x3f,%rax
cltq
mov    %rax,-0x8(%rbp)
jmp    1132 <clz+0x32>
movq   $0x40,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clz>:
test   %rdi,%rdi
je     110e <clz+0xe>
bsr    %rdi,%rax
xor    $0x3f,%rax
ret
mov    $0x40,%eax
ret

LLVM IR (-O0):
define i64 @clz(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i64, i64* %3
%8 = call i64 @llvm.ctlz.i64(i64 %7, i1 true)
%9 = trunc i64 %8 to i32
%10 = sext i32 %9 to i64
store i64 %10, i64* %2
br label %12
11: ; preds = %1
store i64 64, i64* %2
br label %12
12: ; preds = %11, %6
%13 = load i64, i64* %2
ret i64 %13
}

LLVM IR (-O2):
define i64 @clz(i64 %0) {
%2 = tail call i64 @llvm.ctlz.i64(i64 %0, i1 false)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ close(int /*<<< orphan*/);
int /*<<< orphan*/ execlp(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
void detach(char *path) {
  int pid = fork();
  if (pid != 0)
    return;
  close(STDIN_FILENO);
  close(STDOUT_FILENO);
  close(STDERR_FILENO);
  execlp(path, path, NULL);
  exit(0);
}


x86 assembly (clang, -O0):
<detach>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1060 <fork@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1166 <detach+0x26>
add    $0x10,%rsp
pop    %rbp
ret
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <execlp@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<detach>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
je     1151 <detach+0x11>
pop    %rbx
ret
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
call   1030 <close@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1050 <execlp@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
define void @detach(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = call i32 (...) @fork()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
ret void
8: ; preds = %1
%9 = load i32, i32* @STDIN_FILENO
%10 = call i32 @close(i32 %9)
%11 = load i32, i32* @STDOUT_FILENO
%12 = call i32 @close(i32 %11)
%13 = load i32, i32* @STDERR_FILENO
%14 = call i32 @close(i32 %13)
%15 = load i8*, i8** %2
%16 = load i8*, i8** %2
%17 = call i32 @execlp(i8* %15, i8* %16, i32* null)
%18 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
define void @detach(i8* %0) {
%2 = tail call i32 (...) @fork()
%3 = icmp eq i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %1
ret void
5: ; preds = %1
%6 = load i32, i32* @STDIN_FILENO
%7 = tail call i32 @close(i32 %6)
%8 = load i32, i32* @STDOUT_FILENO
%9 = tail call i32 @close(i32 %8)
%10 = load i32, i32* @STDERR_FILENO
%11 = tail call i32 @close(i32 %10)
%12 = tail call i32 @execlp(i8* %0, i8* %0, i32* null)
%13 = tail call i32 @exit(i32 0)
unreachable
}
void avanza_dupliman() {}


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

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

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

LLVM IR (-O2):
define void @avanza_dupliman() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
char *integer2hex(int integer) {
  static char hex[128];
  sprintf(hex, "%x", integer);
  return hex;
}


x86 assembly (clang, -O0):
<integer2hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0x2f1b(%rip),%rdi
lea    0xed4(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2f08(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integer2hex>:
push   %rbx
mov    %edi,%edx
lea    0x2f26(%rip),%rbx
lea    0xedf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@integer2hex.hex = internal global [128 x i8] zeroinitializer
@.str = [3 x i8] c"%x\00"
define i8* @integer2hex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @integer2hex.hex, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @integer2hex.hex, i64 0, i64 0)
}

LLVM IR (-O2):
@integer2hex.hex = internal global [128 x i8] zeroinitializer
@.str = [3 x i8] c"%x\00"
define i8* @integer2hex(i32 %0) {
%2 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @integer2hex.hex, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* getelementptr inbounds ([128 x i8], [128 x i8]* @integer2hex.hex, i64 0, i64 0)
}
unsigned int parity1(unsigned int x) {
  x ^= x >> 1;
  x = (x ^ (x >> 2)) & 0x11111111;
  x *= 0x11111111;
  return (x >> 28) & 0x1;
}


x86 assembly (clang, -O0):
<parity1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0x2,%ecx
xor    %ecx,%eax
and    $0x11111111,%eax
mov    %eax,-0x4(%rbp)
imul   $0x11111111,-0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1c,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity1>:
mov    %edi,%eax
shr    %eax
xor    %edi,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
xor    %eax,%ecx
and    $0x11111111,%ecx
imul   $0x11111111,%ecx,%eax
shr    $0x1c,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @parity1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = lshr i32 %8, 2
%10 = xor i32 %7, %9
%11 = and i32 %10, 286331153
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = mul i32 %12, 286331153
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = lshr i32 %14, 28
%16 = and i32 %15, 1
ret i32 %16
}

LLVM IR (-O2):
define i32 @parity1(i32 %0) {
%2 = lshr i32 %0, 1
%3 = xor i32 %2, %0
%4 = lshr i32 %3, 2
%5 = xor i32 %4, %3
%6 = and i32 %5, 286331153
%7 = mul i32 %6, 286331153
%8 = lshr i32 %7, 28
%9 = and i32 %8, 1
ret i32 %9
}
/* Variables and functions */
scalar_t__ msgrcv(int, void *, size_t, long, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int read_msg(int msqid, void *msgp, size_t msgsz, long msgtyp) {
  if (msgrcv(msqid, msgp, msgsz - sizeof(long), msgtyp, 0) < 0) {
    perror("[-] msgrcv");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<read_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    $0x8,%rdx
mov    -0x20(%rbp),%rcx
xor    %r8d,%r8d
call   1040 <msgrcv@plt>
cmp    $0x0,%rax
jge    1174 <read_msg+0x54>
lea    0xe9d(%rip),%rdi
call   1030 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    117b <read_msg+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_msg>:
push   %rbx
add    $0xfffffffffffffff8,%rdx
xor    %ebx,%ebx
xor    %r8d,%r8d
call   1040 <msgrcv@plt>
test   %rax,%rax
js     1138 <read_msg+0x18>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xec1(%rip),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%ebx
jmp    1134 <read_msg+0x14>

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

LLVM IR (-O2):
@.str = [11 x i8] c"[-] msgrcv\00"
define i32 @read_msg(i32 %0, i8* %1, i64 %2, i64 %3) {
%5 = add i64 %2, -8
%6 = tail call i64 @msgrcv(i32 %0, i8* %1, i64 %5, i64 %3, i32 0)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %4, %8
%11 = phi i32 [ -1, %8 ], [ 0, %4 ]
ret i32 %11
}
unsigned short DINT_TO_UINT(int var) {
  unsigned short newvar;
  if (var >= 255)
    newvar = 255;
  else if (var < 0)
    newvar = 0;
  else
    newvar = (unsigned short)var;
  return newvar;
}


x86 assembly (clang, -O0):
<DINT_TO_UINT>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jl     111f <DINT_TO_UINT+0x1f>
movw   $0xff,-0x6(%rbp)
jmp    1140 <DINT_TO_UINT+0x40>
cmpl   $0x0,-0x4(%rbp)
jge    1134 <DINT_TO_UINT+0x34>
movw   $0x0,-0x6(%rbp)
jmp    113b <DINT_TO_UINT+0x3b>
mov    -0x4(%rbp),%eax
mov    %ax,-0x6(%rbp)
jmp    1140 <DINT_TO_UINT+0x40>
movzwl -0x6(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DINT_TO_UINT>:
xor    %ecx,%ecx
test   %edi,%edi
cmovg  %edi,%ecx
cmp    $0xff,%edi
mov    $0xff,%eax
cmovl  %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i16 @DINT_TO_UINT(i32 %0) {
%2 = alloca i32
%3 = alloca i16
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 255
br i1 %5, label %6, label %7
6: ; preds = %1
store i16 255, i16* %3
br label %15
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
store i16 0, i16* %3
br label %14
11: ; preds = %7
%12 = load i32, i32* %2
%13 = trunc i32 %12 to i16
store i16 %13, i16* %3
br label %14
14: ; preds = %11, %10
br label %15
15: ; preds = %14, %6
%16 = load i16, i16* %3
ret i16 %16
}

LLVM IR (-O2):
define zeroext i16 @DINT_TO_UINT(i32 %0) {
%2 = icmp sgt i32 %0, 254
%3 = icmp sgt i32 %0, 0
%4 = select i1 %3, i32 %0, i32 0
%5 = trunc i32 %4 to i16
%6 = select i1 %2, i16 255, i16 %5
ret i16 %6
}
void putStringTo2Char(const char *_string, char *_output) {
  _output[0] = _string[0];
  _output[1] = _string[1];
}


x86 assembly (clang, -O0):
<putStringTo2Char>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<putStringTo2Char>:
mov    (%rdi),%al
mov    %al,(%rsi)
mov    0x1(%rdi),%al
mov    %al,0x1(%rsi)
ret

LLVM IR (-O0):
define void @putStringTo2Char(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 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %14
ret void
}

LLVM IR (-O2):
define void @putStringTo2Char(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
store i8 %3, i8* %1
%4 = getelementptr inbounds i8, i8* %0, i64 1
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %5, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assem_debug(char *, int, int);
int /*<<< orphan*/ output_byte(int);
int /*<<< orphan*/ output_modrm(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ output_w32(int);
void emit_writeword_imm(int imm, int addr) {
  assem_debug("movl $%x,%x\n", imm, addr);
  output_byte(0xC7);
  output_modrm(0, 5, 0);
  output_w32(addr);
  output_w32(imm);
}


x86 assembly (clang, -O0):
<emit_writeword_imm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xea5(%rip),%rdi
call   1030 <assem_debug@plt>
mov    $0xc7,%edi
call   1050 <output_byte@plt>
xor    %edx,%edx
mov    $0x5,%esi
mov    %edx,%edi
call   1060 <output_modrm@plt>
mov    -0x8(%rbp),%edi
call   1040 <output_w32@plt>
mov    -0x4(%rbp),%edi
call   1040 <output_w32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emit_writeword_imm>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xeb2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <assem_debug@plt>
mov    $0xc7,%edi
call   1050 <output_byte@plt>
xor    %edi,%edi
mov    $0x5,%esi
xor    %edx,%edx
call   1060 <output_modrm@plt>
mov    %ebx,%edi
call   1040 <output_w32@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <output_w32@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"movl $%x,%x\0A\00"
define void @emit_writeword_imm(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 = call i32 @assem_debug(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = call i32 @output_byte(i32 199)
%9 = call i32 @output_modrm(i32 0, i32 5, i32 0)
%10 = load i32, i32* %4
%11 = call i32 @output_w32(i32 %10)
%12 = load i32, i32* %3
%13 = call i32 @output_w32(i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"movl $%x,%x\0A\00"
define void @emit_writeword_imm(i32 %0, i32 %1) {
%3 = tail call i32 @assem_debug(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = tail call i32 @output_byte(i32 199)
%5 = tail call i32 @output_modrm(i32 0, i32 5, i32 0)
%6 = tail call i32 @output_w32(i32 %1)
%7 = tail call i32 @output_w32(i32 %0)
ret void
}
/* Variables and functions */
int UINT_MAX;
unsigned clz(unsigned x) {
  int e;
  for (e = 0;
       (UINT_MAX / (1 << (e + 1)) > x) && (UINT_MAX / (1 << (e + 1)) != 1); ++e)
    ;
  return e;
}


x86 assembly (clang, -O0):
<clz>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2ed3(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
xor    %eax,%eax
cmp    -0x4(%rbp),%ecx
mov    %al,-0x9(%rbp)
jbe    115d <clz+0x5d>
mov    0x2ea8(%rip),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
cltd
idiv   %ecx
cmp    $0x1,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    116d <clz+0x6d>
jmp    1180 <clz+0x80>
jmp    1172 <clz+0x72>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <clz+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clz>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%r8d
mov    $0xffffffff,%ecx
nop
add    $0x1,%ecx
mov    $0x2,%esi
shl    %cl,%esi
mov    %r8d,%eax
cltd
idiv   %esi
cmp    %edi,%eax
jbe    1129 <clz+0x29>
cmp    $0x1,%eax
jne    1110 <clz+0x10>
mov    %ecx,%eax
ret

LLVM IR (-O0):
@UINT_MAX = global i32 0
define i32 @clz(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %22, %1
%5 = load i32, i32* @UINT_MAX
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
%8 = shl i32 1, %7
%9 = sdiv i32 %5, %8
%10 = load i32, i32* %2
%11 = icmp ugt i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %4
%13 = load i32, i32* @UINT_MAX
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
%16 = shl i32 1, %15
%17 = sdiv i32 %13, %16
%18 = icmp ne i32 %17, 1
br label %19
19: ; preds = %12, %4
%20 = phi i1 [ false, %4 ], [ %18, %12 ]
br i1 %20, label %21, label %25
21: ; preds = %19
br label %22
22: ; preds = %21
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
br label %4
25: ; preds = %19
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@UINT_MAX = global i32 0
define i32 @clz(i32 %0) {
%2 = load i32, i32* @UINT_MAX
br label %3
3: ; preds = %3, %1
%4 = phi i32 [ 0, %1 ], [ %5, %3 ]
%5 = add nuw nsw i32 %4, 1
%6 = shl nuw i32 2, %4
%7 = sdiv i32 %2, %6
%8 = icmp ule i32 %7, %0
%9 = icmp eq i32 %7, 1
%10 = or i1 %8, %9
br i1 %10, label %11, label %3
11: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int h(int);
int i(int);
int j(int, int);
int k(int, int);
int main() {
  volatile int tem = h(-1);
  tem = i(-1);
  tem = j(-1, 2);
  tem = k(-1, 0x7fffffff / 2 + 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffff,%edi
call   1040 <h@plt>
mov    %eax,-0x8(%rbp)
mov    $0xffffffff,%edi
call   1050 <i@plt>
mov    %eax,-0x8(%rbp)
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1030 <j@plt>
mov    %eax,-0x8(%rbp)
mov    $0xffffffff,%edi
mov    $0x40000000,%esi
call   1060 <k@plt>
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
call   1040 <h@plt>
mov    %eax,0x4(%rsp)
mov    $0xffffffff,%edi
call   1050 <i@plt>
mov    %eax,0x4(%rsp)
mov    $0xffffffff,%edi
mov    $0x2,%esi
call   1030 <j@plt>
mov    %eax,0x4(%rsp)
mov    $0xffffffff,%edi
mov    $0x40000000,%esi
call   1060 <k@plt>
mov    %eax,0x4(%rsp)
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @h(i32 -1)
store volatile i32 %3, i32* %2
%4 = call i32 @i(i32 -1)
store volatile i32 %4, i32* %2
%5 = call i32 @j(i32 -1, i32 2)
store volatile i32 %5, i32* %2
%6 = call i32 @k(i32 -1, i32 1073741824)
store volatile i32 %6, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @h(i32 -1)
store volatile i32 %3, i32* %1
%4 = tail call i32 @i(i32 -1)
store volatile i32 %4, i32* %1
%5 = tail call i32 @j(i32 -1, i32 2)
store volatile i32 %5, i32* %1
%6 = tail call i32 @k(i32 -1, i32 1073741824)
store volatile i32 %6, i32* %1
ret i32 0
}
/* Variables and functions */
void *realloc(void *, size_t);
int /*<<< orphan*/ xalloc_die();
void *xrealloc(void *p, size_t n) {
  p = realloc(p, n);
  if (p == 0 && n)
    xalloc_die();
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
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   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115e <xrealloc+0x3e>
cmpq   $0x0,-0x10(%rbp)
je     115e <xrealloc+0x3e>
mov    $0x0,%al
call   1030 <xalloc_die@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1040 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1140 <xrealloc+0x20>
test   %r14,%r14
jne    1140 <xrealloc+0x20>
xor    %eax,%eax
call   1030 <xalloc_die@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (...) @xalloc_die()
br label %9
9: ; preds = %7, %2
ret i8* %3
}
void nat_traversal_ka_event(void) {}


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

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

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

LLVM IR (-O2):
define void @nat_traversal_ka_event() {
ret void
}
int main(void) {
  unsigned char x;
  double y = 80;
  x = y;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movabs $0x4054000000000000,%rax
mov    %rax,-0x10(%rbp)
cvttsd2si -0x10(%rbp),%eax
mov    %al,-0x5(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca double
store i32 0, i32* %1
store double 8.000000e+01, double* %3
%4 = load double, double* %3
%5 = fptoui double %4 to i8
store i8 %5, i8* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn4() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn4");
  return result;
}


x86 assembly (clang, -O0):
<fn4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn4>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"fn4\00"
define i8* @fn4() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void mexit(int status) { exit(status); }


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

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

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

LLVM IR (-O2):
define void @mexit(i32 %0) {
%2 = tail call i32 @exit(i32 %0)
unreachable
}
void foo107() {}


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

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

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

LLVM IR (-O2):
define void @foo107() {
ret void
}
float per_circle(float aktin) { return 2 * 3.14 * aktin; }


x86 assembly (clang, -O0):
<per_circle>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xee6(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<per_circle>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @per_circle(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double 6.280000e+00, %4
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @per_circle(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 6.280000e+00
%4 = fptrunc double %3 to float
ret float %4
}
/* Variables and functions */
unsigned int strlen(char const *);
unsigned int osc_strsize(const char *s) {
  unsigned int len = strlen(s);
  return (len + 4 - (len & 3));
}


x86 assembly (clang, -O0):
<osc_strsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    -0xc(%rbp),%ecx
and    $0x3,%ecx
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<osc_strsize>:
push   %rax
call   1030 <strlen@plt>
add    $0x4,%eax
and    $0xfffffffc,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @osc_strsize(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 = load i32, i32* %3
%7 = add i32 %6, 4
%8 = load i32, i32* %3
%9 = and i32 %8, 3
%10 = sub i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @osc_strsize(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add i32 %2, 4
%4 = and i32 %3, -4
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *asctime(int /*<<< orphan*/);
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char *now() {
  time_t t;
  time(&t);
  return asctime(localtime(&t));
}


x86 assembly (clang, -O0):
<now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1050 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %eax,%edi
call   1040 <asctime@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @now() {
%1 = alloca i32
%2 = call i32 @time(i32* %1)
%3 = call i32 @localtime(i32* %1)
%4 = call i8* @asctime(i32 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @now() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call i32 @localtime(i32* %1)
%5 = call i8* @asctime(i32 %4)
ret i8* %5
}
int prepareDensityData(void) {
  return 1;
  return 1;
}


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

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

LLVM IR (-O0):
define i32 @prepareDensityData() {
ret i32 1
}

LLVM IR (-O2):
define i32 @prepareDensityData() {
ret i32 1
}
/* Type definitions */
typedef int x;
typedef int uint32_t;

/* Variables and functions */
uint32_t bswap_32(uint32_t x) {
  return ((((x)&0xff000000) >> 24) | (((x)&0x00ff0000) >> 8) |
          (((x)&0x0000ff00) << 8) | (((x)&0x000000ff) << 24));
}


x86 assembly (clang, -O0):
<bswap_32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
shr    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bswap_32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -16777216
%5 = lshr i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 16711680
%8 = ashr i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 65280
%12 = shl i32 %11, 8
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = and i32 %14, 255
%16 = shl i32 %15, 24
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @bswap_32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ padchar(char, int);
int /*<<< orphan*/ stdout;
void announce(char *str) {
  padchar('-', 20);
  fprintf(stdout, " %s ", str);
  padchar('-', 20);
  fprintf(stdout, "\n");
}


x86 assembly (clang, -O0):
<announce>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2d,%edi
mov    $0x14,%esi
call   1030 <padchar@plt>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x2d,%edi
mov    $0x14,%esi
call   1030 <padchar@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<announce>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x2d,%edi
mov    $0x14,%esi
call   1030 <padchar@plt>
mov    0x2ea3(%rip),%r14
mov    (%r14),%edi
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x2d,%edi
mov    $0x14,%esi
call   1030 <padchar@plt>
mov    (%r14),%edi
lea    0xe9b(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [5 x i8] c" %s \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @announce(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @padchar(i8 signext 45, i32 20)
%4 = load i32, i32* @stdout
%5 = load i8*, i8** %2
%6 = call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = call i32 @padchar(i8 signext 45, i32 20)
%8 = load i32, i32* @stdout
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [5 x i8] c" %s \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @announce(i8* %0) {
%2 = tail call i32 @padchar(i8 signext 45, i32 20)
%3 = load i32, i32* @stdout
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 @padchar(i8 signext 45, i32 20)
%6 = load i32, i32* @stdout
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
const char *dcGetErrorString(int mode) {
  switch (mode) {
  case 0:
    return "none";
  case -1:
    return "unsupported mode";
  default:
    return "(unknown mode id)";
  }
}


x86 assembly (clang, -O0):
<dcGetErrorString>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0xffffffff,%eax
je     113b <dcGetErrorString+0x3b>
jmp    111b <dcGetErrorString+0x1b>
mov    -0x10(%rbp),%eax
test   %eax,%eax
jne    114b <dcGetErrorString+0x4b>
jmp    112b <dcGetErrorString+0x2b>
lea    0xece(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <dcGetErrorString+0x56>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <dcGetErrorString+0x56>
lea    0xec4(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcGetErrorString>:
cmp    $0xffffffff,%edi
lea    0xefb(%rip),%rax
lea    0xf05(%rip),%rcx
cmove  %rax,%rcx
test   %edi,%edi
lea    0xee2(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"none\00"
@.str.1 = [17 x i8] c"unsupported mode\00"
@.str.2 = [18 x i8] c"(unknown mode id)\00"
define i8* @dcGetErrorString(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 0, label %5
i32 -1, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"none\00"
@.str.1 = [17 x i8] c"unsupported mode\00"
@.str.2 = [18 x i8] c"(unknown mode id)\00"
define i8* @dcGetErrorString(i32 %0) {
%2 = icmp eq i32 %0, -1
%3 = select i1 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i32 %0, 0
%5 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
/* Variables and functions */
int *malloc(int);
bool *parse_flag_noarg(const char *argv) {
  bool *result = malloc(sizeof(*result));
  *result = true;
  return result;
}


x86 assembly (clang, -O0):
<parse_flag_noarg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_flag_noarg>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
movl   $0x1,(%rax)
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i32* @parse_flag_noarg(i8* nocapture readnone %0) {
%2 = tail call i32* @malloc(i32 4)
store i32 1, i32* %2
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ syscall(int, char *, int /*<<< orphan*/);
int sin() {
  char uline[64];
  syscall(10, uline, 0);
  printf("uline=%s\n", uline);
}


x86 assembly (clang, -O0):
<sin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x50(%rbp),%rsi
mov    $0xa,%edi
xor    %edx,%edx
call   1040 <syscall@plt>
lea    -0x50(%rbp),%rsi
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sin>:
push   %rbx
sub    $0x40,%rsp
mov    %rsp,%rbx
mov    $0xa,%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1040 <syscall@plt>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"uline=%s\0A\00"
define i32 @sin() {
%1 = alloca i32
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = call i32 @syscall(i32 10, i8* %3, i32 0)
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [10 x i8] c"uline=%s\0A\00"
define i32 @sin() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = call i32 @syscall(i32 10, i8* %2, i32 0)
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 undef
}
/* Variables and functions */
size_t ft_strlen(char const *s) {
  size_t i;
  i = 0;
  while (s[i])
    i++;
  return (i);
}


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

x86 assembly (clang, -O2):
<ft_strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <ft_strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @ft_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ 0, %1 ], [ %7, %2 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i64 %3
}
/* Variables and functions */
int sched_getcpu();
int findmycpu_() {
  int cpu;
  cpu = sched_getcpu();
  return cpu;
}


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

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

LLVM IR (-O0):
define i32 @findmycpu_() {
%1 = alloca i32
%2 = call i32 (...) @sched_getcpu()
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @findmycpu_() {
%1 = tail call i32 (...) @sched_getcpu()
ret i32 %1
}
int test_imm_44uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x44 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_44uint64_highword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x20,%rdx
and    $0x44,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_44uint64_highword_reg>:
movabs $0x4400000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_44uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 68
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_44uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 292057776128
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int isPalindrome(char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("%d\n", isPalindrome(argv[1]));
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <isPalindrome@plt>
mov    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1040 <isPalindrome@plt>
lea    0xecf(%rip),%rdi
mov    %eax,%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(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 i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @isPalindrome(i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @isPalindrome(i8* %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Variables and functions */
scalar_t__ endianness();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  printf("Machine is %s Endian\n", endianness() ? "Little" : "Big");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <endianness@plt>
mov    %rax,%rcx
lea    0xedd(%rip),%rsi
lea    0xecf(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <endianness@plt>
test   %rax,%rax
lea    0xeeb(%rip),%rax
lea    0xedd(%rip),%rsi
cmove  %rax,%rsi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Machine is %s Endian\0A\00"
@.str.1 = [7 x i8] c"Little\00"
@.str.2 = [4 x i8] c"Big\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @endianness()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%6 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Machine is %s Endian\0A\00"
@.str.1 = [7 x i8] c"Little\00"
@.str.2 = [4 x i8] c"Big\00"
define i32 @main() {
%1 = tail call i64 (...) @endianness()
%2 = icmp eq i64 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ get_pin(int /*<<< orphan*/, int, int);
uint8_t io_get_pin_polarity(uint8_t pin) { return get_pin(pin, 0x02, 0x03); }


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

x86 assembly (clang, -O2):
<io_get_pin_polarity>:
mov    $0x2,%esi
mov    $0x3,%edx
jmp    1030 <get_pin@plt>

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

LLVM IR (-O2):
define i32 @io_get_pin_polarity(i32 %0) {
%2 = tail call i32 @get_pin(i32 %0, i32 2, i32 3)
ret i32 %2
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  short __flags;
};
typedef TYPE_1__ posix_spawnattr_t;

/* Variables and functions */
int posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags) {
  attr->__flags = flags;
  return 0;
}


x86 assembly (clang, -O0):
<posix_spawnattr_setflags>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<posix_spawnattr_setflags>:
mov    %si,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i16 }
define i32 @posix_spawnattr_setflags(%struct.TYPE_3__* %0, i16 signext %1) {
%3 = alloca %struct.TYPE_3__*
%4 = alloca i16
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load %struct.TYPE_3__*, %struct.TYPE_3__** %3
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %6, i32 0, i32 0
store i16 %5, i16* %7
ret i32 0
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i16 }
define i32 @posix_spawnattr_setflags(%struct.TYPE_3__* nocapture writeonly %0, i16 signext %1) {
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
store i16 %1, i16* %3
ret i32 0
}