xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
int interesting(char *s) {
  return strncmp(s, "00000", strlen("00000")) == 0 ? 1 : 0;
}


x86 assembly (clang, -O0):
<interesting>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    0xec5(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
lea    0xeb3(%rip),%rsi
call   1030 <strncmp@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interesting>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"00000\00"
define i32 @interesting(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = call i64 @strncmp(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp eq i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 1, i32 0
ret i32 %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"00000\00"
define i32 @interesting(i8* %0) {
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M755_f(char *s) {
  debug("M755_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M755_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M755_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M755_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M755_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M755_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M755_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_getpwuid_malloc() {
  printf("NOT IMPLEMENTED:"
         "pa_getpwuid_malloc"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [35 x i8] c"NOT IMPLEMENTED:pa_getpwuid_malloc\00"
define i32 @pa_getpwuid_malloc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
hashstring(p) char *p;
{
  int h;
  h = *p - 'A';
  h &= 31;
  return (h);
}


x86 assembly (clang, -O0):
<hashstring>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1f,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashstring>:
mov    (%rdi),%al
add    $0xff,%al
and    $0x1f,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @hashstring(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %6, 65
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = and i32 %8, 31
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
define i32 @hashstring(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, 31
%4 = and i8 %3, 31
%5 = zext i8 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printToScreen(int *x, int n) {
  int i = 0;
  for (i = 0; i < n; i++)
    printf("%d ", x[i]);
}


x86 assembly (clang, -O0):
<printToScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115e <printToScreen+0x4e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <printToScreen+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printToScreen>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <printToScreen+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printToScreen+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printToScreen(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
size_t clu_RoundWorkSize(size_t work_size, size_t group_size) {
  size_t rem = work_size % group_size;
  return (rem == 0) ? work_size : (work_size + group_size - rem);
}


x86 assembly (clang, -O0):
<clu_RoundWorkSize>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1134 <clu_RoundWorkSize+0x34>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1144 <clu_RoundWorkSize+0x44>
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
sub    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clu_RoundWorkSize>:
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1116 <clu_RoundWorkSize+0x16>
mov    %rdi,%rax
xor    %edx,%edx
div    %rsi
jmp    111c <clu_RoundWorkSize+0x1c>
mov    %edi,%eax
xor    %edx,%edx
div    %esi
add    %rdi,%rsi
sub    %rdx,%rsi
test   %rdx,%rdx
cmove  %rdi,%rsi
mov    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @clu_RoundWorkSize(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = urem i64 %6, %7
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i64, i64* %3
br label %19
13: ; preds = %2
%14 = load i64, i64* %3
%15 = load i64, i64* %4
%16 = add i64 %14, %15
%17 = load i64, i64* %5
%18 = sub i64 %16, %17
br label %19
19: ; preds = %13, %11
%20 = phi i64 [ %12, %11 ], [ %18, %13 ]
ret i64 %20
}

LLVM IR (-O2):
define i64 @clu_RoundWorkSize(i64 %0, i64 %1) {
%3 = urem i64 %0, %1
%4 = icmp eq i64 %3, 0
%5 = add i64 %1, %0
%6 = sub i64 %5, %3
%7 = select i1 %4, i64 %0, i64 %6
ret i64 %7
}
void av_register_hwaccel() {}


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

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

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

LLVM IR (-O2):
define void @av_register_hwaccel() {
ret void
}
void avcodec_find_encoder_by_name() {}


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

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

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

LLVM IR (-O2):
define void @avcodec_find_encoder_by_name() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *name) {
  printf("Execution utility for Mininet\n\n"
         "Usage: %s [-cdnp] [-a pid] [-g group] [-r rtprio] cmd args...\n\n"
         "Options:\n"
         "  -c: close all file descriptors except stdin/out/error\n"
         "  -d: detach from tty by calling setsid()\n"
         "  -n: run in new network and mount namespaces\n"
         "  -p: print ^A + pid\n"
         "  -a pid: attach to pid's network and mount namespaces\n"
         "  -g group: add to cgroup\n"
         "  -r rtprio: run with SCHED_RR (usually requires -g)\n"
         "  -v: print version\n",
         name);
}


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

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

LLVM IR (-O0):
@.str = [423 x i8] c"Execution utility for Mininet\0A\0AUsage: %s [-cdnp] [-a pid] [-g group] [-r rtprio] cmd args...\0A\0AOptions:\0A -c: close all file descriptors except stdin/out/error\0A -d: detach from tty by calling setsid()\0A -n: run in new network and mount namespaces\0A -p: print ^A + pid\0A -a pid: attach to pid's network and mount namespaces\0A -g group: add to cgroup\0A -r rtprio: run with SCHED_RR (usually requires -g)\0A -v: print version\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([423 x i8], [423 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [423 x i8] c"Execution utility for Mininet\0A\0AUsage: %s [-cdnp] [-a pid] [-g group] [-r rtprio] cmd args...\0A\0AOptions:\0A -c: close all file descriptors except stdin/out/error\0A -d: detach from tty by calling setsid()\0A -n: run in new network and mount namespaces\0A -p: print ^A + pid\0A -a pid: attach to pid's network and mount namespaces\0A -g group: add to cgroup\0A -r rtprio: run with SCHED_RR (usually requires -g)\0A -v: print version\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([423 x i8], [423 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void DMA2_Channel3_IRQHandler() { default_handler(); }


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

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

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

LLVM IR (-O2):
define weak void @DMA2_Channel3_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ hash_chain(int /*<<< orphan*/ *, int);
void hash_int64(uint32_t *hash, int64_t value) {
  hash_chain(hash, value);
  hash_chain(hash, value >> 32);
}


x86 assembly (clang, -O0):
<hash_int64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <hash_chain@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x20,%ecx
sar    %cl,%esi
call   1030 <hash_chain@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_int64>:
push   %rbx
mov    %rdi,%rbx
call   1030 <hash_chain@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <hash_chain@plt>

LLVM IR (-O0):
define void @hash_int64(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 @hash_chain(i32* %5, i32 %6)
%8 = load i32*, i32** %3
%9 = load i32, i32* %4
%10 = ashr i32 %9, 32
%11 = call i32 @hash_chain(i32* %8, i32 %10)
ret void
}

LLVM IR (-O2):
define void @hash_int64(i32* %0, i32 %1) {
%3 = tail call i32 @hash_chain(i32* %0, i32 %1)
%4 = tail call i32 @hash_chain(i32* %0, i32 poison)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_hello(void) { printf("HELLO ................\n"); }


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

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

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

LLVM IR (-O2):
@str = [23 x i8] c"HELLO ................\00"
define void @print_hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ geteuid();
scalar_t__ getuid();
int seteuid(scalar_t__);
int /*<<< orphan*/ stderr;
int drop() {
  if (seteuid(getuid()) == -1 || geteuid() != getuid()) {
    fprintf(stderr, "Failed to drop privileges.\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<drop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %rax,%rdi
call   1060 <seteuid@plt>
cmp    $0xffffffff,%eax
je     1182 <drop+0x42>
mov    $0x0,%al
call   1040 <geteuid@plt>
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     11a3 <drop+0x63>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11aa <drop+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drop>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getuid@plt>
mov    %rax,%rdi
call   1060 <seteuid@plt>
cmp    $0xffffffff,%eax
je     1170 <drop+0x30>
xor    %eax,%eax
call   1040 <geteuid@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1030 <getuid@plt>
cmp    %rax,%r14
je     118a <drop+0x4a>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
lea    0xe80(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Failed to drop privileges.\0A\00"
define i32 @drop() {
%1 = alloca i32
%2 = call i64 (...) @getuid()
%3 = call i32 @seteuid(i64 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = call i64 (...) @geteuid()
%7 = call i64 (...) @getuid()
%8 = icmp ne i64 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5, %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %13
12: ; preds = %5
store i32 0, i32* %1
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Failed to drop privileges.\0A\00"
define i32 @drop() {
%1 = tail call i64 (...) @getuid()
%2 = tail call i32 @seteuid(i64 %1)
%3 = icmp eq i32 %2, -1
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = tail call i64 (...) @geteuid()
%6 = tail call i64 (...) @getuid()
%7 = icmp eq i64 %5, %6
br i1 %7, label %11, label %8
8: ; preds = %4, %0
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %4, %8
%12 = phi i32 [ 1, %8 ], [ 0, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int creat(char *, int);
int getpid();
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ write(int, char *, int);
void child_pid() {
  int fildes;
  char tmp_line[20];
  fildes = creat("childpid", 0700);
  sprintf(tmp_line, "%d\n", getpid());
  write(fildes, tmp_line, 20);
  close(fildes);
}


x86 assembly (clang, -O0):
<child_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xea1(%rip),%rdi
mov    $0x1c0,%esi
call   1060 <creat@plt>
mov    %eax,-0x4(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe81(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x14,%edx
call   1030 <write@plt>
mov    -0x4(%rbp),%edi
call   1050 <close@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<child_pid>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xea2(%rip),%rdi
mov    $0x1c0,%esi
call   1060 <creat@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xe91(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %eax,%edx
call   1070 <sprintf@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x14,%edx
call   1030 <write@plt>
mov    %ebx,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r14
jmp    1050 <close@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"childpid\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @child_pid() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = call i32 @creat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 448)
store i32 %3, i32* %1
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 (...) @getpid()
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %1
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = call i32 @write(i32 %7, i8* %8, i32 20)
%10 = load i32, i32* %1
%11 = call i32 @close(i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"childpid\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @child_pid() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @creat(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 448)
%4 = tail call i32 (...) @getpid()
%5 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 @write(i32 %3, i8* %2, i32 20)
%7 = tail call i32 @close(i32 %3)
ret void
}
const char *abi(void) { return "amd64"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"amd64\00"
define i8* @abi() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"amd64\00"
define i8* @abi() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
char *text_color(char *, char *);
char *text_red(char *text) { return text_color(text, "\033[0;31m"); }


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

x86 assembly (clang, -O2):
<text_red>:
lea    0xee9(%rip),%rsi
jmp    1030 <text_color@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\1B[0;31m\00"
define i8* @text_red(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @text_color(i8* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %4
}

LLVM IR (-O2):
@.str = [8 x i8] c"\1B[0;31m\00"
define i8* @text_red(i8* %0) {
%2 = tail call i8* @text_color(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
void vpostLCMDeinit(void) {
  *((volatile unsigned int *)((0xB0000200 + 0x10))) =
      (*((volatile unsigned int *)((0xB0000200 + 0x10)))) & ~(1 << 25);
}


x86 assembly (clang, -O0):
<vpostLCMDeinit>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb0000210,%eax
mov    (%rax),%ecx
and    $0xfdffffff,%ecx
mov    $0xb0000210,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpostLCMDeinit>:
mov    $0xb0000210,%eax
andl   $0xfdffffff,(%rax)
ret

LLVM IR (-O0):
define void @vpostLCMDeinit() {
%1 = load volatile i32, i32* inttoptr (i64 2952790544 to i32*)
%2 = and i32 %1, -33554433
store volatile i32 %2, i32* inttoptr (i64 2952790544 to i32*)
ret void
}

LLVM IR (-O2):
define void @vpostLCMDeinit() {
%1 = load volatile i32, i32* inttoptr (i64 2952790544 to i32*)
%2 = and i32 %1, -33554433
store volatile i32 %2, i32* inttoptr (i64 2952790544 to i32*)
ret void
}
/* Variables and functions */
int keyb_inb(int);
int /*<<< orphan*/ outb(int, int);
void keyb_outb(int port, int data) {
  while (keyb_inb(0x64) & 2)
    ;
  outb(port, data);
}


x86 assembly (clang, -O0):
<keyb_outb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x64,%edi
call   1040 <keyb_inb@plt>
and    $0x2,%eax
cmp    $0x0,%eax
je     1149 <keyb_outb+0x29>
jmp    112e <keyb_outb+0xe>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<keyb_outb>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x64,%edi
call   1040 <keyb_inb@plt>
test   $0x2,%al
jne    1130 <keyb_outb+0x10>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @keyb_outb(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %9, %2
%6 = call i32 @keyb_inb(i32 100)
%7 = and i32 %6, 2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @outb(i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
define void @keyb_outb(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @keyb_inb(i32 100)
%5 = and i32 %4, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3
%8 = tail call i32 @outb(i32 %0, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_25519_carry_scmul_121666(uintptr_t, uintptr_t);
void fiat_25519_carry_scmul_121666(uint64_t out1[5], const uint64_t arg1[5]) {
  internal_fiat_25519_carry_scmul_121666((uintptr_t)out1, (uintptr_t)arg1);
}


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

x86 assembly (clang, -O2):
<fiat_25519_carry_scmul_121666>:
jmp    1030 <internal_fiat_25519_carry_scmul_121666@plt>

LLVM IR (-O0):
define void @fiat_25519_carry_scmul_121666(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 = ptrtoint i32* %5 to i64
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = call i32 @internal_fiat_25519_carry_scmul_121666(i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fiat_25519_carry_scmul_121666(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = tail call i32 @internal_fiat_25519_carry_scmul_121666(i64 %3, i64 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x, y, z;
  scanf("%d", &x);
  y = x / 2;
  z = x % 2;
  if (z == 0) {
    printf("even\n");
  } else {
    printf("odd\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1176 <main+0x56>
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <main+0x62>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
testb  $0x1,0x4(%rsp)
lea    0xec9(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [4 x i8] c"odd\00"
@str.3 = [5 x i8] c"even\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0)
%8 = call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
void nfs_readpage_to_fscache(struct inode *inode, struct page *page, int sync) {
}


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

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

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

LLVM IR (-O2):
%struct.inode = type opaque
%struct.page = type opaque
define void @nfs_readpage_to_fscache(%struct.inode* nocapture %0, %struct.page* nocapture %1, i32 %2) {
ret void
}
long long mm_round_down(long long seq) {
  return ((seq) & ~((long long)(1 << 26) - 1));
}


x86 assembly (clang, -O0):
<mm_round_down>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffffc000000,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mm_round_down>:
mov    %rdi,%rax
and    $0xfffffffffc000000,%rax
ret

LLVM IR (-O0):
define i64 @mm_round_down(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, -67108864
ret i64 %4
}

LLVM IR (-O2):
define i64 @mm_round_down(i64 %0) {
%2 = and i64 %0, -67108864
ret i64 %2
}
int kleiner(struct term *mon1, struct term *mon2) { return (-1); }


x86 assembly (clang, -O0):
<kleiner>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.term = type opaque
define i32 @kleiner(%struct.term* %0, %struct.term* %1) {
%3 = alloca %struct.term*
%4 = alloca %struct.term*
store %struct.term* %0, %struct.term** %3
store %struct.term* %1, %struct.term** %4
ret i32 -1
}

LLVM IR (-O2):
%struct.term = type opaque
define i32 @kleiner(%struct.term* nocapture readnone %0, %struct.term* nocapture readnone %1) {
ret i32 -1
}
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int bind(int, struct sockaddr const *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
int i_bind(int fd, const struct sockaddr *addr, int namelen) {
  if (-1 == bind(fd, addr, namelen)) {
    perror("i_bind error:");
    exit(1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<i_bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <bind@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    1176 <i_bind+0x46>
lea    0xe99(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_bind>:
push   %rax
call   1030 <bind@plt>
cmp    $0xffffffff,%eax
je     113f <i_bind+0xf>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeba(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [14 x i8] c"i_bind error:\00"
define i32 @i_bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.sockaddr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.sockaddr* %1, %struct.sockaddr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.sockaddr*, %struct.sockaddr** %5
%9 = load i32, i32* %6
%10 = call i32 @bind(i32 %7, %struct.sockaddr* %8, i32 %9)
%11 = icmp eq i32 -1, %10
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [14 x i8] c"i_bind error:\00"
define i32 @i_bind(i32 %0, %struct.sockaddr* %1, i32 %2) {
%4 = tail call i32 @bind(i32 %0, %struct.sockaddr* %1, i32 %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ output8(int, int);
extern void init_uart(unsigned char DM, unsigned char DL) {
  output8(0x0000 + 3, 0x80);
  output8(0x0000 + 0, DL);
  output8(0x0000 + 1, DM);
  output8(0x0000 + 3, 0x03);
}


x86 assembly (clang, -O0):
<init_uart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    $0x3,%edi
mov    $0x80,%esi
call   1030 <output8@plt>
movzbl -0x2(%rbp),%esi
xor    %edi,%edi
call   1030 <output8@plt>
movzbl -0x1(%rbp),%esi
mov    $0x1,%edi
call   1030 <output8@plt>
mov    $0x3,%esi
mov    %esi,%edi
call   1030 <output8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_uart>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x3,%edi
mov    $0x80,%esi
call   1030 <output8@plt>
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <output8@plt>
mov    $0x1,%edi
mov    %ebp,%esi
call   1030 <output8@plt>
mov    $0x3,%edi
mov    $0x3,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <output8@plt>

LLVM IR (-O0):
define void @init_uart(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = call i32 @output8(i32 3, i32 128)
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = call i32 @output8(i32 0, i32 %7)
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = call i32 @output8(i32 1, i32 %10)
%12 = call i32 @output8(i32 3, i32 3)
ret void
}

LLVM IR (-O2):
define void @init_uart(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call i32 @output8(i32 3, i32 128)
%4 = zext i8 %1 to i32
%5 = tail call i32 @output8(i32 0, i32 %4)
%6 = zext i8 %0 to i32
%7 = tail call i32 @output8(i32 1, i32 %6)
%8 = tail call i32 @output8(i32 3, i32 3)
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ check_pointer(void *);
void *safe_calloc(size_t nmemb, size_t size) {
  void *ptr = calloc(nmemb, size);
  check_pointer(ptr);
  return ptr;
}


x86 assembly (clang, -O0):
<safe_calloc>:
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   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <check_pointer@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_calloc>:
push   %rbx
call   1030 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <check_pointer@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @safe_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = tail call i32 @check_pointer(i8* %3)
ret i8* %3
}
/* Variables and functions */
int event_loop(int /*<<< orphan*/);
int event_dispatch(void) { return (event_loop(0)); }


x86 assembly (clang, -O0):
<event_dispatch>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <event_loop@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<event_dispatch>:
xor    %edi,%edi
jmp    1030 <event_loop@plt>

LLVM IR (-O0):
define i32 @event_dispatch() {
%1 = call i32 @event_loop(i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @event_dispatch() {
%1 = tail call i32 @event_loop(i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ fa(int);
int /*<<< orphan*/ fb(int);
int m() {
  fa(9);
  fb(3);
  return 0;
}


x86 assembly (clang, -O0):
<m>:
push   %rbp
mov    %rsp,%rbp
mov    $0x9,%edi
call   1040 <fa@plt>
mov    $0x3,%edi
call   1030 <fb@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<m>:
push   %rax
mov    $0x9,%edi
call   1040 <fa@plt>
mov    $0x3,%edi
call   1030 <fb@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @m() {
%1 = call i32 @fa(i32 9)
%2 = call i32 @fb(i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @m() {
%1 = tail call i32 @fa(i32 9)
%2 = tail call i32 @fb(i32 3)
ret i32 0
}
/* Variables and functions */
int U_WMRCORENONE_get(char *);
int U_WMR76_get(void) { return U_WMRCORENONE_get("U_WMR76"); }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR76\00"
define i32 @U_WMR76_get() {
%1 = tail call i32 @U_WMRCORENONE_get(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
strput(s) register char *s;
{
  if (s)
    write(1, s, strlen(s));
}


x86 assembly (clang, -O0):
<strput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115b <strput+0x3b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rdx
mov    $0x1,%edi
mov    $0x0,%al
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strput>:
test   %rdi,%rdi
je     1141 <strput+0x21>
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <write@plt>
pop    %rbx
ret

LLVM IR (-O0):
define i32 @strput(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
%10 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 1, i8* %7, i64 %9)
br label %11
11: ; preds = %6, %1
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @strput(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 @strlen(i8* %0)
%5 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 1, i8* %0, i64 %4)
br label %6
6: ; preds = %3, %1
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int pthread_attr_getdetachstate(int /*<<< orphan*/ *, int *);
int my_pthread_attr_getdetachstate(pthread_attr_t const *__attr, int *state) {
  pthread_attr_t *realattr = (pthread_attr_t *)*(unsigned int *)__attr;
  return pthread_attr_getdetachstate(realattr, state);
}


x86 assembly (clang, -O0):
<my_pthread_attr_getdetachstate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <pthread_attr_getdetachstate@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_pthread_attr_getdetachstate>:
mov    (%rdi),%edi
jmp    1030 <pthread_attr_getdetachstate@plt>

LLVM IR (-O0):
define i32 @my_pthread_attr_getdetachstate(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = load i32*, i32** %4
%12 = call i32 @pthread_attr_getdetachstate(i32* %10, i32* %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @my_pthread_attr_getdetachstate(i32* nocapture %0, i32* %1) {
%3 = load i32, i32* %0
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @pthread_attr_getdetachstate(i32* %5, i32* %1)
ret i32 %6
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t substitute(uint8_t a, uint8_t *sbp) {
  uint8_t x;
  x = sbp[a >> 1];
  x = (a & 1) ? x & 0x0F : x >> 4;
  return x;
}


x86 assembly (clang, -O0):
<substitute>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sar    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     113b <substitute+0x3b>
mov    -0x14(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x18(%rbp)
jmp    1144 <substitute+0x44>
mov    -0x14(%rbp),%eax
sar    $0x4,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<substitute>:
mov    %edi,%eax
sar    %eax
cltq
mov    (%rsi,%rax,4),%eax
mov    %eax,%ecx
and    $0xf,%ecx
sar    $0x4,%eax
test   $0x1,%dil
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @substitute(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = load i32, i32* %3
%8 = ashr i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i32, i32* %6, i64 %9
%11 = load i32, i32* %10
store i32 %11, i32* %5
%12 = load i32, i32* %3
%13 = and i32 %12, 1
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %2
%16 = load i32, i32* %5
%17 = and i32 %16, 15
br label %21
18: ; preds = %2
%19 = load i32, i32* %5
%20 = ashr i32 %19, 4
br label %21
21: ; preds = %18, %15
%22 = phi i32 [ %17, %15 ], [ %20, %18 ]
store i32 %22, i32* %5
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @substitute(i32 %0, i32* nocapture %1) {
%3 = ashr i32 %0, 1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %1, i64 %4
%6 = load i32, i32* %5
%7 = and i32 %0, 1
%8 = icmp eq i32 %7, 0
%9 = and i32 %6, 15
%10 = ashr i32 %6, 4
%11 = select i1 %8, i32 %10, i32 %9
ret i32 %11
}
int bar(void) { return -42; }


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

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

LLVM IR (-O0):
define i32 @bar() {
ret i32 -42
}

LLVM IR (-O2):
define i32 @bar() {
ret i32 -42
}
/* Variables and functions */
int /*<<< orphan*/ merge(int *, int, int, int);
void merge_sort(int *A, int p, int r) {
  if (p < r) {
    int q = (p + r) / 2;
    merge_sort(A, p, q);
    merge_sort(A, q + 1, r);
    merge(A, p, q, r);
  }
}


x86 assembly (clang, -O0):
<merge_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1182 <merge_sort+0x62>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <merge_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
call   1030 <merge@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<merge_sort>:
cmp    %edx,%esi
jge    1172 <merge_sort+0x52>
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r12d
mov    %rdi,%r15
lea    (%r14,%r12,1),%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    %ebx,%edx
call   1040 <merge_sort@plt>
lea    0x1(%rbx),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1040 <merge_sort@plt>
mov    %r15,%rdi
mov    %r12d,%esi
mov    %ebx,%edx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <merge@plt>
ret

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

LLVM IR (-O2):
define void @merge_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %6, label %5
5: ; preds = %3, %6
ret void
6: ; preds = %3
%7 = add nsw i32 %2, %1
%8 = sdiv i32 %7, 2
tail call void @merge_sort(i32* %0, i32 %1, i32 %8)
%9 = add nsw i32 %8, 1
tail call void @merge_sort(i32* %0, i32 %9, i32 %2)
%10 = tail call i32 @merge(i32* %0, i32 %1, i32 %8, i32 %2)
br label %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
scalar_t__ pthread_self();
void sig_int(int signo) {
  printf("catch sigint:%ld\n", (unsigned long)pthread_self());
}


x86 assembly (clang, -O0):
<sig_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <pthread_self@plt>
mov    %rax,%rsi
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [18 x i8] c"catch sigint:%ld\0A\00"
define void @sig_int(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i64 (...) @pthread_self()
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %3)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"catch sigint:%ld\0A\00"
define void @sig_int(i32 %0) {
%2 = tail call i64 (...) @pthread_self()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 %2)
ret void
}