xunge/DecIR huggingface dataset:
char *StrUpr(char *str) {
  char *strp = str;
  while (*strp != 0) {
    if ((*strp >= 'a') && (*strp <= 'z')) {
      *strp -= 0x20;
    }
    strp++;
  }
  return str;
}


x86 assembly (clang, -O0):
<StrUpr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115d <StrUpr+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x61,%eax
jl     114c <StrUpr+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7a,%eax
jg     114c <StrUpr+0x4c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x20,%ecx
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <StrUpr+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrUpr>:
mov    %rdi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     112c <StrUpr+0x2c>
lea    0x1(%rax),%rdx
jmp    111b <StrUpr+0x1b>
nop
movzbl (%rdx),%ecx
add    $0x1,%rdx
test   %cl,%cl
je     112c <StrUpr+0x2c>
lea    -0x61(%rcx),%esi
cmp    $0x19,%sil
ja     1110 <StrUpr+0x10>
add    $0xe0,%cl
mov    %cl,-0x1(%rdx)
jmp    1110 <StrUpr+0x10>
ret

LLVM IR (-O0):
define i8* @StrUpr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %26, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp sge i32 %13, 97
br i1 %14, label %15, label %26
15: ; preds = %10
%16 = load i8*, i8** %3
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 122
br i1 %19, label %20, label %26
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = sub nsw i32 %23, 32
%25 = trunc i32 %24 to i8
store i8 %25, i8* %21
br label %26
26: ; preds = %20, %15, %10
%27 = load i8*, i8** %3
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %3
br label %5
29: ; preds = %5
%30 = load i8*, i8** %2
ret i8* %30
}

