xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ mock_push(int /*<<< orphan*/);
int /*<<< orphan*/ pack_glXWaitVideoSyncSGI(int /*<<< orphan*/ *, int, int,
                                            unsigned int *);
int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count) {
  { mock_push(pack_glXWaitVideoSyncSGI(NULL, divisor, remainder, count)); };
  return (int)0;
}


x86 assembly (clang, -O0):
<glXWaitVideoSyncSGI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edi
call   1030 <pack_glXWaitVideoSyncSGI@plt>
mov    %eax,%edi
call   1040 <mock_push@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glXWaitVideoSyncSGI>:
push   %rax
mov    %rdx,%rcx
mov    %esi,%edx
mov    %edi,%esi
xor    %edi,%edi
call   1030 <pack_glXWaitVideoSyncSGI@plt>
mov    %eax,%edi
call   1040 <mock_push@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @glXWaitVideoSyncSGI(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32 @pack_glXWaitVideoSyncSGI(i32* null, i32 %7, i32 %8, i32* %9)
%11 = call i32 @mock_push(i32 %10)
ret i32 0
}

LLVM IR (-O2):
define i32 @glXWaitVideoSyncSGI(i32 %0, i32 %1, i32* %2) {
%4 = tail call i32 @pack_glXWaitVideoSyncSGI(i32* null, i32 %0, i32 %1, i32* %2)
%5 = tail call i32 @mock_push(i32 %4)
ret i32 0
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int16_t c_ret_i16() { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @c_ret_i16() {
ret i32 -1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ *open_logfile();
int /*<<< orphan*/ plazaui_destroy();
void FATAL_MESSAGE(char *msg) {
  FILE *f;
  f = open_logfile();
  fprintf(f, "[E] %s\n", msg);
  fclose(f);
  plazaui_destroy();
  exit(1);
}


x86 assembly (clang, -O0):
<FATAL_MESSAGE>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <open_logfile@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe8a(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    $0x0,%al
call   1030 <plazaui_destroy@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<FATAL_MESSAGE>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <open_logfile@plt>
mov    %rax,%rbx
lea    0xe98(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
call   1030 <plazaui_destroy@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"[E] %s\0A\00"
define void @FATAL_MESSAGE(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = call i32* (...) @open_logfile()
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = load i8*, i8** %2
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32*, i32** %3
%9 = call i32 @fclose(i32* %8)
%10 = call i32 (...) @plazaui_destroy()
%11 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"[E] %s\0A\00"
define void @FATAL_MESSAGE(i8* %0) {
%2 = tail call i32* (...) @open_logfile()
%3 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @fclose(i32* %2)
%5 = tail call i32 (...) @plazaui_destroy()
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int ansi_emit(int c, FILE *fd) { return -1; }


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

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

LLVM IR (-O0):
define i32 @ansi_emit(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
ret i32 -1
}

LLVM IR (-O2):
define i32 @ansi_emit(i32 %0, i32* nocapture readnone %1) {
ret i32 -1
}
unsigned size(unsigned n) { return n; }


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

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

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

LLVM IR (-O2):
define i32 @size(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_shufflehi_epi16(int /*<<< orphan*/, int);
__m128i __mm_shufflehi_epi16(__m128i A, int const I) {
  return _mm_shufflehi_epi16(A, 1);
}


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

x86 assembly (clang, -O2):
<__mm_shufflehi_epi16>:
mov    $0x1,%esi
jmp    1030 <_mm_shufflehi_epi16@plt>

LLVM IR (-O0):
define i32 @__mm_shufflehi_epi16(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 = call i32 @_mm_shufflehi_epi16(i32 %5, i32 1)
ret i32 %6
}

LLVM IR (-O2):
define i32 @__mm_shufflehi_epi16(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_shufflehi_epi16(i32 %0, i32 1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void foo(unsigned char uc) {
  if (uc >= 5)
    return;
  switch (uc) {
  case 0:
  case 2:
  case 4:
    bar();
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x5,%eax
jl     1130 <foo+0x20>
jmp    116d <foo+0x5d>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     1166 <foo+0x56>
jmp    1144 <foo+0x34>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     1166 <foo+0x56>
jmp    1155 <foo+0x45>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
jne    116d <foo+0x5d>
jmp    1166 <foo+0x56>
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0x4,%dil
jbe    1117 <foo+0x7>
ret
ja     1116 <foo+0x6>
movzbl %dil,%eax
mov    $0x15,%ecx
bt     %eax,%ecx
jae    1116 <foo+0x6>
xor    %eax,%eax
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp sge i32 %4, 5
br i1 %5, label %6, label %7
6: ; preds = %1
br label %12
7: ; preds = %1
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
switch i32 %9, label %12 [
i32 0, label %10
i32 2, label %10
i32 4, label %10
]
10: ; preds = %7, %7, %7
%11 = call i32 (...) @bar()
br label %12
12: ; preds = %6, %10, %7
ret void
}

LLVM IR (-O2):
define void @foo(i8 zeroext %0) {
%2 = icmp ugt i8 %0, 4
br i1 %2, label %6, label %3
3: ; preds = %1
switch i8 %0, label %6 [
i8 0, label %4
i8 2, label %4
i8 4, label %4
]
4: ; preds = %3, %3, %3
%5 = tail call i32 (...) @bar()
br label %6
6: ; preds = %1, %4, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ l_push(int);
int /*<<< orphan*/ l_reset();
void l_return(int r) {
  l_reset();
  l_push(r);
}


x86 assembly (clang, -O0):
<l_return>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <l_reset@plt>
mov    -0x4(%rbp),%edi
call   1030 <l_push@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l_return>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <l_reset@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <l_push@plt>

LLVM IR (-O0):
define void @l_return(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @l_reset()
%4 = load i32, i32* %2
%5 = call i32 @l_push(i32 %4)
ret void
}

LLVM IR (-O2):
define void @l_return(i32 %0) {
%2 = tail call i32 (...) @l_reset()
%3 = tail call i32 @l_push(i32 %0)
ret void
}
int execute_exit_group() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_exit_group() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ initialize(int, char **);
int main(int argc, char **argv) { initialize(argc, argv); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <initialize@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @initialize(i32 %0, i8** %1)
ret i32 0
}
void gdk_screen_set_default_colormap() {}


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

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

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

LLVM IR (-O2):
define void @gdk_screen_set_default_colormap() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void close_standard_gen_files(FILE *h_fptr, FILE *cv_h_fptr, FILE *cv_c_fptr) {
  fclose(h_fptr);
  fclose(cv_h_fptr);
  fclose(cv_c_fptr);
}


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

x86 assembly (clang, -O2):
<close_standard_gen_files>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
call   1030 <fclose@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

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

LLVM IR (-O2):
define void @close_standard_gen_files(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = tail call i32 @fclose(i32* %0)
%5 = tail call i32 @fclose(i32* %1)
%6 = tail call i32 @fclose(i32* %2)
ret void
}
/* Variables and functions */
char *realpath(char const *, int /*<<< orphan*/ *);
char *fullpath(const char *name) { return realpath(name, NULL); }


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

x86 assembly (clang, -O2):
<fullpath>:
xor    %esi,%esi
jmp    1030 <realpath@plt>

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

LLVM IR (-O2):
define i8* @fullpath(i8* nocapture %0) {
%2 = tail call i8* @realpath(i8* %0, i32* null)
ret i8* %2
}
void outb_p(unsigned short port, unsigned char value) {
  asm volatile("outb %%al,(%%dx)"
               ";outb %%al,$0x80" ::"d"(port),
               "a"(value));
}


x86 assembly (clang, -O0):
<outb_p>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x3(%rbp),%al
out    %al,(%dx)
out    %al,$0x80
pop    %rbp
ret

x86 assembly (clang, -O2):
<outb_p>:
mov    %esi,%eax
mov    %edi,%edx
out    %al,(%dx)
out    %al,$0x80
ret

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

LLVM IR (-O2):
define void @outb_p(i16 zeroext %0, i8 zeroext %1) {
tail call void asm sideeffect "outb %al,(%dx);outb %al,$$0x80", "{dx},{ax},~{dirflag},~{fpsr},~{flags}"(i16 %0, i8 %1)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void ComparatorIntUnregister(uint32_t ui32Base, uint32_t ui32Comp) {
  ;
  ;
  (*((volatile unsigned long *)(ui32Base + 0x00000008))) &= ~(1 << ui32Comp);
  IntDisable(41 + ui32Comp);
  IntUnregister(41 + ui32Comp);
}


x86 assembly (clang, -O0):
<ComparatorIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
movslq %eax,%rdx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%rcx
and    %rdx,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%edi
add    $0x29,%edi
call   1030 <IntDisable@plt>
mov    -0x8(%rbp),%edi
add    $0x29,%edi
call   1040 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ComparatorIntUnregister>:
push   %rbx
mov    %esi,%ecx
mov    $0xfffffffe,%eax
rol    %cl,%eax
cltq
movslq %edi,%rdx
and    %rax,0x8(%rdx)
lea    0x29(%rcx),%ebx
mov    %ebx,%edi
call   1030 <IntDisable@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <IntUnregister@plt>

LLVM IR (-O0):
define void @ComparatorIntUnregister(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = xor i32 %6, -1
%8 = sext i32 %7 to i64
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 8
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, %8
store volatile i64 %14, i64* %12
%15 = load i32, i32* %4
%16 = add nsw i32 41, %15
%17 = call i32 @IntDisable(i32 %16)
%18 = load i32, i32* %4
%19 = add nsw i32 41, %18
%20 = call i32 @IntUnregister(i32 %19)
ret void
}

LLVM IR (-O2):
define void @ComparatorIntUnregister(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = sext i32 %4 to i64
%6 = add nsw i32 %0, 8
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, %5
store volatile i64 %10, i64* %8
%11 = add nsw i32 %1, 41
%12 = tail call i32 @IntDisable(i32 %11)
%13 = tail call i32 @IntUnregister(i32 %11)
ret void
}
/* Variables and functions */
scalar_t__ isdigit(int);
char tolower(int);
int ktapc_hexavalue(int c) {
  if (isdigit(c))
    return c - '0';
  else
    return tolower(c) - 'a' + 10;
}


x86 assembly (clang, -O0):
<ktapc_hexavalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     114b <ktapc_hexavalue+0x2b>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    115f <ktapc_hexavalue+0x3f>
mov    -0x8(%rbp),%edi
call   1040 <tolower@plt>
movsbl %al,%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ktapc_hexavalue>:
push   %rbx
mov    %edi,%ebx
call   1030 <isdigit@plt>
test   %rax,%rax
je     1132 <ktapc_hexavalue+0x12>
add    $0xffffffd0,%ebx
jmp    113f <ktapc_hexavalue+0x1f>
mov    %ebx,%edi
call   1040 <tolower@plt>
movsbl %al,%ebx
add    $0xffffffa9,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ktapc_hexavalue(i32 %0) {
%2 = tail call i64 @isdigit(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = add nsw i32 %0, -48
br label %10
6: ; preds = %1
%7 = tail call signext i8 @tolower(i32 %0)
%8 = sext i8 %7 to i32
%9 = add nsw i32 %8, -87
br label %10
10: ; preds = %6, %4
%11 = phi i32 [ %5, %4 ], [ %9, %6 ]
ret i32 %11
}
int foo(_Bool a, _Bool b) { return (a ^ !a) | (!b ^ b); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
and    $0x1,%cl
mov    %cl,-0x1(%rbp)
and    $0x1,%al
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    -0x1(%rbp),%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
xor    %ecx,%eax
mov    -0x2(%rbp),%cl
xor    $0xff,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    -0x2(%rbp),%dl
and    $0x1,%dl
movzbl %dl,%edx
xor    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(i1 zeroext %0, i1 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = zext i1 %0 to i8
store i8 %5, i8* %3
%6 = zext i1 %1 to i8
store i8 %6, i8* %4
%7 = load i8, i8* %3
%8 = trunc i8 %7 to i1
%9 = zext i1 %8 to i32
%10 = load i8, i8* %3
%11 = trunc i8 %10 to i1
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
%14 = xor i32 %9, %13
%15 = load i8, i8* %4
%16 = trunc i8 %15 to i1
%17 = xor i1 %16, true
%18 = zext i1 %17 to i32
%19 = load i8, i8* %4
%20 = trunc i8 %19 to i1
%21 = zext i1 %20 to i32
%22 = xor i32 %18, %21
%23 = or i32 %14, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @foo(i1 zeroext %0, i1 zeroext %1) {
ret i32 1
}
/* Variables and functions */
char *insert_str(char *, char *, int);
char *insert_string(char *source_destination, char *substring, int pos) {
  return insert_str(substring, source_destination, pos);
}


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

x86 assembly (clang, -O2):
<insert_string>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <insert_str@plt>

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

LLVM IR (-O2):
define i8* @insert_string(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @insert_str(i8* %1, i8* %0, i32 %2)
ret i8* %4
}
void SSSNROMIRQHook(void) {}


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

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

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

LLVM IR (-O2):
define void @SSSNROMIRQHook() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
char print1() {
  char c = 0;
  printf("\n\t1. Add Node.");
  printf("\n\t*. Press any other key to exit.\n->");
  scanf("%c", &c);
  getchar();
  return c;
}


x86 assembly (clang, -O0):
<print1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print1>:
push   %rax
movb   $0x0,0x7(%rsp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x7(%rsp),%al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0A\091. Add Node.\00"
@.str.1 = [37 x i8] c"\0A\09*. Press any other key to exit.\0A->\00"
@.str.2 = [3 x i8] c"%c\00"
define signext i8 @print1() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%5 = call i32 (...) @getchar()
%6 = load i8, i8* %1
ret i8 %6
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0A\091. Add Node.\00"
@.str.1 = [37 x i8] c"\0A\09*. Press any other key to exit.\0A->\00"
@.str.2 = [3 x i8] c"%c\00"
define signext i8 @print1() {
%1 = alloca i8
store i8 0, i8* %1
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%5 = call i32 (...) @getchar()
%6 = load i8, i8* %1
ret i8 %6
}
/* Type definitions */
struct Cyc_List_List {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Cyc_Binding_resolve_all(struct Cyc_List_List *);
int Cyc_do_binding(int ignore, struct Cyc_List_List *tds) {
  Cyc_Binding_resolve_all(tds);
  return 1;
}


x86 assembly (clang, -O0):
<Cyc_do_binding>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <Cyc_Binding_resolve_all@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_do_binding>:
push   %rax
mov    %rsi,%rdi
call   1030 <Cyc_Binding_resolve_all@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.Cyc_List_List = type { i32 }
define i32 @Cyc_do_binding(i32 %0, %struct.Cyc_List_List* %1) {
%3 = alloca i32
%4 = alloca %struct.Cyc_List_List*
store i32 %0, i32* %3
store %struct.Cyc_List_List* %1, %struct.Cyc_List_List** %4
%5 = load %struct.Cyc_List_List*, %struct.Cyc_List_List** %4
%6 = call i32 @Cyc_Binding_resolve_all(%struct.Cyc_List_List* %5)
ret i32 1
}

LLVM IR (-O2):
%struct.Cyc_List_List = type { i32 }
define i32 @Cyc_do_binding(i32 %0, %struct.Cyc_List_List* %1) {
%3 = tail call i32 @Cyc_Binding_resolve_all(%struct.Cyc_List_List* %1)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ create_default_settings_file();
int is_loaded_ok();
int /*<<< orphan*/ read_settings_file();
int /*<<< orphan*/ settings_file_exists();
int load_settings() {
  if (!settings_file_exists()) {
    create_default_settings_file();
  }
  read_settings_file();
  return is_loaded_ok();
}


x86 assembly (clang, -O0):
<load_settings>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <settings_file_exists@plt>
cmp    $0x0,%eax
jne    115b <load_settings+0x1b>
mov    $0x0,%al
call   1030 <create_default_settings_file@plt>
mov    $0x0,%al
call   1040 <read_settings_file@plt>
mov    $0x0,%al
call   1060 <is_loaded_ok@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<load_settings>:
push   %rax
xor    %eax,%eax
call   1050 <settings_file_exists@plt>
test   %eax,%eax
jne    1153 <load_settings+0x13>
xor    %eax,%eax
call   1030 <create_default_settings_file@plt>
xor    %eax,%eax
call   1040 <read_settings_file@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <is_loaded_ok@plt>

LLVM IR (-O0):
define i32 @load_settings() {
%1 = call i32 (...) @settings_file_exists()
%2 = icmp ne i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = call i32 (...) @create_default_settings_file()
br label %5
5: ; preds = %3, %0
%6 = call i32 (...) @read_settings_file()
%7 = call i32 (...) @is_loaded_ok()
ret i32 %7
}

LLVM IR (-O2):
define i32 @load_settings() {
%1 = tail call i32 (...) @settings_file_exists()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @create_default_settings_file()
br label %5
5: ; preds = %3, %0
%6 = tail call i32 (...) @read_settings_file()
%7 = tail call i32 (...) @is_loaded_ok()
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void main() {
  int i;
  for (i = 0; i < 255; i++) {
    printf("%c -> %d\n", i, i + 1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jge    114f <main+0x3f>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
add    $0x1,%edx
lea    0xec4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <main+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %esi,%esi
lea    0xee4(%rip),%rbx
nopl   0x0(%rax)
lea    0x1(%rsi),%ebp
mov    %rbx,%rdi
mov    %ebp,%edx
call   1030 <printf@plt>
mov    %ebp,%esi
cmp    $0xff,%ebp
jne    1120 <main+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"%c -> %d\0A\00"
define void @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %3, %1 ]
%3 = add nuw nsw i32 %2, 1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = icmp eq i32 %3, 255
br i1 %5, label %6, label %1
6: ; preds = %1
ret void
}
/* Variables and functions */
int strlen(int /*<<< orphan*/);
int /*<<< orphan*/ va(char *, int);
int GetValueLength(int amount) {
  int val_len = strlen(va("%d", amount)) * 8;
  int coin_len = 32;
  return val_len + 15 + coin_len;
}


x86 assembly (clang, -O0):
<GetValueLength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1040 <va@plt>
mov    %eax,%edi
call   1030 <strlen@plt>
shl    $0x3,%eax
mov    %eax,-0x8(%rbp)
movl   $0x20,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xf,%eax
add    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetValueLength>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1040 <va@plt>
mov    %eax,%edi
call   1030 <strlen@plt>
lea    0x2f(,%rax,8),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @GetValueLength(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @va(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 @strlen(i32 %6)
%8 = mul nsw i32 %7, 8
store i32 %8, i32* %3
store i32 32, i32* %4
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 15
%11 = load i32, i32* %4
%12 = add nsw i32 %10, %11
ret i32 %12
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @GetValueLength(i32 %0) {
%2 = tail call i32 @va(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @strlen(i32 %2)
%4 = shl nsw i32 %3, 3
%5 = add nsw i32 %4, 47
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ __util_oom(char const *, char const *, int, size_t);
void *realloc(void *, size_t);
void *__util_realloc(const char *func, const char *file, int line, void *ptr,
                     size_t size) {
  void *buf;
  buf = realloc(ptr, size);
  if (buf == NULL)
    __util_oom(func, file, line, size);
  return buf;
}


x86 assembly (clang, -O0):
<__util_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    116b <__util_realloc+0x4b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1030 <__util_oom@plt>
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__util_realloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8,%rbx
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rcx,%rdi
mov    %r8,%rsi
call   1040 <realloc@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1158 <__util_realloc+0x38>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
mov    %rbx,%rcx
call   1030 <__util_oom@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @__util_realloc(i8* %0, i8* %1, i32 %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%12 = load i8*, i8** %9
%13 = load i64, i64* %10
%14 = call i8* @realloc(i8* %12, i64 %13)
store i8* %14, i8** %11
%15 = load i8*, i8** %11
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %23
17: ; preds = %5
%18 = load i8*, i8** %6
%19 = load i8*, i8** %7
%20 = load i32, i32* %8
%21 = load i64, i64* %10
%22 = call i32 @__util_oom(i8* %18, i8* %19, i32 %20, i64 %21)
br label %23
23: ; preds = %17, %5
%24 = load i8*, i8** %11
ret i8* %24
}

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


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

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

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

LLVM IR (-O2):
define void @foo_function() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_memblockq_apply_attr() {
  printf("NOT IMPLEMENTED:"
         "pa_memblockq_apply_attr"
         "\n");
}


x86 assembly (clang, -O0):
<pa_memblockq_apply_attr>:
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_memblockq_apply_attr>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [40 x i8] c"NOT IMPLEMENTED:pa_memblockq_apply_attr\00"
define i32 @pa_memblockq_apply_attr() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void caller_1_2_1_2_1_1_1() {}


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

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

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

LLVM IR (-O2):
define void @caller_1_2_1_2_1_1_1() {
ret void
}
void f8() {
  int a[10];
  a[sizeof(a) / sizeof(int) - 1] = 1;
}


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

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

LLVM IR (-O0):
define void @f8() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
store i32 1, i32* %2
ret void
}

LLVM IR (-O2):
define void @f8() {
ret void
}
void foo$$2(struct _Data$$3 *this$1) { printf("Y\n"); }


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

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

LLVM IR (-O0):
%"struct._Data$$3" = type opaque
@.str = [3 x i8] c"Y\0A\00"
define void @"foo$$2"(%"struct._Data$$3"* %0) {
%2 = alloca %"struct._Data$$3"*
store %"struct._Data$$3"* %0, %"struct._Data$$3"** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%"struct._Data$$3" = type opaque
@str = [2 x i8] c"Y\00"
define void @"foo$$2"(%"struct._Data$$3"* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}
const char *test_array() {
  static const char *outnames[] = {"coef",   "u",    "imat", "loglik", "means",
                                   "sctest", "flag", "iter", ""};
  return outnames[3];
}


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

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

LLVM IR (-O0):
@test_array.outnames = internal global [9 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i32 0, i32 0)]
@.str = [5 x i8] c"coef\00"
@.str.1 = [2 x i8] c"u\00"
@.str.2 = [5 x i8] c"imat\00"
@.str.3 = [7 x i8] c"loglik\00"
@.str.4 = [6 x i8] c"means\00"
@.str.5 = [7 x i8] c"sctest\00"
@.str.6 = [5 x i8] c"flag\00"
@.str.7 = [5 x i8] c"iter\00"
@.str.8 = [1 x i8] zeroinitializer
define i8* @test_array() {
%1 = load i8*, i8** getelementptr inbounds ([9 x i8*], [9 x i8*]* @test_array.outnames, i64 0, i64 3)
ret i8* %1
}

LLVM IR (-O2):
@.str.3 = [7 x i8] c"loglik\00"
define i8* @test_array() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ LCD_command(int);
void LCD_mode(int mode) { LCD_command(0x80 + mode); }


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

x86 assembly (clang, -O2):
<LCD_mode>:
sub    $0xffffff80,%edi
jmp    1030 <LCD_command@plt>

LLVM IR (-O0):
define void @LCD_mode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 128, %3
%5 = call i32 @LCD_command(i32 %4)
ret void
}

LLVM IR (-O2):
define void @LCD_mode(i32 %0) {
%2 = add nsw i32 %0, 128
%3 = tail call i32 @LCD_command(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ display_line();
int /*<<< orphan*/ printf(char *);
int main(void) {
  display_line();
  printf("\n Teach Yourself C In One Hour a Day!\n");
  display_line();
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <display_line@plt>
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <display_line@plt>
lea    0xed5(%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   1050 <display_line@plt>
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <display_line@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [39 x i8] c"\0A Teach Yourself C In One Hour a Day!\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @display_line()
%3 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @display_line()
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [38 x i8] c"\0A Teach Yourself C In One Hour a Day!\00"
define i32 @main() {
%1 = tail call i32 (...) @display_line()
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @display_line()
%4 = tail call i32 @putchar(i32 10)
ret i32 0
}
__attribute__((always_)) void outsl(int port, const void *addr,
                                    unsigned long count) {
  asm volatile("rep; outs"
               "l"
               : "+S"(addr), "+c"(count)
               : "d"(port));
}


x86 assembly (clang, -O0):
<outsl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%edx
rep outsl %ds:(%rsi),(%dx)
mov    %rsi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsl>:
mov    %rdx,%rcx
mov    %edi,%edx
rep outsl %ds:(%rsi),(%dx)
ret

LLVM IR (-O0):
define void @outsl(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %5
%8 = load i64, i64* %6
%9 = load i32, i32* %4
%10 = call { i8*, i64 } asm sideeffect "rep; outsl", "={si},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %9, i8* %7, i64 %8)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @outsl(i32 %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "rep; outsl", "={si},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* %1, i64 %2)
ret void
}
int modbus_ext_unregister_notifier(struct notifier_block *nb) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.notifier_block = type opaque
define i32 @modbus_ext_unregister_notifier(%struct.notifier_block* nocapture readnone %0) {
ret i32 0
}
void serial_purge_rx() { return; }


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

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

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

LLVM IR (-O2):
define void @serial_purge_rx() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int findMidPoint(int min, int max) {
  if (min <= max) {
    int x = (min + (max - 1)) / 2;
    return x;
  } else {
    printf("naah");
    return -1;
  }
}


x86 assembly (clang, -O0):
<findMidPoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     114b <findMidPoint+0x3b>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <findMidPoint+0x4e>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findMidPoint>:
cmp    %esi,%edi
jle    112b <findMidPoint+0x1b>
push   %rax
lea    0xee4(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
ret
lea    (%rdi,%rsi,1),%eax
lea    (%rdi,%rsi,1),%ecx
add    $0xffffffff,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
add    $0xffffffff,%eax
sar    %eax
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"naah\00"
define i32 @findMidPoint(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = add i32 %0, -1
%6 = add i32 %5, %1
%7 = sdiv i32 %6, 2
br label %10
8: ; preds = %2
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %4
%11 = phi i32 [ %7, %4 ], [ -1, %8 ]
ret i32 %11
}
void example2() {
  int array1[10000000];
  int array2[10000000];
  int *ptr;
  if (rand()) {
    ptr = &array1;
    *ptr = 5;
    assert(*ptr == 5);
  } else {
    ptr = &array2;
    *ptr = 5;
    assert(*ptr == 5);
  }
  *ptr = 6;
  assert(*ptr == 6);
}


x86 assembly (clang, -O0):
<example2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4c4b410,%rsp
mov    $0x0,%al
call   1040 <rand@plt>
cmp    $0x0,%eax
je     1174 <example2+0x54>
lea    -0x2625a00(%rbp),%rax
mov    %rax,-0x4c4b408(%rbp)
mov    -0x4c4b408(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x4c4b408(%rbp),%rax
cmpl   $0x5,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
jmp    11a8 <example2+0x88>
lea    -0x4c4b400(%rbp),%rax
mov    %rax,-0x4c4b408(%rbp)
mov    -0x4c4b408(%rbp),%rax
movl   $0x5,(%rax)
mov    -0x4c4b408(%rbp),%rax
cmpl   $0x5,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x4c4b408(%rbp),%rax
movl   $0x6,(%rax)
mov    -0x4c4b408(%rbp),%rax
cmpl   $0x6,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1030 <assert@plt>
add    $0x4c4b410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<example2>:
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebx
mov    $0x1,%edi
xor    %eax,%eax
call   1030 <assert@plt>
test   %ebx,%ebx
mov    %rsp,%rax
lea    0x10(%rsp),%rcx
cmove  %rax,%rcx
movl   $0x6,(%rcx)
mov    $0x1,%edi
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1030 <assert@plt>

LLVM IR (-O0):
define void @example2() {
%1 = alloca [10000000 x i32]
%2 = alloca [10000000 x i32]
%3 = alloca i32*
%4 = call i32 (...) @rand()
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %0
%7 = bitcast [10000000 x i32]* %1 to i32*
store i32* %7, i32** %3
%8 = load i32*, i32** %3
store i32 5, i32* %8
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 5
%12 = zext i1 %11 to i32
%13 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %12)
br label %22
14: ; preds = %0
%15 = bitcast [10000000 x i32]* %2 to i32*
store i32* %15, i32** %3
%16 = load i32*, i32** %3
store i32 5, i32* %16
%17 = load i32*, i32** %3
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 5
%20 = zext i1 %19 to i32
%21 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %20)
br label %22
22: ; preds = %14, %6
%23 = load i32*, i32** %3
store i32 6, i32* %23
%24 = load i32*, i32** %3
%25 = load i32, i32* %24
%26 = icmp eq i32 %25, 6
%27 = zext i1 %26 to i32
%28 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %27)
ret void
}

LLVM IR (-O2):
define void @example2() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (...) @rand()
%6 = icmp eq i32 %5, 0
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%8 = select i1 %6, i32* %2, i32* %1
store i32 6, i32* %8
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_66pushb_neg();
int /*<<< orphan*/ do_66pushb_pos();
int /*<<< orphan*/ do_pushb_neg();
int /*<<< orphan*/ do_pushb_pos();
int /*<<< orphan*/ do_pushq_neg();
int /*<<< orphan*/ do_pushq_pos();
int /*<<< orphan*/ do_pushw_neg();
int /*<<< orphan*/ do_pushw_pos();
int main(void) {
  do_pushb_pos();
  do_pushb_neg();
  do_pushw_pos();
  do_pushw_neg();
  do_pushq_pos();
  do_pushq_neg();
  do_66pushb_pos();
  do_66pushb_neg();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <do_pushb_pos@plt>
mov    $0x0,%al
call   1030 <do_pushb_neg@plt>
mov    $0x0,%al
call   1070 <do_pushw_pos@plt>
mov    $0x0,%al
call   1060 <do_pushw_neg@plt>
mov    $0x0,%al
call   1080 <do_pushq_pos@plt>
mov    $0x0,%al
call   1040 <do_pushq_neg@plt>
mov    $0x0,%al
call   10a0 <do_66pushb_pos@plt>
mov    $0x0,%al
call   1090 <do_66pushb_neg@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <do_pushb_pos@plt>
xor    %eax,%eax
call   1030 <do_pushb_neg@plt>
xor    %eax,%eax
call   1070 <do_pushw_pos@plt>
xor    %eax,%eax
call   1060 <do_pushw_neg@plt>
xor    %eax,%eax
call   1080 <do_pushq_pos@plt>
xor    %eax,%eax
call   1040 <do_pushq_neg@plt>
xor    %eax,%eax
call   10a0 <do_66pushb_pos@plt>
xor    %eax,%eax
call   1090 <do_66pushb_neg@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @do_pushb_pos()
%3 = call i32 (...) @do_pushb_neg()
%4 = call i32 (...) @do_pushw_pos()
%5 = call i32 (...) @do_pushw_neg()
%6 = call i32 (...) @do_pushq_pos()
%7 = call i32 (...) @do_pushq_neg()
%8 = call i32 (...) @do_66pushb_pos()
%9 = call i32 (...) @do_66pushb_neg()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @do_pushb_pos()
%2 = tail call i32 (...) @do_pushb_neg()
%3 = tail call i32 (...) @do_pushw_pos()
%4 = tail call i32 (...) @do_pushw_neg()
%5 = tail call i32 (...) @do_pushq_pos()
%6 = tail call i32 (...) @do_pushq_neg()
%7 = tail call i32 (...) @do_66pushb_pos()
%8 = tail call i32 (...) @do_66pushb_neg()
ret i32 0
}