xunge/DecIR huggingface dataset:
float warp_sinf(float x) {
  const float A7 = -4.3330336920917034149169921875e-3f;
  const float A5 = 7.9434238374233245849609375e-2f;
  const float A3 = -0.645892798900604248046875f;
  const float A1 = 1.5707910060882568359375f;
  float x2 = x * x;
  float x4 = x2 * x2;
  return x * ((A7 * x2 + A5) * x4 + (A3 * x2 + A1));
}


x86 assembly (clang, -O0):
<warp_sinf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xeee(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xed5(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
mulss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  0xe9b(%rip),%xmm2
mulss  %xmm2,%xmm1
movss  0xe93(%rip),%xmm2
addss  %xmm2,%xmm1
movss  -0x1c(%rbp),%xmm3
movss  -0x18(%rbp),%xmm2
movss  0xe71(%rip),%xmm4
mulss  %xmm4,%xmm2
movss  0xe69(%rip),%xmm4
addss  %xmm4,%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<warp_sinf>:
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
movaps %xmm1,%xmm2
movss  0xeee(%rip),%xmm3
mulss  %xmm1,%xmm3
addss  0xee6(%rip),%xmm3
mulss  %xmm1,%xmm2
mulss  %xmm2,%xmm3
mulss  0xeda(%rip),%xmm1
addss  0xed6(%rip),%xmm1
addss  %xmm3,%xmm1
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @warp_sinf(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %2
store float 0xBF71BF83E0000000, float* %3
store float 0x3FB455CD60000000, float* %4
store float 0xBFE4AB2760000000, float* %5
store float 0x3FF921F5C0000000, float* %6
%9 = load float, float* %2
%10 = load float, float* %2
%11 = fmul float %9, %10
store float %11, float* %7
%12 = load float, float* %7
%13 = load float, float* %7
%14 = fmul float %12, %13
store float %14, float* %8
%15 = load float, float* %2
%16 = load float, float* %7
%17 = call float @llvm.fmuladd.f32(float 0xBF71BF83E0000000, float %16, float 0x3FB455CD60000000)
%18 = load float, float* %8
%19 = load float, float* %7
%20 = call float @llvm.fmuladd.f32(float 0xBFE4AB2760000000, float %19, float 0x3FF921F5C0000000)
%21 = call float @llvm.fmuladd.f32(float %17, float %18, float %20)
%22 = fmul float %15, %21
ret float %22
}

LLVM IR (-O2):
define float @warp_sinf(float %0) {
%2 = fmul float %0, %0
%3 = fmul float %2, %2
%4 = tail call float @llvm.fmuladd.f32(float %2, float 0xBF71BF83E0000000, float 0x3FB455CD60000000)
%5 = tail call float @llvm.fmuladd.f32(float %2, float 0xBFE4AB2760000000, float 0x3FF921F5C0000000)
%6 = tail call float @llvm.fmuladd.f32(float %4, float %3, float %5)
%7 = fmul float %6, %0
ret float %7
}
/* Variables and functions */
double log10(int);
int round(double);
int display_code(int input) {
  double result;
  if (input > 0) {
    result = (log10(input) / log10(2));
  } else {
    result = 0;
  }
  return round(result);
}


x86 assembly (clang, -O0):
<display_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1162 <display_code+0x42>
mov    -0x4(%rbp),%edi
call   1040 <log10@plt>
movsd  %xmm0,-0x18(%rbp)
mov    $0x2,%edi
call   1040 <log10@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    116a <display_code+0x4a>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <round@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_code>:
test   %edi,%edi
jle    114f <display_code+0x2f>
push   %rax
call   1040 <log10@plt>
movsd  %xmm0,(%rsp)
mov    $0x2,%edi
call   1040 <log10@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
jmp    1030 <round@plt>
xorps  %xmm0,%xmm0
jmp    1030 <round@plt>

LLVM IR (-O0):
define i32 @display_code(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call double @log10(i32 %7)
%9 = call double @log10(i32 2)
%10 = fdiv double %8, %9
store double %10, double* %3
br label %12
11: ; preds = %1
store double 0.000000e+00, double* %3
br label %12
12: ; preds = %11, %6
%13 = load double, double* %3
%14 = call i32 @round(double %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @display_code(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = tail call double @log10(i32 %0)
%5 = tail call double @log10(i32 2)
%6 = fdiv double %4, %5
br label %7
7: ; preds = %1, %3
%8 = phi double [ %6, %3 ], [ 0.000000e+00, %1 ]
%9 = tail call i32 @round(double %8)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ UART6_Write(char);
void PrintHandler(char c) { UART6_Write(c); }


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

x86 assembly (clang, -O2):
<PrintHandler>:
jmp    1030 <UART6_Write@plt>

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

LLVM IR (-O2):
define void @PrintHandler(i8 signext %0) {
%2 = tail call i32 @UART6_Write(i8 signext %0)
ret void
}
void UARTSynModeSet(unsigned long ulBase, unsigned long ulConfig) {
  ;
  (*((volatile unsigned long *)(ulBase + 0x00000010))) &= ~0x00004000;
  (*((volatile unsigned long *)(ulBase + 0x00000014))) &= ~0x00000008;
  (*((volatile unsigned long *)(ulBase + 0x00000014))) &=
      ~(0x00000002 | 0x00000020);
  (*((volatile unsigned long *)(ulBase + 0x00000010))) |=
      (0x00000800 | ulConfig);
}


x86 assembly (clang, -O0):
<UARTSynModeSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rcx
and    $0xffffffffffffbfff,%rcx
mov    %rcx,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%rcx
and    $0xfffffffffffffff7,%rcx
mov    %rcx,0x14(%rax)
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%rcx
and    $0xffffffffffffffdd,%rcx
mov    %rcx,0x14(%rax)
mov    -0x10(%rbp),%rdx
or     $0x800,%rdx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0x10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTSynModeSet>:
andq   $0xffffffffffffbfff,0x10(%rdi)
ff
andq   $0xfffffffffffffff7,0x14(%rdi)
andq   $0xffffffffffffffdd,0x14(%rdi)
or     0x10(%rdi),%rsi
or     $0x800,%rsi
mov    %rsi,0x10(%rdi)
ret

LLVM IR (-O0):
define void @UARTSynModeSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = add i64 %5, 16
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -16385
store volatile i64 %9, i64* %7
%10 = load i64, i64* %3
%11 = add i64 %10, 20
%12 = inttoptr i64 %11 to i64*
%13 = load volatile i64, i64* %12
%14 = and i64 %13, -9
store volatile i64 %14, i64* %12
%15 = load i64, i64* %3
%16 = add i64 %15, 20
%17 = inttoptr i64 %16 to i64*
%18 = load volatile i64, i64* %17
%19 = and i64 %18, -35
store volatile i64 %19, i64* %17
%20 = load i64, i64* %4
%21 = or i64 2048, %20
%22 = load i64, i64* %3
%23 = add i64 %22, 16
%24 = inttoptr i64 %23 to i64*
%25 = load volatile i64, i64* %24
%26 = or i64 %25, %21
store volatile i64 %26, i64* %24
ret void
}

LLVM IR (-O2):
define void @UARTSynModeSet(i64 %0, i64 %1) {
%3 = add i64 %0, 16
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, -16385
store volatile i64 %6, i64* %4
%7 = add i64 %0, 20
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = and i64 %9, -9
store volatile i64 %10, i64* %8
%11 = load volatile i64, i64* %8
%12 = and i64 %11, -35
store volatile i64 %12, i64* %8
%13 = load volatile i64, i64* %4
%14 = or i64 %13, %1
%15 = or i64 %14, 2048
store volatile i64 %15, i64* %4
ret void
}
int char_cmp(char c1, char c2) { return c1 - c2; }


x86 assembly (clang, -O0):
<char_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
sub    %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @char_cmp(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = sub nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @char_cmp(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
%4 = sext i8 %1 to i32
%5 = sub nsw i32 %3, %4
ret i32 %5
}
/* Type definitions */
typedef void _pin;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void pio_configure_it(const struct _pin *pin) {
  {};
  assert(pin != ((void *)0));
}


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

x86 assembly (clang, -O2):
<pio_configure_it>:
xor    %eax,%eax
test   %rdi,%rdi
setne  %al
mov    %eax,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
%struct._pin = type opaque
define void @pio_configure_it(%struct._pin* %0) {
%2 = alloca %struct._pin*
store %struct._pin* %0, %struct._pin** %2
%3 = load %struct._pin*, %struct._pin** %2
%4 = icmp ne %struct._pin* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
ret void
}

LLVM IR (-O2):
%struct._pin = type opaque
define void @pio_configure_it(%struct._pin* readnone %0) {
%2 = icmp ne %struct._pin* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(int /*<<< orphan*/, int /*<<< orphan*/ *);
void write_bitmap_row_padding(FILE *fp) {
  uint8_t rem = ((((24 * (21600 / (2 / 2))) + 31) / 32) * 4) -
                ((24 * (21600 / (2 / 2))) / 8);
  for (int j = 0; j < rem; j++) {
    fputc(0, fp);
  }
}


x86 assembly (clang, -O0):
<write_bitmap_row_padding>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    114f <write_bitmap_row_padding+0x3f>
mov    -0x8(%rbp),%rsi
xor    %edi,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112a <write_bitmap_row_padding+0x1a>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @write_bitmap_row_padding(i32* nocapture %0) {
ret void
}
/* Variables and functions */
void *__ioremap(unsigned long, unsigned long, int /*<<< orphan*/);
__attribute__((always_)) void *ioremap(unsigned long offset,
                                       unsigned long size) {
  return __ioremap(offset, size, 0);
}


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

x86 assembly (clang, -O2):
<ioremap>:
xor    %edx,%edx
jmp    1030 <__ioremap@plt>

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

LLVM IR (-O2):
define i8* @ioremap(i64 %0, i64 %1) {
%3 = tail call i8* @__ioremap(i64 %0, i64 %1, i32 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ log_msg(int /*<<< orphan*/, char *, int /*<<< orphan*/);
void *realloc(void *, size_t);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void *xrealloc(void *ptr, size_t size) {
  ptr = realloc(ptr, size);
  if (!ptr) {
    log_msg(LOG_ERR, "realloc failed: %s", strerror(errno));
    exit(1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11a1 <xrealloc+0x61>
mov    0x2e5d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%edx
lea    0xe6e(%rip),%rsi
call   1030 <log_msg@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     114d <xrealloc+0xd>
pop    %rbx
ret
mov    0x2e7c(%rip),%rax
mov    (%rax),%ebx
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
lea    0xe95(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
call   1030 <log_msg@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@LOG_ERR = global i32 0
@.str = [19 x i8] c"realloc failed: %s\00"
@errno = global i32 0
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i8* @realloc(i8* %5, i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %16, label %10
10: ; preds = %2
%11 = load i32, i32* @LOG_ERR
%12 = load i32, i32* @errno
%13 = call i32 @strerror(i32 %12)
%14 = call i32 @log_msg(i32 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@LOG_ERR = global i32 0
@.str = [19 x i8] c"realloc failed: %s\00"
@errno = global i32 0
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* @LOG_ERR
%7 = load i32, i32* @errno
%8 = tail call i32 @strerror(i32 %7)
%9 = tail call i32 @log_msg(i32 %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
ret i8* %3
}
/* Type definitions */
struct peer_s {
  int dummy;
};
struct in_addr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ inet_aton(char const *, struct in_addr *);
struct in_addr *malloc(int);
struct peer_s *router_searchdst(struct in_addr *);
struct peer_s *searchdst(const char *ip) {
  struct in_addr *dst = malloc(sizeof(struct in_addr));
  inet_aton(ip, dst);
  return router_searchdst(dst);
}


x86 assembly (clang, -O0):
<searchdst>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <inet_aton@plt>
mov    -0x10(%rbp),%rdi
call   1050 <router_searchdst@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchdst>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <inet_aton@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <router_searchdst@plt>

LLVM IR (-O0):
%struct.peer_s = type { i32 }
%struct.in_addr = type { i32 }
define %struct.peer_s* @searchdst(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.in_addr*
store i8* %0, i8** %2
%4 = call %struct.in_addr* @malloc(i32 4)
store %struct.in_addr* %4, %struct.in_addr** %3
%5 = load i8*, i8** %2
%6 = load %struct.in_addr*, %struct.in_addr** %3
%7 = call i32 @inet_aton(i8* %5, %struct.in_addr* %6)
%8 = load %struct.in_addr*, %struct.in_addr** %3
%9 = call %struct.peer_s* @router_searchdst(%struct.in_addr* %8)
ret %struct.peer_s* %9
}

LLVM IR (-O2):
%struct.peer_s = type { i32 }
%struct.in_addr = type { i32 }
define %struct.peer_s* @searchdst(i8* %0) {
%2 = tail call %struct.in_addr* @malloc(i32 4)
%3 = tail call i32 @inet_aton(i8* %0, %struct.in_addr* %2)
%4 = tail call %struct.peer_s* @router_searchdst(%struct.in_addr* %2)
ret %struct.peer_s* %4
}
/* Variables and functions */
int lastWordLenght(char *);
int /*<<< orphan*/ printf(char *, int);
char *testUnit() {
  int length, i, j;
  char *str;
  str = "Hello World";
  length = lastWordLenght(str);
  printf("El tamaño de la ultima palabra es %d\n", length);
  return 0;
}


x86 assembly (clang, -O0):
<testUnit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <lastWordLenght@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testUnit>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <lastWordLenght@plt>
lea    0xed8(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hello World\00"
@.str.1 = [39 x i8] c"El tama\C3\B1o de la ultima palabra es %d\0A\00"
define i8* @testUnit() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @lastWordLenght(i8* %5)
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i8* null
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
@.str.1 = [39 x i8] c"El tama\C3\B1o de la ultima palabra es %d\0A\00"
define noalias i8* @testUnit() {
%1 = tail call i32 @lastWordLenght(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i32 %1)
ret i8* null
}
/* Variables and functions */
int mkdir(char const *, int);
int platform_mkdir(const char *path, int mode) { return mkdir(path, mode); }


x86 assembly (clang, -O0):
<platform_mkdir>:
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 <mkdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<platform_mkdir>:
jmp    1030 <mkdir@plt>

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

LLVM IR (-O2):
define i32 @platform_mkdir(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @mkdir(i8* %0, i32 %1)
ret i32 %3
}
unsigned int f89(unsigned int x, int y) {
  return (x << (8 * sizeof(unsigned int) - y)) + (x >> y);
}


x86 assembly (clang, -O0):
<f89>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
movslq -0x8(%rbp),%rdx
mov    $0x20,%ecx
sub    %rdx,%rcx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
shr    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f89>:
mov    %esi,%ecx
neg    %cl
mov    %edi,%eax
shl    %cl,%eax
mov    %esi,%ecx
shr    %cl,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @f89(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 = sext i32 %6 to i64
%8 = sub i64 32, %7
%9 = trunc i64 %8 to i32
%10 = shl i32 %5, %9
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = lshr i32 %11, %12
%14 = add i32 %10, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @f89(i32 %0, i32 %1) {
%3 = sub i32 32, %1
%4 = shl i32 %0, %3
%5 = lshr i32 %0, %1
%6 = add i32 %4, %5
ret i32 %6
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ chr2setBank0(int);
void s4setParams8000(uint16_t addr, uint8_t val) {
  (void)addr;
  chr2setBank0(val << 11);
}


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

x86 assembly (clang, -O2):
mov    %esi,%edi
shl    $0xb,%edi
jmp    1030 <chr2setBank0@plt>

LLVM IR (-O0):
define void @s4setParams8000(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 = shl i32 %6, 11
%8 = call i32 @chr2setBank0(i32 %7)
ret void
}

LLVM IR (-O2):
define void @s4setParams8000(i32 %0, i32 %1) {
%3 = shl i32 %1, 11
%4 = tail call i32 @chr2setBank0(i32 %3)
ret void
}
/* Type definitions */
struct bufferevent {
  int dummy;
};

/* Variables and functions */
int bufferevent_write(struct bufferevent *bufev, const void *data,
                      size_t size) {
  (void)bufev;
  (void)data;
  (void)size;
  return 0;
}


x86 assembly (clang, -O0):
<bufferevent_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.bufferevent = type { i32 }
define i32 @bufferevent_write(%struct.bufferevent* %0, i8* %1, i64 %2) {
%4 = alloca %struct.bufferevent*
%5 = alloca i8*
%6 = alloca i64
store %struct.bufferevent* %0, %struct.bufferevent** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load %struct.bufferevent*, %struct.bufferevent** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
ret i32 0
}

LLVM IR (-O2):
%struct.bufferevent = type { i32 }
define i32 @bufferevent_write(%struct.bufferevent* nocapture readnone %0, i8* nocapture readnone %1, i64 %2) {
ret i32 0
}
/* Variables and functions */
int yahoo_M1Common(unsigned int, int);
int yahoo_f01_32(int Salt, int Parameter) {
  unsigned b = Salt ^ 0x35413DF3;
  return yahoo_M1Common(b, Parameter);
}


x86 assembly (clang, -O0):
<yahoo_f01_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x35413df3,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <yahoo_M1Common@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yahoo_f01_32>:
xor    $0x35413df3,%edi
jmp    1030 <yahoo_M1Common@plt>

LLVM IR (-O0):
define i32 @yahoo_f01_32(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 = xor i32 %6, 893468147
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = call i32 @yahoo_M1Common(i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @yahoo_f01_32(i32 %0, i32 %1) {
%3 = xor i32 %0, 893468147
%4 = tail call i32 @yahoo_M1Common(i32 %3, i32 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage:   %s [OPTIONS ...] COMMAND\n", "suns");
  fprintf(stderr, "-n name   Name of netns or pid.\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xee8(%rip),%rdx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xed6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
lea    0xeeb(%rip),%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Usage: %s [OPTIONS ...] COMMAND\0A\00"
@.str.1 = [5 x i8] c"suns\00"
@.str.2 = [33 x i8] c"-n name Name of netns or pid.\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Usage: %s [OPTIONS ...] COMMAND\0A\00"
@.str.1 = [5 x i8] c"suns\00"
@.str.2 = [33 x i8] c"-n name Name of netns or pid.\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 (i32, i8*, ...) @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ kdAssert(int, char const *);
void kdAssertLongEquals(const long expected, const long actual,
                        const char *message) {
  kdAssert(expected == actual, message);
}


x86 assembly (clang, -O0):
<kdAssertLongEquals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    -0x18(%rbp),%rsi
call   1030 <kdAssert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kdAssertLongEquals>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
mov    %eax,%edi
mov    %rdx,%rsi
jmp    1030 <kdAssert@plt>

LLVM IR (-O0):
define void @kdAssertLongEquals(i64 %0, i64 %1, i8* %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
store i64 %0, i64* %4
store i64 %1, i64* %5
store i8* %2, i8** %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = icmp eq i64 %7, %8
%10 = zext i1 %9 to i32
%11 = load i8*, i8** %6
%12 = call i32 @kdAssert(i32 %10, i8* %11)
ret void
}

LLVM IR (-O2):
define void @kdAssertLongEquals(i64 %0, i64 %1, i8* %2) {
%4 = icmp eq i64 %0, %1
%5 = zext i1 %4 to i32
%6 = tail call i32 @kdAssert(i32 %5, i8* %2)
ret void
}
int set_debug_flags(flags)
char *flags;
{
  printf("this program was compiled without debugging enabled\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [53 x i8] c"this program was compiled without debugging enabled\0A\00"
define i32 @set_debug_flags(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [52 x i8] c"this program was compiled without debugging enabled\00"
define i32 @set_debug_flags(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef int ptr_arr;

/* Variables and functions */
short **malloc(int);
int main() {
  short a = 3;
  short b = 2;
  short **ptr_arr = malloc(sizeof(short *) * 3);
  ptr_arr[0] = &a;
  ptr_arr[1] = &b;
  ptr_arr[2] = &b;
  b = 5;
  return *(ptr_arr[0]) + *(ptr_arr[1]) + *(ptr_arr[2]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x3,-0x6(%rbp)
movw   $0x2,-0x8(%rbp)
mov    $0x18,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
lea    -0x6(%rbp),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
lea    -0x8(%rbp),%rcx
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
lea    -0x8(%rbp),%rcx
mov    %rcx,0x10(%rax)
movw   $0x5,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movswl (%rax),%eax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
movswl (%rcx),%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
movswl (%rcx),%ecx
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x18,%edi
call   1030 <malloc@plt>
mov    $0xd,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
%3 = alloca i16
%4 = alloca i16**
store i32 0, i32* %1
store i16 3, i16* %2
store i16 2, i16* %3
%5 = call i16** @malloc(i32 24)
store i16** %5, i16*** %4
%6 = load i16**, i16*** %4
%7 = getelementptr inbounds i16*, i16** %6, i64 0
store i16* %2, i16** %7
%8 = load i16**, i16*** %4
%9 = getelementptr inbounds i16*, i16** %8, i64 1
store i16* %3, i16** %9
%10 = load i16**, i16*** %4
%11 = getelementptr inbounds i16*, i16** %10, i64 2
store i16* %3, i16** %11
store i16 5, i16* %3
%12 = load i16**, i16*** %4
%13 = getelementptr inbounds i16*, i16** %12, i64 0
%14 = load i16*, i16** %13
%15 = load i16, i16* %14
%16 = sext i16 %15 to i32
%17 = load i16**, i16*** %4
%18 = getelementptr inbounds i16*, i16** %17, i64 1
%19 = load i16*, i16** %18
%20 = load i16, i16* %19
%21 = sext i16 %20 to i32
%22 = add nsw i32 %16, %21
%23 = load i16**, i16*** %4
%24 = getelementptr inbounds i16*, i16** %23, i64 2
%25 = load i16*, i16** %24
%26 = load i16, i16* %25
%27 = sext i16 %26 to i32
%28 = add nsw i32 %22, %27
ret i32 %28
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i16** @malloc(i32 24)
ret i32 13
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ write_fmt_to_stream(int /*<<< orphan*/ *, char *, char *,
                                       int);
int main() {
  FILE *fp;
  fp = fopen("file.txt", "w");
  write_fmt_to_stream(fp, "two argument %s and %d \n", "Linkerist", 98);
  fclose(fp);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xebc(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeaa(%rip),%rsi
lea    0xebc(%rip),%rdx
mov    $0x62,%ecx
call   1040 <write_fmt_to_stream@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xeca(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xebd(%rip),%rsi
lea    0xecf(%rip),%rdx
mov    %rax,%rdi
mov    $0x62,%ecx
call   1040 <write_fmt_to_stream@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [25 x i8] c"two argument %s and %d \0A\00"
@.str.3 = [10 x i8] c"Linkerist\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @write_fmt_to_stream(i32* %4, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 98)
%6 = load i32*, i32** %2
%7 = call i32 @fclose(i32* %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"file.txt\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [25 x i8] c"two argument %s and %d \0A\00"
@.str.3 = [10 x i8] c"Linkerist\00"
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @write_fmt_to_stream(i32* %1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 98)
%3 = tail call i32 @fclose(i32* %1)
ret i32 0
}
/* Variables and functions */
char MCP4461_GetValue(int, int);
char getCaddyStepperCurrent(void) { return MCP4461_GetValue(0x5A, 0x00); }


x86 assembly (clang, -O0):
<getCaddyStepperCurrent>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5a,%edi
xor    %esi,%esi
call   1030 <MCP4461_GetValue@plt>
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCaddyStepperCurrent>:
mov    $0x5a,%edi
xor    %esi,%esi
jmp    1030 <MCP4461_GetValue@plt>

LLVM IR (-O0):
define signext i8 @getCaddyStepperCurrent() {
%1 = call signext i8 @MCP4461_GetValue(i32 90, i32 0)
ret i8 %1
}

LLVM IR (-O2):
define signext i8 @getCaddyStepperCurrent() {
%1 = tail call signext i8 @MCP4461_GetValue(i32 90, i32 0)
ret i8 %1
}
/* Variables and functions */
int rename(char *, char *);
int fs_rename(char *from, char *to) { return rename(from, to); }


x86 assembly (clang, -O0):
<fs_rename>:
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 <rename@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fs_rename>:
jmp    1030 <rename@plt>

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

LLVM IR (-O2):
define i32 @fs_rename(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
ret i32 %3
}
__attribute__((no)) void foo() { int x = 0; }


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

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
int xisblank(int c) { return (c == ' ' || c == '\t'); }


x86 assembly (clang, -O0):
<xisblank>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1120 <xisblank+0x20>
cmpl   $0x9,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xisblank>:
cmp    $0x20,%edi
sete   %al
cmp    $0x9,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @xisblank(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 32
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 9
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @xisblank(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = icmp eq i32 %0, 9
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fatalerror(char *);
void usage() {
  fatalerror("usage: cc1 [-cdfptw[-]] [-Ddefine] [-Iincdir] [-Uundef] [-o "
             "outfile] [infile]");
}


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

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

LLVM IR (-O0):
@.str = [78 x i8] c"usage: cc1 [-cdfptw[-]] [-Ddefine] [-Iincdir] [-Uundef] [-o outfile] [infile]\00"
define void @usage() {
%1 = call i32 @fatalerror(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [78 x i8] c"usage: cc1 [-cdfptw[-]] [-Ddefine] [-Iincdir] [-Uundef] [-o outfile] [infile]\00"
define void @usage() {
%1 = tail call i32 @fatalerror(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int file_exists(char *filename) {
  FILE *file = fopen(filename, "r");
  if (file) {
    fclose(file);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1160 <file_exists+0x40>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1167 <file_exists+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <file_exists+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @file_exists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ SNVS_HP_WRAPPER_DriverIRQHandler();
__attribute__((weak)) void SNVS_HP_WRAPPER_IRQHandler(void) {
  SNVS_HP_WRAPPER_DriverIRQHandler();
}


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

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

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

LLVM IR (-O2):
define weak void @SNVS_HP_WRAPPER_IRQHandler() {
%1 = tail call i32 (...) @SNVS_HP_WRAPPER_DriverIRQHandler()
ret void
}
unsigned long DCSMZone2CSMSecurityStatus(void) {
  unsigned long status;
  status = (*((volatile unsigned long *)(0x400FB400 + 0x00000084)));
  if ((status & 0x0800) && ((status & 0x0200) || (status & 0x0080))) {
    return (0);
  } else {
    return (1);
  }
}


x86 assembly (clang, -O0):
<DCSMZone2CSMSecurityStatus>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fb484,%eax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x800,%rax
cmp    $0x0,%rax
je     1159 <DCSMZone2CSMSecurityStatus+0x59>
mov    -0x10(%rbp),%rax
and    $0x200,%rax
cmp    $0x0,%rax
jne    114c <DCSMZone2CSMSecurityStatus+0x4c>
mov    -0x10(%rbp),%rax
and    $0x80,%rax
cmp    $0x0,%rax
je     1159 <DCSMZone2CSMSecurityStatus+0x59>
movq   $0x0,-0x8(%rbp)
jmp    1161 <DCSMZone2CSMSecurityStatus+0x61>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DCSMZone2CSMSecurityStatus>:
mov    0x400fb484,%rax
40
test   $0x800,%eax
sete   %cl
test   $0x280,%eax
sete   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i64 @DCSMZone2CSMSecurityStatus() {
%1 = alloca i64
%2 = alloca i64
%3 = load volatile i64, i64* inttoptr (i64 1074771076 to i64*)
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = and i64 %4, 2048
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %0
%8 = load i64, i64* %2
%9 = and i64 %8, 512
%10 = icmp ne i64 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = load i64, i64* %2
%13 = and i64 %12, 128
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11, %7
store i64 0, i64* %1
br label %17
16: ; preds = %11, %0
store i64 1, i64* %1
br label %17
17: ; preds = %16, %15
%18 = load i64, i64* %1
ret i64 %18
}

LLVM IR (-O2):
define i64 @DCSMZone2CSMSecurityStatus() {
%1 = load volatile i64, i64* inttoptr (i64 1074771076 to i64*)
%2 = and i64 %1, 2048
%3 = icmp eq i64 %2, 0
%4 = and i64 %1, 640
%5 = icmp eq i64 %4, 0
%6 = or i1 %3, %5
%7 = zext i1 %6 to i64
ret i64 %7
}
/* Variables and functions */
int __dlclose(void *);
int dlclose(void *handle) { return __dlclose(handle); }


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

x86 assembly (clang, -O2):
<dlclose>:
jmp    1030 <__dlclose@plt>

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

LLVM IR (-O2):
define i32 @dlclose(i8* %0) {
%2 = tail call i32 @__dlclose(i8* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
void dev_putch(int c) {
  if (c > 0) {
    putchar((char)c);
  } else {
    printf("\033[2J\033[1;1H");
  }
}


x86 assembly (clang, -O0):
<dev_putch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1145 <dev_putch+0x25>
mov    -0x4(%rbp),%eax
movsbl %al,%edi
call   1030 <putchar@plt>
jmp    1151 <dev_putch+0x31>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev_putch>:
test   %edi,%edi
jle    112d <dev_putch+0xd>
movsbl %dil,%edi
jmp    1030 <putchar@plt>
lea    0xecc(%rip),%rdi
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
define void @dev_putch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = load i32, i32* %2
%7 = trunc i32 %6 to i8
%8 = call i32 @putchar(i8 signext %7)
br label %11
9: ; preds = %1
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %5
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\1B[2J\1B[1;1H\00"
define void @dev_putch(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = trunc i32 %0 to i8
%5 = tail call i32 @putchar(i8 signext %4)
br label %8
6: ; preds = %1
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void printClock(int sec, int min, int hour) {
  printf("%02d:%02d:%02d\n", hour, min, sec);
}


x86 assembly (clang, -O0):
<printClock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x4(%rbp),%ecx
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printClock>:
mov    %esi,%eax
mov    %edi,%ecx
lea    0xee5(%rip),%rdi
mov    %edx,%esi
mov    %eax,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"%02d:%02d:%02d\0A\00"
define void @printClock(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* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%02d:%02d:%02d\0A\00"
define void @printClock(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %1, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void pula(int a) {
  int x = 13;
  printf("%d\n", x);
}


x86 assembly (clang, -O0):
<pula>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xd,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pula>:
lea    0xee9(%rip),%rdi
mov    $0xd,%esi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define void @pula(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 13, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @pula(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 13)
ret void
}
/* Type definitions */
struct abuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ abAppend(struct abuf *, char *, int);
void editorClearScreen(struct abuf *ab) {
  abAppend(ab, "\x1b[2J", 4);
  abAppend(ab, "\x1b[H", 3);
}


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

x86 assembly (clang, -O2):
<editorClearScreen>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x4,%edx
call   1030 <abAppend@plt>
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
pop    %rbx
jmp    1030 <abAppend@plt>

LLVM IR (-O0):
%struct.abuf = type { i32 }
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [4 x i8] c"\1B[H\00"
define void @editorClearScreen(%struct.abuf* %0) {
%2 = alloca %struct.abuf*
store %struct.abuf* %0, %struct.abuf** %2
%3 = load %struct.abuf*, %struct.abuf** %2
%4 = call i32 @abAppend(%struct.abuf* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%5 = load %struct.abuf*, %struct.abuf** %2
%6 = call i32 @abAppend(%struct.abuf* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
ret void
}

LLVM IR (-O2):
%struct.abuf = type { i32 }
@.str = [5 x i8] c"\1B[2J\00"
@.str.1 = [4 x i8] c"\1B[H\00"
define void @editorClearScreen(%struct.abuf* %0) {
%2 = tail call i32 @abAppend(%struct.abuf* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = tail call i32 @abAppend(%struct.abuf* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
ret void
}