LLVM IR (-O2):
define i8* @StrUpr(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %13, %11 ], [ %2, %1 ]
%6 = phi i8* [ %12, %11 ], [ %0, %1 ]
%7 = add i8 %5, -97
%8 = icmp ult i8 %7, 26
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = add nsw i8 %5, -32
store i8 %10, i8* %6
br label %11
11: ; preds = %9, %4
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %11, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ msg_rcv(int, int);
int /*<<< orphan*/ msg_snd(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stdout;
void child(int msqid) {
  int i = 1;
  while (1) {
    msg_rcv(msqid, i);
    printf("Client: %d\n", i);
    fflush(stdout);
    msg_snd(msqid, i + 1);
    i += 2;
  }
  exit(0);
}


x86 assembly (clang, -O0):
<child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <msg_rcv@plt>
mov    -0x8(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x10(%rbp)
call   1040 <msg_snd@plt>
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x8(%rbp)
jmp    1152 <child+0x12>

x86 assembly (clang, -O2):
<child>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x1,%ebx
lea    0xeab(%rip),%r14
mov    0x2e84(%rip),%r15
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <msg_rcv@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
mov    (%r15),%edi
call   1060 <fflush@plt>
lea    0x1(%rbx),%esi
mov    %ebp,%edi
call   1040 <msg_snd@plt>
add    $0x2,%ebx
jmp    1160 <child+0x20>

LLVM IR (-O0):
@.str = [12 x i8] c"Client: %d\0A\00"
@stdout = global i32 0
define void @child(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %1, %4
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 @msg_rcv(i32 %5, i32 %6)
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @stdout
%11 = call i32 @fflush(i32 %10)
%12 = load i32, i32* %2
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
%15 = call i32 @msg_snd(i32 %12, i32 %14)
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 2
store i32 %17, i32* %3
br label %4
}

LLVM IR (-O2):
@.str = [12 x i8] c"Client: %d\0A\00"
@stdout = global i32 0
define void @child(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %10, %2 ]
%4 = tail call i32 @msg_rcv(i32 %0, i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
%6 = load i32, i32* @stdout
%7 = tail call i32 @fflush(i32 %6)
%8 = add nuw nsw i32 %3, 1
%9 = tail call i32 @msg_snd(i32 %0, i32 %8)
%10 = add nuw nsw i32 %3, 2
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ *Mem_Alloc(int);
scalar_t__ Mem_Init(int);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int main() {
  assert(Mem_Init(4096) == 0);
  assert(Mem_Alloc(2048) != NULL);
  assert(Mem_Alloc(2047) == NULL);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x800,%edi
call   1050 <Mem_Alloc@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x7ff,%edi
call   1050 <Mem_Alloc@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1000,%edi
call   1030 <Mem_Init@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    $0x800,%edi
call   1050 <Mem_Alloc@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1040 <assert@plt>
mov    $0x7ff,%edi
call   1050 <Mem_Alloc@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @Mem_Init(i32 4096)
%3 = icmp eq i64 %2, 0
%4 = zext i1 %3 to i32
%5 = call i32 @assert(i32 %4)
%6 = call i32* @Mem_Alloc(i32 2048)
%7 = icmp ne i32* %6, null
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32* @Mem_Alloc(i32 2047)
%11 = icmp eq i32* %10, null
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 @Mem_Init(i32 4096)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32* @Mem_Alloc(i32 2048)
%6 = icmp ne i32* %5, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = tail call i32* @Mem_Alloc(i32 2047)
%10 = icmp eq i32* %9, null
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
scalar_t__ asprintf(char **, char *, char const *, char const *);
char *concat_strings(const char *s, const char *t) {
  char *buf;
  if (asprintf(&buf, "%s%s", s, t) < 0)
    return NULL;
  return buf;
}


x86 assembly (clang, -O0):
<concat_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%rdi
lea    0xecd(%rip),%rsi
call   1030 <asprintf@plt>
cmp    $0x0,%rax
jge    114f <concat_strings+0x3f>
movq   $0x0,-0x8(%rbp)
jmp    1157 <concat_strings+0x47>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concat_strings>:
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee2(%rip),%rsi
mov    %rsp,%rdi
call   1030 <asprintf@plt>
test   %rax,%rax
js     1131 <concat_strings+0x21>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s%s\00"
define i8* @concat_strings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i64 @asprintf(i8** %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = icmp slt i64 %5, 0
%7 = load i8*, i8** %3
%8 = select i1 %6, i8* null, i8* %7
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
main() {
  char *s;
  char *fun();
  s = fun();
  printf("%s", s);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <fun@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

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

/* Variables and functions */
void handler(int signum, siginfo_t *info, void *act) {}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @handler(i32 %0, i32* nocapture %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rk29sdk_wifi_power(int);
int sif_get_bt_config();
scalar_t__ sif_get_retry_config();
int sif_get_rst_config();
void sif_platform_reset_target(void) {
  if (sif_get_bt_config() == 1 && sif_get_retry_config() == 0) {
    if (sif_get_rst_config() == 1) {
    } else {
    }
  } else {
    rk29sdk_wifi_power(0);
    rk29sdk_wifi_power(1);
  }
}


x86 assembly (clang, -O0):
<sif_platform_reset_target>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <sif_get_bt_config@plt>
cmp    $0x1,%eax
jne    1184 <sif_platform_reset_target+0x44>
mov    $0x0,%al
call   1060 <sif_get_retry_config@plt>
cmp    $0x0,%rax
jne    1184 <sif_platform_reset_target+0x44>
mov    $0x0,%al
call   1040 <sif_get_rst_config@plt>
cmp    $0x1,%eax
jne    117a <sif_platform_reset_target+0x3a>
jmp    117f <sif_platform_reset_target+0x3f>
jmp    117f <sif_platform_reset_target+0x3f>
jmp    1195 <sif_platform_reset_target+0x55>
xor    %edi,%edi
call   1030 <rk29sdk_wifi_power@plt>
mov    $0x1,%edi
call   1030 <rk29sdk_wifi_power@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sif_platform_reset_target>:
push   %rax
xor    %eax,%eax
call   1050 <sif_get_bt_config@plt>
cmp    $0x1,%eax
jne    1159 <sif_platform_reset_target+0x19>
xor    %eax,%eax
call   1060 <sif_get_retry_config@plt>
test   %rax,%rax
je     116b <sif_platform_reset_target+0x2b>
xor    %edi,%edi
call   1030 <rk29sdk_wifi_power@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <rk29sdk_wifi_power@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <sif_get_rst_config@plt>

LLVM IR (-O0):
define void @sif_platform_reset_target() {
%1 = call i32 (...) @sif_get_bt_config()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %12
3: ; preds = %0
%4 = call i64 (...) @sif_get_retry_config()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = call i32 (...) @sif_get_rst_config()
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %6
br label %11
10: ; preds = %6
br label %11
11: ; preds = %10, %9
br label %15
12: ; preds = %3, %0
%13 = call i32 @rk29sdk_wifi_power(i32 0)
%14 = call i32 @rk29sdk_wifi_power(i32 1)
br label %15
15: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @sif_platform_reset_target() {
%1 = tail call i32 (...) @sif_get_bt_config()
%2 = icmp eq i32 %1, 1
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i64 (...) @sif_get_retry_config()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (...) @sif_get_rst_config()
br label %11
8: ; preds = %3, %0
%9 = tail call i32 @rk29sdk_wifi_power(i32 0)
%10 = tail call i32 @rk29sdk_wifi_power(i32 1)
br label %11
11: ; preds = %8, %6
ret void
}
/* Variables and functions */
int divides(int, int);
bool is_factor(int n, int m) { return divides(n, m); }


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

x86 assembly (clang, -O2):
<is_factor>:
jmp    1030 <divides@plt>

LLVM IR (-O0):
define i32 @is_factor(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 @divides(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_factor(i32 %0, i32 %1) {
%3 = tail call i32 @divides(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int a = 0;
  int b = a + 1;
  printf("hello, world");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xeca(%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
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"hello, world\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_CLOEXEC;
int pipe2(int *, int /*<<< orphan*/);
int cloexec_pipe(int fds[2]) { return pipe2(fds, O_CLOEXEC); }


x86 assembly (clang, -O0):
<cloexec_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <pipe2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cloexec_pipe>:
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <pipe2@plt>

LLVM IR (-O0):
@O_CLOEXEC = global i32 0
define i32 @cloexec_pipe(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @O_CLOEXEC
%5 = call i32 @pipe2(i32* %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@O_CLOEXEC = global i32 0
define i32 @cloexec_pipe(i32* %0) {
%2 = load i32, i32* @O_CLOEXEC
%3 = tail call i32 @pipe2(i32* %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
int __api(int, int /*<<< orphan*/);
int rt_background(void) { return (__api(11, 0) == 1) ? 0 : 1; }


x86 assembly (clang, -O0):
<rt_background>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb,%edi
xor    %esi,%esi
call   1030 <__api@plt>
mov    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rt_background>:
push   %rax
mov    $0xb,%edi
xor    %esi,%esi
call   1030 <__api@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rt_background() {
%1 = call i32 @__api(i32 11, i32 0)
%2 = icmp eq i32 %1, 1
%3 = zext i1 %2 to i64
%4 = select i1 %2, i32 0, i32 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @rt_background() {
%1 = tail call i32 @__api(i32 11, i32 0)
%2 = icmp ne i32 %1, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
bool mpga_get_original(const uint8_t *p_mpga) { return !!(p_mpga[3] & 0x40); }


x86 assembly (clang, -O0):
<mpga_get_original>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
and    $0x40,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpga_get_original>:
mov    0xc(%rdi),%eax
shr    $0x6,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @mpga_get_original(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = load i32, i32* %4
%6 = and i32 %5, 64
%7 = icmp ne i32 %6, 0
%8 = xor i1 %7, true
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @mpga_get_original(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = load i32, i32* %2
%4 = lshr i32 %3, 6
%5 = and i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ asknumnodes();
int /*<<< orphan*/ createlist();
int /*<<< orphan*/ destroylist();
int /*<<< orphan*/ printlist();
int /*<<< orphan*/ spiralify();
int main(void) {
  while (8) {
    asknumnodes();
    createlist();
    printlist();
    spiralify();
    printlist();
    destroylist();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <asknumnodes@plt>
mov    $0x0,%al
call   1040 <createlist@plt>
mov    $0x0,%al
call   1070 <printlist@plt>
mov    $0x0,%al
call   1030 <spiralify@plt>
mov    $0x0,%al
call   1070 <printlist@plt>
mov    $0x0,%al
call   1060 <destroylist@plt>
jmp    115f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <asknumnodes@plt>
xor    %eax,%eax
call   1040 <createlist@plt>
xor    %eax,%eax
call   1070 <printlist@plt>
xor    %eax,%eax
call   1030 <spiralify@plt>
xor    %eax,%eax
call   1070 <printlist@plt>
xor    %eax,%eax
call   1060 <destroylist@plt>
jmp    1160 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
%3 = call i32 (...) @asknumnodes()
%4 = call i32 (...) @createlist()
%5 = call i32 (...) @printlist()
%6 = call i32 (...) @spiralify()
%7 = call i32 (...) @printlist()
%8 = call i32 (...) @destroylist()
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @asknumnodes()
%3 = tail call i32 (...) @createlist()
%4 = tail call i32 (...) @printlist()
%5 = tail call i32 (...) @spiralify()
%6 = tail call i32 (...) @printlist()
%7 = tail call i32 (...) @destroylist()
br label %1
}
/* Type definitions */
struct sk_buff {
  int dummy;
};
struct ipv6hdr {
  int dummy;
};

/* Variables and functions */
scalar_t__ skb_network_header(struct sk_buff const *);
struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb) {
  return (struct ipv6hdr *)skb_network_header(skb);
}


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

x86 assembly (clang, -O2):
<ipv6_hdr>:
jmp    1030 <skb_network_header@plt>

LLVM IR (-O0):
%struct.ipv6hdr = type { i32 }
%struct.sk_buff = type { i32 }
define %struct.ipv6hdr* @ipv6_hdr(%struct.sk_buff* %0) {
%2 = alloca %struct.sk_buff*
store %struct.sk_buff* %0, %struct.sk_buff** %2
%3 = load %struct.sk_buff*, %struct.sk_buff** %2
%4 = call i64 @skb_network_header(%struct.sk_buff* %3)
%5 = inttoptr i64 %4 to %struct.ipv6hdr*
ret %struct.ipv6hdr* %5
}

LLVM IR (-O2):
%struct.ipv6hdr = type { i32 }
%struct.sk_buff = type { i32 }
define %struct.ipv6hdr* @ipv6_hdr(%struct.sk_buff* %0) {
%2 = tail call i64 @skb_network_header(%struct.sk_buff* %0)
%3 = inttoptr i64 %2 to %struct.ipv6hdr*
ret %struct.ipv6hdr* %3
}
void start_ftrace_syscalls(void) {}


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

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

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

LLVM IR (-O2):
define void @start_ftrace_syscalls() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main() {
  double d = 123.456789;
  void *v;
  v = &d;
  double p = *((double *)v);
  printf("%lf", p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i8*
%4 = alloca double
store i32 0, i32* %1
store double 0x405EDD3C07EE0B0B, double* %2
%5 = bitcast double* %2 to i8*
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to double*
%8 = load double, double* %7
store double %8, double* %4
%9 = load double, double* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 0x405EDD3C07EE0B0B)
ret i32 0
}
short short_fetch_add_relaxed(short *ptr, int value) {
  return __atomic_fetch_add(ptr, value, 0);
}


x86 assembly (clang, -O0):
<short_fetch_add_relaxed>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%ax
mov    %ax,-0xe(%rbp)
mov    -0xe(%rbp),%ax
lock xadd %ax,(%rcx)
mov    %ax,-0x10(%rbp)
movswl -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<short_fetch_add_relaxed>:
mov    %esi,%eax
lock xadd %ax,(%rdi)
ret

LLVM IR (-O0):
define signext i16 @short_fetch_add_relaxed(i16* %0, i32 %1) {
%3 = alloca i16*
%4 = alloca i32
%5 = alloca i16
%6 = alloca i16
store i16* %0, i16** %3
store i32 %1, i32* %4
%7 = load i16*, i16** %3
%8 = load i32, i32* %4
%9 = trunc i32 %8 to i16
store i16 %9, i16* %5
%10 = load i16, i16* %5
%11 = atomicrmw add i16* %7, i16 %10 monotonic
store i16 %11, i16* %6
%12 = load i16, i16* %6
ret i16 %12
}

LLVM IR (-O2):
define signext i16 @short_fetch_add_relaxed(i16* nocapture %0, i32 %1) {
%3 = trunc i32 %1 to i16
%4 = atomicrmw add i16* %0, i16 %3 monotonic
ret i16 %4
}
int bit_count(long x) {
  int n = 0;
  if (x)
    do
      n++;
    while (0 != (x = x & (x - 1)));
  return (n);
}


x86 assembly (clang, -O0):
<bit_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <bit_count+0x4b>
jmp    111f <bit_count+0x1f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
and    %rax,%rcx
mov    %rcx,-0x8(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    111f <bit_count+0x1f>
jmp    114b <bit_count+0x4b>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bit_count>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <bit_count+0x1c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
lea    -0x1(%rdi),%rcx
and    %rcx,%rdi
jne    1110 <bit_count+0x10>
ret

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

LLVM IR (-O2):
define i32 @bit_count(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %6, %3 ], [ 0, %1 ]
%6 = add nuw nsw i32 %5, 1
%7 = add nsw i64 %4, -1
%8 = and i64 %7, %4
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %11
}
struct device *get_device(struct device *dev) {
  struct device *a;
  return a;
}


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

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

LLVM IR (-O0):
%struct.device = type opaque
define %struct.device* @get_device(%struct.device* %0) {
%2 = alloca %struct.device*
%3 = alloca %struct.device*
store %struct.device* %0, %struct.device** %2
%4 = load %struct.device*, %struct.device** %3
ret %struct.device* %4
}

LLVM IR (-O2):
%struct.device = type opaque
define noalias %struct.device* @get_device(%struct.device* nocapture readnone %0) {
ret %struct.device* undef
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void ext_dev_write_float(uint32_t addr, float val, void *ctxt) {}


x86 assembly (clang, -O0):
<ext_dev_write_float>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @ext_dev_write_float(i32 %0, float %1, i8* %2) {
%4 = alloca i32
%5 = alloca float
%6 = alloca i8*
store i32 %0, i32* %4
store float %1, float* %5
store i8* %2, i8** %6
ret void
}

LLVM IR (-O2):
define void @ext_dev_write_float(i32 %0, float %1, i8* nocapture %2) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fclosef(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int,
                           int /*<<< orphan*/ *);
scalar_t__ getpid();
int /*<<< orphan*/ stderr;
int fclose(FILE *fp) {
  fprintf(stderr, "[%d] closing %p\n", (int)getpid(), fp);
  return fclosef(fp);
}


x86 assembly (clang, -O0):
<fclose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%edx
mov    -0x8(%rbp),%rcx
lea    0xea1(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1050 <fclosef@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fclose>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ea3(%rip),%rax
mov    (%rax),%ebp
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xeb3(%rip),%rsi
mov    %ebp,%edi
mov    %eax,%edx
mov    %rbx,%rcx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <fclosef@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"[%d] closing %p\0A\00"
define i32 @fclose(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @stderr
%4 = call i64 (...) @getpid()
%5 = trunc i64 %4 to i32
%6 = load i32*, i32** %2
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %5, i32* %6)
%8 = load i32*, i32** %2
%9 = call i32 @fclosef(i32* %8)
ret i32 %9
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"[%d] closing %p\0A\00"
define i32 @fclose(i32* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i64 (...) @getpid()
%4 = trunc i64 %3 to i32
%5 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4, i32* %0)
%6 = tail call i32 @fclosef(i32* %0)
ret i32 %6
}
int is_io_pin(int pin) {
  switch (pin) {
  case 0 ... 6:
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<is_io_pin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x6,%eax
ja     1124 <is_io_pin+0x24>
jmp    1118 <is_io_pin+0x18>
movl   $0x1,-0x4(%rbp)
jmp    112b <is_io_pin+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_io_pin>:
xor    %eax,%eax
cmp    $0x7,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @is_io_pin(i32 %0) {
%2 = icmp ult i32 %0, 7
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ __wgetmainargs(int *, int /*<<< orphan*/ ***,
                                  int /*<<< orphan*/ ***, int, int *);
int wmain(int, int /*<<< orphan*/ **);
int main() {
  wchar_t **enpv, **argv;
  int argc, si = 0;
  extern int _CRT_glob;
  __wgetmainargs(&argc, &argv, &enpv, _CRT_glob, &si);
  return wmain(argc, argv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%ecx
lea    -0x1c(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x20(%rbp),%r8
call   1030 <__wgetmainargs@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1040 <wmain@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,(%rsp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%ecx
lea    0x4(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %rsp,%r8
call   1030 <__wgetmainargs@plt>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%rsi
call   1040 <wmain@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@_CRT_glob = external global i32
define i32 @main() {
%1 = alloca i32
%2 = alloca i32**
%3 = alloca i32**
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
%6 = load i32, i32* @_CRT_glob
%7 = call i32 @__wgetmainargs(i32* %4, i32*** %3, i32*** %2, i32 %6, i32* %5)
%8 = load i32, i32* %4
%9 = load i32**, i32*** %3
%10 = call i32 @wmain(i32 %8, i32** %9)
ret i32 %10
}

LLVM IR (-O2):
@_CRT_glob = external global i32
define i32 @main() {
%1 = alloca i32**
%2 = alloca i32**
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32*** %1 to i8*
%6 = bitcast i32*** %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = load i32, i32* @_CRT_glob
%10 = call i32 @__wgetmainargs(i32* %3, i32*** %2, i32*** %1, i32 %9, i32* %4)
%11 = load i32, i32* %3
%12 = load i32**, i32*** %2
%13 = call i32 @wmain(i32 %11, i32** %12)
ret i32 %13
}
int cast_uchar_int_fast(unsigned char x) { return (int)x; }


x86 assembly (clang, -O0):
<cast_uchar_int_fast>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cast_uchar_int_fast(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @cast_uchar_int_fast(i8 zeroext %0) {
%2 = zext i8 %0 to i32
ret i32 %2
}
void u32_to_char_arr(char *dest, unsigned int i) {
  dest[0] = (char)(i & 0xFF);
  dest[1] = (char)(i >> 8 & 0xFF);
  dest[2] = (char)(i >> 16 & 0xFF);
  dest[3] = (char)(i >> 24 & 0xFF);
}


x86 assembly (clang, -O0):
<u32_to_char_arr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<u32_to_char_arr>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @u32_to_char_arr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 255
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i32, i32* %4
%11 = lshr i32 %10, 8
%12 = and i32 %11, 255
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 %13, i8* %15
%16 = load i32, i32* %4
%17 = lshr i32 %16, 16
%18 = and i32 %17, 255
%19 = trunc i32 %18 to i8
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 2
store i8 %19, i8* %21
%22 = load i32, i32* %4
%23 = lshr i32 %22, 24
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 %25, i8* %27
ret void
}

LLVM IR (-O2):
define void @u32_to_char_arr(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
store i8 %3, i8* %0
%4 = lshr i32 %1, 8
%5 = trunc i32 %4 to i8
%6 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %5, i8* %6
%7 = lshr i32 %1, 16
%8 = trunc i32 %7 to i8
%9 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %8, i8* %9
%10 = lshr i32 %1, 24
%11 = trunc i32 %10 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void rofl(int arg) {
  printf("Signal Handler (arg=%x)!\n", arg);
  exit(2);
}


x86 assembly (clang, -O0):
<rofl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<rofl>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Signal Handler (arg=%x)!\0A\00"
define void @rofl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@.str = [26 x i8] c"Signal Handler (arg=%x)!\0A\00"
define void @rofl(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @exit(i32 2)
unreachable
}
long WAIT(stat_loc)
long *stat_loc;
{
  if (stat_loc && *stat_loc)
    return ((long)wait(stat_loc));
  else
    return ((long)wait(0));
}


x86 assembly (clang, -O0):
<WAIT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114b <WAIT+0x3b>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     114b <WAIT+0x3b>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <wait@plt>
cltq
mov    %rax,-0x8(%rbp)
jmp    115a <WAIT+0x4a>
xor    %edi,%edi
mov    $0x0,%al
call   1030 <wait@plt>
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WAIT>:
push   %rax
test   %rdi,%rdi
je     1125 <WAIT+0x15>
cmpq   $0x0,(%rdi)
je     1125 <WAIT+0x15>
xor    %eax,%eax
call   1030 <wait@plt>
jmp    112e <WAIT+0x1e>
xor    %edi,%edi
xor    %eax,%eax
call   1030 <wait@plt>
cltq
pop    %rcx
ret

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

LLVM IR (-O2):
define i64 @WAIT(i64* %0) {
%2 = icmp eq i64* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i64, i64* %0
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 (i64*, ...) bitcast (i32 (...)* @wait to i32 (i64*, ...)*)(i64* %0)
br label %10
8: ; preds = %3, %1
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @wait to i32 (i32, ...)*)(i32 0)
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ %7, %6 ], [ %9, %8 ]
%12 = sext i32 %11 to i64
ret i64 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, int, int, int,
                           int);
void draw_else_edge(FILE *fp, int fx, int fy, int tx, int ty, int neg,
                    int inv) {
  fprintf(fp, "(%s) %d %d %d %d else\n", neg ? "n" : "p", fx, fy, tx, ty);
}


x86 assembly (clang, -O0):
<draw_else_edge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%ecx
lea    0xedb(%rip),%rdx
lea    0xed2(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x18(%rbp),%eax
lea    0xe9f(%rip),%rsi
mov    %eax,(%rsp)
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_else_edge>:
push   %rax
mov    %ecx,%r10d
mov    %edx,%eax
mov    %esi,%ecx
test   %r9d,%r9d
lea    0xef7(%rip),%rsi
lea    0xeee(%rip),%rdx
cmove  %rsi,%rdx
mov    %r8d,(%rsp)
lea    0xec8(%rip),%rsi
mov    %eax,%r8d
mov    %r10d,%r9d
call   1030 <fprintf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"(%s) %d %d %d %d else\0A\00"
@.str.1 = [2 x i8] c"n\00"
@.str.2 = [2 x i8] c"p\00"
define void @draw_else_edge(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32* %0, i32** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load i32*, i32** %8
%16 = load i32, i32* %13
%17 = icmp ne i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = load i32, i32* %11
%23 = load i32, i32* %12
%24 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %19, i32 %20, i32 %21, i32 %22, i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"(%s) %d %d %d %d else\0A\00"
@.str.1 = [2 x i8] c"n\00"
@.str.2 = [2 x i8] c"p\00"
define void @draw_else_edge(i32* nocapture %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = icmp eq i32 %5, 0
%9 = select i1 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%10 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %1, i32 %2, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
Usage() {
  fprintf(stderr, "Usage: hd [-o Outfile][-r]|[[-sSkip_bytes] file]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<Usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<Usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: hd [-o Outfile][-r]|[[-sSkip_bytes] file]\0A\00"
define i32 @Usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [50 x i8] c"Usage: hd [-o Outfile][-r]|[[-sSkip_bytes] file]\0A\00"
define i32 @Usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int show_bar();
int show_foo() { return show_bar(); }


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

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

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

LLVM IR (-O2):
define i32 @show_foo() {
%1 = tail call i32 (...) @show_bar()
ret i32 %1
}
void glVertexAttribI4uiv(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glVertexAttribI4uiv() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *);
float sqrt(int);
int main(int argc, char **argv) {
  float a;
  scanf("%f", &a);
  printf("telesova uhlopricka: %f \n", a * sqrt(3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
mov    $0x3,%edi
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm1,%xmm0
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
movss  %xmm0,(%rsp)
mov    $0x3,%edi
call   1050 <sqrt@plt>
mulss  (%rsp),%xmm0
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [26 x i8] c"telesova uhlopricka: %f \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %6)
%8 = load float, float* %6
%9 = call float @sqrt(i32 3)
%10 = fmul float %8, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), float %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [26 x i8] c"telesova uhlopricka: %f \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca float
%4 = bitcast float* %3 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%6 = load float, float* %3
%7 = call float @sqrt(i32 3)
%8 = fmul float %6, %7
%9 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), float %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(char *);
char *realloc(char *, int);
int strlen(char *);
char *String_compact(char *dst) {
  dst = realloc(dst, (strlen(dst) + 1) * sizeof(char));
  assert(dst);
  return dst;
}


x86 assembly (clang, -O0):
<String_compact>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<String_compact>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @String_compact(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i8* @realloc(i8* %3, i32 %9)
store i8* %10, i8** %2
%11 = load i8*, i8** %2
%12 = call i32 @assert(i8* %11)
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
define i8* @String_compact(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @realloc(i8* %0, i32 %3)
%5 = tail call i32 @assert(i8* %4)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char const *, char const *);
FILE *FOPEN(const char *name, const char *mode) {
  FILE *f = fopen(name, mode);
  assert(f != NULL);
  return f;
}


x86 assembly (clang, -O0):
<FOPEN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FOPEN>:
push   %rbx
call   1040 <fopen@plt>
mov    %rax,%rbx
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i32* @FOPEN(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i32* @fopen(i8* %6, i8* %7)
store i32* %8, i32** %5
%9 = load i32*, i32** %5
%10 = icmp ne i32* %9, null
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i32*, i32** %5
ret i32* %13
}

LLVM IR (-O2):
define noalias i32* @FOPEN(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp ne i32* %3, null
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
ret i32* %3
}