xunge/DecIR huggingface dataset:
long sd(long n) {
  long sum = 0;
  while (n > 0) {
    sum += (n % 10);
    n /= 10;
  }
  return sum;
}


x86 assembly (clang, -O0):
<sd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jle    1148 <sd+0x48>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
add    -0x10(%rbp),%rdx
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    1110 <sd+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd>:
test   %rdi,%rdi
jle    1148 <sd+0x48>
mov    %rdi,%rsi
xor    %ecx,%ecx
movabs $0xcccccccccccccccd,%r8
cc cc cc
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rsi,%rax
mul    %r8
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rsi,%rdi
sub    %rax,%rdi
add    %rdi,%rcx
cmp    $0x9,%rsi
mov    %rdx,%rsi
ja     1120 <sd+0x20>
mov    %rcx,%rax
ret
xor    %ecx,%ecx
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @sd(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 0, i64* %3
br label %4
4: ; preds = %7, %1
%5 = load i64, i64* %2
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i64, i64* %2
%9 = srem i64 %8, 10
%10 = load i64, i64* %3
%11 = add nsw i64 %10, %9
store i64 %11, i64* %3
%12 = load i64, i64* %2
%13 = sdiv i64 %12, 10
store i64 %13, i64* %2
br label %4
14: ; preds = %4
%15 = load i64, i64* %3
ret i64 %15
}

LLVM IR (-O2):
define i64 @sd(i64 %0) {
%2 = icmp sgt i64 %0, 0
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i64 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %8, %3 ], [ %0, %1 ]
%6 = urem i64 %5, 10
%7 = add nuw nsw i64 %4, %6
%8 = udiv i64 %5, 10
%9 = icmp ult i64 %5, 10
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i64 [ 0, %1 ], [ %7, %3 ]
ret i64 %11
}
void HplCC2430InterruptsC$InterruptFIFOP$fired(void) {
  HalCC2430RadioP$InterruptFIFOP$fired();
}


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

x86 assembly (clang, -O2):
<HplCC2430InterruptsC$InterruptFIFOP$fired>:
xor    %eax,%eax
jmp    1030 <HalCC2430RadioP$InterruptFIFOP$fired@plt>

LLVM IR (-O0):
define void @"HplCC2430InterruptsC$InterruptFIFOP$fired"() {
%1 = call i32 (...) @"HalCC2430RadioP$InterruptFIFOP$fired"()
ret void
}

LLVM IR (-O2):
define void @"HplCC2430InterruptsC$InterruptFIFOP$fired"() {
%1 = tail call i32 (...) @"HalCC2430RadioP$InterruptFIFOP$fired"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
void finalize(int sig) {
  remove("/var/run/nis-notify.pid");
  syslog(LOG_INFO, "Daemon stopped.");
  exit(0);
}


x86 assembly (clang, -O0):
<finalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <remove@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
call   1040 <syslog@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<finalize>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <remove@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xecb(%rip),%rsi
call   1040 <syslog@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"/var/run/nis-notify.pid\00"
@LOG_INFO = global i32 0
@.str.1 = [16 x i8] c"Daemon stopped.\00"
define void @finalize(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @remove(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @LOG_INFO
%5 = call i32 @syslog(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"/var/run/nis-notify.pid\00"
@LOG_INFO = global i32 0
@.str.1 = [16 x i8] c"Daemon stopped.\00"
define void @finalize(i32 %0) {
%2 = tail call i32 @remove(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @LOG_INFO
%4 = tail call i32 @syslog(i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ SCOTCHFVERSION(int *const, int *const, int *const);
void scotchfversion(int *const versptr, int *const relaptr,
                    int *const patcptr) {
  SCOTCHFVERSION(versptr, relaptr, patcptr);
}


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

x86 assembly (clang, -O2):
<scotchfversion>:
jmp    1030 <SCOTCHFVERSION@plt>

LLVM IR (-O0):
define void @scotchfversion(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 @SCOTCHFVERSION(i32* %7, i32* %8, i32* %9)
ret void
}

LLVM IR (-O2):
define void @scotchfversion(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @SCOTCHFVERSION(i32* %0, i32* %1, i32* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void OutputHeader_def(FILE *file, char *libname) {
  fprintf(file,
          "; File generated automatically, do not edit!\n\n"
          "NAME %s\n\n"
          "EXPORTS\n",
          libname);
}


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

x86 assembly (clang, -O2):
<OutputHeader_def>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"; File generated automatically, do not edit!\0A\0ANAME %s\0A\0AEXPORTS\0A\00"
define void @OutputHeader_def(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 @fprintf(i32* %5, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"; File generated automatically, do not edit!\0A\0ANAME %s\0A\0AEXPORTS\0A\00"
define void @OutputHeader_def(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
int iabs(int x) { return x < 0 ? -x : x; }


x86 assembly (clang, -O0):
<iabs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <iabs+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <iabs+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @iabs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @iabs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_add_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_cmplt_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_setzero_si128();
int /*<<< orphan*/ _mm_srli_epi16(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i _mm_abs_epi16_sse2(__m128i a) {
  __m128i negative = _mm_cmplt_epi16(a, _mm_setzero_si128());
  return _mm_add_epi16(_mm_xor_si128(a, negative),
                       _mm_srli_epi16(negative, 15));
}


x86 assembly (clang, -O0):
<_mm_abs_epi16_sse2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <_mm_setzero_si128@plt>
mov    -0x10(%rbp),%edi
mov    %eax,%esi
call   1060 <_mm_cmplt_epi16@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    $0xf,%esi
call   1050 <_mm_srli_epi16@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1030 <_mm_add_epi16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mm_abs_epi16_sse2>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <_mm_setzero_si128@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <_mm_cmplt_epi16@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %eax,%esi
call   1070 <_mm_xor_si128@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    $0xf,%esi
call   1050 <_mm_srli_epi16@plt>
mov    %ebx,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <_mm_add_epi16@plt>

LLVM IR (-O0):
define i32 @_mm_abs_epi16_sse2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 (...) @_mm_setzero_si128()
%6 = call i32 @_mm_cmplt_epi16(i32 %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = call i32 @_mm_xor_si128(i32 %7, i32 %8)
%10 = load i32, i32* %3
%11 = call i32 @_mm_srli_epi16(i32 %10, i32 15)
%12 = call i32 @_mm_add_epi16(i32 %9, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
define i32 @_mm_abs_epi16_sse2(i32 %0) {
%2 = tail call i32 (...) @_mm_setzero_si128()
%3 = tail call i32 @_mm_cmplt_epi16(i32 %0, i32 %2)
%4 = tail call i32 @_mm_xor_si128(i32 %0, i32 %3)
%5 = tail call i32 @_mm_srli_epi16(i32 %3, i32 15)
%6 = tail call i32 @_mm_add_epi16(i32 %4, i32 %5)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ PowerManagerP__1__PowerDownCleanup__default__cleanup();
void PowerManagerP__1__PowerDownCleanup__cleanup(void) {
  PowerManagerP__1__PowerDownCleanup__default__cleanup();
}


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

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

LLVM IR (-O0):
define void @PowerManagerP__1__PowerDownCleanup__cleanup() {
%1 = call i32 (...) @PowerManagerP__1__PowerDownCleanup__default__cleanup()
ret void
}

LLVM IR (-O2):
define void @PowerManagerP__1__PowerDownCleanup__cleanup() {
%1 = tail call i32 (...) @PowerManagerP__1__PowerDownCleanup__default__cleanup()
ret void
}
/* Variables and functions */
double M_PI;
double deg_to_rad(double degrees) { return degrees * (M_PI / 180.0); }


x86 assembly (clang, -O0):
<deg_to_rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    0x2ed3(%rip),%rax
movsd  (%rax),%xmm1
movsd  0xedf(%rip),%xmm2
divsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<deg_to_rad>:
mov    0x2ee1(%rip),%rax
movsd  (%rax),%xmm1
divsd  0xeed(%rip),%xmm1
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @deg_to_rad(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* @M_PI
%5 = fdiv double %4, 1.800000e+02
%6 = fmul double %3, %5
ret double %6
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @deg_to_rad(double %0) {
%2 = load double, double* @M_PI
%3 = fdiv double %2, 1.800000e+02
%4 = fmul double %3, %0
ret double %4
}
void foo071(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo071(i32 %0) {
ret void
}
unsigned int d1hash(void *key) {
  unsigned int *v = key;
  return v[0] + v[1];
}


x86 assembly (clang, -O0):
<d1hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
add    0x4(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d1hash>:
mov    0x4(%rdi),%eax
add    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @d1hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = add i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @d1hash(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = getelementptr inbounds i8, i8* %0, i64 4
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
%7 = add i32 %6, %3
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fp_platform_init();
int module_init() {
  fp_platform_init();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @module_init() {
%1 = call i32 (...) @fp_platform_init()
ret i32 0
}

LLVM IR (-O2):
define i32 @module_init() {
%1 = tail call i32 (...) @fp_platform_init()
ret i32 0
}
/* Type definitions */
typedef float int32_t;

/* Variables and functions */
int32_t FloatToFixed(float val) { return val * 65536.0f; }


x86 assembly (clang, -O0):
<FloatToFixed>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<FloatToFixed>:
mulss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @FloatToFixed(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 6.553600e+04
ret float %4
}

LLVM IR (-O2):
define float @FloatToFixed(float %0) {
%2 = fmul float %0, 6.553600e+04
ret float %2
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct chirp_client {
  int dummy;
};
typedef int /*<<< orphan*/ safepath;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ simple_command(struct chirp_client *, int /*<<< orphan*/,
                                  char *, char const *);
int /*<<< orphan*/ url_encode(char const *, char *, int);
int64_t chirp_client_getstream(struct chirp_client *c, const char *path,
                               time_t stoptime) {
  char safepath[1024];
  url_encode(path, safepath, sizeof(safepath));
  return simple_command(c, stoptime, "getstream %s\n", path);
}


x86 assembly (clang, -O0):
<chirp_client_getstream>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rcx
lea    0xea3(%rip),%rdx
call   1030 <simple_command@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_getstream>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x400,%edx
call   1040 <url_encode@plt>
lea    0xeb5(%rip),%rdx
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rbx,%rcx
call   1030 <simple_command@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.chirp_client = type { i32 }
@.str = [14 x i8] c"getstream %s\0A\00"
define i32 @chirp_client_getstream(%struct.chirp_client* %0, i8* %1, i32 %2) {
%4 = alloca %struct.chirp_client*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [1024 x i8]
store %struct.chirp_client* %0, %struct.chirp_client** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%10 = call i32 @url_encode(i8* %8, i8* %9, i32 1024)
%11 = load %struct.chirp_client*, %struct.chirp_client** %4
%12 = load i32, i32* %6
%13 = load i8*, i8** %5
%14 = call i32 @simple_command(%struct.chirp_client* %11, i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.chirp_client = type { i32 }
@.str = [14 x i8] c"getstream %s\0A\00"
define i32 @chirp_client_getstream(%struct.chirp_client* %0, i8* %1, i32 %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = call i32 @url_encode(i8* %1, i8* %5, i32 1024)
%7 = call i32 @simple_command(%struct.chirp_client* %0, i32 %2, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 %7
}
/* Type definitions */
struct hostent {
  int dummy;
};
typedef enum nss_status { ____Placeholder_nss_status } nss_status;

/* Variables and functions */
int inject(char *);
enum nss_status _nss_inject_gethostbyname2_r(const char *name, int family,
                                             struct hostent *result,
                                             char *buffer, size_t buflen,
                                             int *errnop, int *h_errnop) {
  return inject("gethostbyname2");
}


x86 assembly (clang, -O0):
<_nss_inject_gethostbyname2_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <inject@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.hostent = type { i32 }
@.str = [15 x i8] c"gethostbyname2\00"
define i32 @_nss_inject_gethostbyname2_r(i8* %0, i32 %1, %struct.hostent* %2, i8* %3, i64 %4, i32* %5, i32* %6) {
%8 = alloca i8*
%9 = alloca i32
%10 = alloca %struct.hostent*
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32*
%14 = alloca i32*
store i8* %0, i8** %8
store i32 %1, i32* %9
store %struct.hostent* %2, %struct.hostent** %10
store i8* %3, i8** %11
store i64 %4, i64* %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%15 = call i32 @inject(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 %15
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
@.str = [15 x i8] c"gethostbyname2\00"
define i32 @_nss_inject_gethostbyname2_r(i8* nocapture readnone %0, i32 %1, %struct.hostent* nocapture readnone %2, i8* nocapture readnone %3, i64 %4, i32* nocapture readnone %5, i32* nocapture readnone %6) {
%8 = tail call i32 @inject(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int execlp(const char *file, const char *arg, ...) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<execlp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ed5(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebc(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<execlp>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @execlp(i8* %0, i8* %1, ...) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @execlp(i8* nocapture readnone %0, i8* nocapture readnone %1, ...) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i32 -1
}
const int round_x(const double x) { return ((int)(x + 0.5)); }


x86 assembly (clang, -O0):
<round_x>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_x>:
addsd  0xef8(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @round_x(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 5.000000e-01
%5 = fptosi double %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @round_x(double %0) {
%2 = fadd double %0, 5.000000e-01
%3 = fptosi double %2 to i32
ret i32 %3
}
/* Variables and functions */
double sqrt(double);
double lim(double x) { return x / sqrt(sqrt(1 + x * x * x * x)); }


x86 assembly (clang, -O0):
<lim>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb9(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lim>:
push   %rax
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm1,(%rsp)
mulsd  %xmm1,%xmm0
addsd  0xed2(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1149 <lim+0x39>
sqrtsd %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jae    1158 <lim+0x48>
call   1030 <sqrt@plt>
jmp    115c <lim+0x4c>
call   1030 <sqrt@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1142 <lim+0x32>
sqrtsd %xmm0,%xmm0
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @lim(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = load double, double* %2
%8 = fmul double %6, %7
%9 = load double, double* %2
%10 = call double @llvm.fmuladd.f64(double %8, double %9, double 1.000000e+00)
%11 = call double @sqrt(double %10)
%12 = call double @sqrt(double %11)
%13 = fdiv double %3, %12
ret double %13
}

LLVM IR (-O2):
define double @lim(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, %0
%4 = tail call double @llvm.fmuladd.f64(double %3, double %0, double 1.000000e+00)
%5 = tail call double @sqrt(double %4)
%6 = tail call double @sqrt(double %5)
%7 = fdiv double %0, %6
ret double %7
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
uint32_t load32(uint8_t *b) {
  uint32_t x;
  memcpy(&x, b, 4);
  return x;
}


x86 assembly (clang, -O0):
<load32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<load32>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @load32(i32* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i32* %0, i32 4)
%5 = load i32, i32* %2
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ test(char *);
int main(int argc, char **argv) {
  test("abcd efghi");
  test("[1234, 1234");
  test("[1234 5678");
  test("[\"foobar\", 1234");
  test("[\"fo\\\"bar\", 1234");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <test@plt>
lea    0xed9(%rip),%rdi
call   1030 <test@plt>
lea    0xed9(%rip),%rdi
call   1030 <test@plt>
lea    0xed8(%rip),%rdi
call   1030 <test@plt>
lea    0xedc(%rip),%rdi
call   1030 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"abcd efghi\00"
@.str.1 = [12 x i8] c"[1234, 1234\00"
@.str.2 = [11 x i8] c"[1234 5678\00"
@.str.3 = [16 x i8] c"[\22foobar\22, 1234\00"
@.str.4 = [17 x i8] c"[\22fo\\\22bar\22, 1234\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @test(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @test(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @test(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"abcd efghi\00"
@.str.1 = [12 x i8] c"[1234, 1234\00"
@.str.2 = [11 x i8] c"[1234 5678\00"
@.str.3 = [16 x i8] c"[\22foobar\22, 1234\00"
@.str.4 = [17 x i8] c"[\22fo\\\22bar\22, 1234\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @test(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @test(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @test(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 @test(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%7 = tail call i32 @test(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}
void gf2_matrix_square(square, mat) unsigned long *square;
unsigned long *mat;
{
  int n;
  for (n = 0; n < 32; n++)
    square[n] = gf2_matrix_times(mat, mat[n]);
}


x86 assembly (clang, -O0):
<gf2_matrix_square>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jge    1165 <gf2_matrix_square+0x55>
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0x0,%al
call   1030 <gf2_matrix_times@plt>
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <gf2_matrix_square+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf2_matrix_square>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   (%rax)
mov    (%r15,%rbx,8),%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1030 <gf2_matrix_times@plt>
cltq
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1120 <gf2_matrix_square+0x10>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @gf2_matrix_square(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i32
store i64* %0, i64** %3
store i64* %1, i64** %4
store i32 0, i32* %5
br label %6
6: ; preds = %22, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 32
br i1 %8, label %9, label %25
9: ; preds = %6
%10 = load i64*, i64** %4
%11 = load i64*, i64** %4
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i64, i64* %11, i64 %13
%15 = load i64, i64* %14
%16 = call i32 (i64*, i64, ...) bitcast (i32 (...)* @gf2_matrix_times to i32 (i64*, i64, ...)*)(i64* %10, i64 %15)
%17 = sext i32 %16 to i64
%18 = load i64*, i64** %3
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i64, i64* %18, i64 %20
store i64 %17, i64* %21
br label %22
22: ; preds = %9
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %6
25: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @gf2_matrix_square(i64* nocapture writeonly %0, i64* %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i64 [ 0, %2 ], [ %10, %3 ]
%5 = getelementptr inbounds i64, i64* %1, i64 %4
%6 = load i64, i64* %5
%7 = tail call i32 (i64*, i64, ...) bitcast (i32 (...)* @gf2_matrix_times to i32 (i64*, i64, ...)*)(i64* %1, i64 %6)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i64, i64* %0, i64 %4
store i64 %8, i64* %9
%10 = add nuw nsw i64 %4, 1
%11 = icmp eq i64 %10, 32
br i1 %11, label %12, label %3
12: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ curDisplayFunc();
int /*<<< orphan*/ curIdleFunc();
int /*<<< orphan*/ lcd_buttonDown(int);
void lcd_mainLoop(void) {
  do {
    curIdleFunc();
    curDisplayFunc();
  } while (!lcd_buttonDown((1 << 1) | (1 << 4)));
}


x86 assembly (clang, -O0):
<lcd_mainLoop>:
push   %rbp
mov    %rsp,%rbp
jmp    1139 <lcd_mainLoop+0x9>
mov    $0x0,%al
call   1040 <curIdleFunc@plt>
mov    $0x0,%al
call   1050 <curDisplayFunc@plt>
mov    $0x12,%edi
call   1030 <lcd_buttonDown@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1139 <lcd_mainLoop+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_mainLoop>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <curIdleFunc@plt>
xor    %eax,%eax
call   1050 <curDisplayFunc@plt>
mov    $0x12,%edi
call   1030 <lcd_buttonDown@plt>
test   %eax,%eax
je     1140 <lcd_mainLoop+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @lcd_mainLoop() {
br label %1
1: ; preds = %4, %0
%2 = call i32 (...) @curIdleFunc()
%3 = call i32 (...) @curDisplayFunc()
br label %4
4: ; preds = %1
%5 = call i32 @lcd_buttonDown(i32 18)
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %1, label %8
8: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @lcd_mainLoop() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @curIdleFunc()
%3 = tail call i32 (...) @curDisplayFunc()
%4 = tail call i32 @lcd_buttonDown(i32 18)
%5 = icmp eq i32 %4, 0
br i1 %5, label %1, label %6
6: ; preds = %1
ret void
}
char *string_copy(char *destination, const char *source) {
  int d0, d1, d2;
  asm volatile("cld\n"
               "1:  lodsb\n"
               "stosb\n"
               "testb %%al, %%al\n"
               "jne 1b"
               : "=&S"(d0), "=&D"(d1), "=&a"(d2)
               : "0"(source), "1"(destination)
               : "memory");
  return destination;
}


x86 assembly (clang, -O0):
<string_copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdi
cld
lods   %ds:(%rsi),%al
stos   %al,%es:(%rdi)
test   %al,%al
jne    1115 <string_copy+0x15>
mov    %esi,%ecx
mov    %ecx,-0x14(%rbp)
mov    %edi,%ecx
mov    %ecx,-0x18(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_copy>:
mov    %rdi,%rcx
cld
lods   %ds:(%rsi),%al
stos   %al,%es:(%rdi)
test   %al,%al
jne    1104 <string_copy+0x4>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i8* @string_copy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = load i8*, i8** %3
%10 = call { i8*, i8*, i32 } asm sideeffect "cld\0A1: lodsb\0Astosb\0Atestb %al, %al\0Ajne 1b", "=&{si},=&{di},=&{ax},0,1,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %8, i8* %9)
%11 = extractvalue { i8*, i8*, i32 } %10, 0
%12 = extractvalue { i8*, i8*, i32 } %10, 1
%13 = extractvalue { i8*, i8*, i32 } %10, 2
%14 = ptrtoint i8* %11 to i64
%15 = trunc i64 %14 to i32
store i32 %15, i32* %5
%16 = ptrtoint i8* %12 to i64
%17 = trunc i64 %16 to i32
store i32 %17, i32* %6
store i32 %13, i32* %7
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @string_copy(i8* returned %0, i8* %1) {
%3 = tail call { i8*, i8*, i32 } asm sideeffect "cld\0A1: lodsb\0Astosb\0Atestb %al, %al\0Ajne 1b", "=&{si},=&{di},=&{ax},0,1,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* %1, i8* %0)
ret i8* %0
}
/* Type definitions */
struct EmuGlobal {
  int dummy;
};

/* Variables and functions */
struct EmuGlobal *lemu_core_global_new(char const *, void const *, size_t);
struct EmuGlobal *lemu_global_new(const char *fname, const void *data,
                                  size_t len) {
  return lemu_core_global_new(fname, data, len);
}


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

x86 assembly (clang, -O2):
<lemu_global_new>:
jmp    1030 <lemu_core_global_new@plt>

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

LLVM IR (-O2):
%struct.EmuGlobal = type { i32 }
define %struct.EmuGlobal* @lemu_global_new(i8* %0, i8* %1, i64 %2) {
%4 = tail call %struct.EmuGlobal* @lemu_core_global_new(i8* %0, i8* %1, i64 %2)
ret %struct.EmuGlobal* %4
}
/* Variables and functions */
scalar_t__ pow(int, int);
float sqrt(scalar_t__);
float cartesian_distance(int x1, int y1, int x2, int y2) {
  return sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2));
}


x86 assembly (clang, -O0):
<cartesian_distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
sub    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
sub    -0x10(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    -0x18(%rbp),%rdi
add    %rax,%rdi
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cartesian_distance>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %esi,%ebp
sub    %edx,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %rax,%rbx
sub    %r14d,%ebp
mov    %ebp,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define float @cartesian_distance(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %7
%11 = sub nsw i32 %9, %10
%12 = call i64 @pow(i32 %11, i32 2)
%13 = load i32, i32* %6
%14 = load i32, i32* %8
%15 = sub nsw i32 %13, %14
%16 = call i64 @pow(i32 %15, i32 2)
%17 = add nsw i64 %12, %16
%18 = call float @sqrt(i64 %17)
ret float %18
}

LLVM IR (-O2):
define float @cartesian_distance(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %2
%6 = tail call i64 @pow(i32 %5, i32 2)
%7 = sub nsw i32 %1, %3
%8 = tail call i64 @pow(i32 %7, i32 2)
%9 = add nsw i64 %8, %6
%10 = tail call float @sqrt(i64 %9)
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
scalar_t__ system(char *);
int main() {
  if (system(NULL)) {
    while (1) {
      system("gnublin-gpio -p 11 -o 1");
      sleep(1);
      system("gnublin-gpio -p 11 -o 0");
      sleep(10);
    }
  } else {
    exit(EXIT_FAILURE);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <system@plt>
cmp    $0x0,%rax
je     1188 <main+0x58>
jmp    1157 <main+0x27>
lea    0xea2(%rip),%rdi
call   1030 <system@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
lea    0xea4(%rip),%rdi
call   1030 <system@plt>
mov    $0xa,%edi
call   1050 <sleep@plt>
jmp    1157 <main+0x27>
mov    0x2e51(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <system@plt>
test   %rax,%rax
je     1176 <main+0x46>
lea    0xeb9(%rip),%r14
lea    0xeca(%rip),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
call   1030 <system@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
mov    $0xa,%edi
call   1050 <sleep@plt>
jmp    1150 <main+0x20>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"gnublin-gpio -p 11 -o 1\00"
@.str.1 = [24 x i8] c"gnublin-gpio -p 11 -o 0\00"
@EXIT_FAILURE = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @system(i8* null)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %0
br label %5
5: ; preds = %4, %5
%6 = call i64 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @sleep(i32 1)
%8 = call i64 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @sleep(i32 10)
br label %5
10: ; preds = %0
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"gnublin-gpio -p 11 -o 1\00"
@.str.1 = [24 x i8] c"gnublin-gpio -p 11 -o 0\00"
@EXIT_FAILURE = global i32 0
define i32 @main() {
%1 = tail call i64 @system(i8* null)
%2 = icmp eq i64 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0, %3
%4 = tail call i64 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i64 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @sleep(i32 10)
br label %3
8: ; preds = %0
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
}
int test20() {
  int i;
  if (i)
    return 0;
  else if (0)
    return 2;
}


x86 assembly (clang, -O0):
<test20>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,-0x8(%rbp)
je     111a <test20+0x1a>
movl   $0x0,-0x4(%rbp)
jmp    111f <test20+0x1f>
jmp    111f <test20+0x1f>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test20() {
ret i32 0
}
void slab_depot_init() {}


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

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

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

LLVM IR (-O2):
define void @slab_depot_init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ STDERR_FILENO;
int /*<<< orphan*/ eiki_write(int /*<<< orphan*/, char *, int);
void eiki_print_c(char c) { eiki_write(STDERR_FILENO, &c, 1); }


x86 assembly (clang, -O0):
<eiki_print_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    0x2ebb(%rip),%rax
mov    (%rax),%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <eiki_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eiki_print_c>:
push   %rax
mov    %dil,0x7(%rsp)
mov    0x2ec3(%rip),%rax
mov    (%rax),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <eiki_write@plt>
pop    %rax
ret

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

LLVM IR (-O2):
@STDERR_FILENO = global i32 0
define void @eiki_print_c(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i32, i32* @STDERR_FILENO
%4 = call i32 @eiki_write(i32 %3, i8* %2, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printn(int);
void main() {
  int x = 3;
  if (x == 4)
    printn(4);
  else if (x == 5)
    printn(5);
  else
    printn(40);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x3,-0x4(%rbp)
cmpl   $0x4,-0x4(%rbp)
jne    1138 <main+0x28>
mov    $0x4,%edi
call   1030 <printn@plt>
jmp    1160 <main+0x50>
cmpl   $0x5,-0x4(%rbp)
jne    1151 <main+0x41>
mov    $0x5,%edi
call   1030 <printn@plt>
jmp    115b <main+0x4b>
mov    $0x28,%edi
call   1030 <printn@plt>
jmp    1160 <main+0x50>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x28,%edi
jmp    1030 <printn@plt>

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @printn(i32 40)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ backtrackSequences(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
void generateSequences(int n) {
  int *A = (int *)malloc(n * sizeof(int));
  backtrackSequences(A, 0, n);
  free(A);
}


x86 assembly (clang, -O0):
<generateSequences>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1050 <backtrackSequences@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generateSequences>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
lea    0x0(,%r14,4),%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14d,%edx
call   1050 <backtrackSequences@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @generateSequences(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 4
%7 = trunc i64 %6 to i32
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %3
%10 = load i32*, i32** %3
%11 = load i32, i32* %2
%12 = call i32 @backtrackSequences(i32* %10, i32 0, i32 %11)
%13 = load i32*, i32** %3
%14 = call i32 @free(i32* %13)
ret void
}

LLVM IR (-O2):
define void @generateSequences(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i32 @backtrackSequences(i32* %4, i32 0, i32 %0)
%6 = tail call i32 @free(i32* %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
unsigned char *load_jpeg_image(int *, int *, int *, int);
int /*<<< orphan*/ start_file(int /*<<< orphan*/ *);
unsigned char *stbi_jpeg_load_from_file(FILE *f, int *x, int *y, int *comp,
                                        int req_comp) {
  start_file(f);
  return load_jpeg_image(x, y, comp, req_comp);
}


x86 assembly (clang, -O0):
<stbi_jpeg_load_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <start_file@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1040 <load_jpeg_image@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stbi_jpeg_load_from_file>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rsi,%rbx
call   1030 <start_file@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <load_jpeg_image@plt>

LLVM IR (-O0):
define i8* @stbi_jpeg_load_from_file(i32* %0, i32* %1, i32* %2, i32* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load i32*, i32** %6
%12 = call i32 @start_file(i32* %11)
%13 = load i32*, i32** %7
%14 = load i32*, i32** %8
%15 = load i32*, i32** %9
%16 = load i32, i32* %10
%17 = call i8* @load_jpeg_image(i32* %13, i32* %14, i32* %15, i32 %16)
ret i8* %17
}

LLVM IR (-O2):
define i8* @stbi_jpeg_load_from_file(i32* %0, i32* %1, i32* %2, i32* %3, i32 %4) {
%6 = tail call i32 @start_file(i32* %0)
%7 = tail call i8* @load_jpeg_image(i32* %1, i32* %2, i32* %3, i32 %4)
ret i8* %7
}
/* Variables and functions */
int GetThreadWork();
int /*<<< orphan*/ workfunction(int);
void ThreadWorkerFunction(int threadnum) {
  int work;
  while (1) {
    work = GetThreadWork();
    if (work == -1)
      break;
    workfunction(work);
  }
}


x86 assembly (clang, -O0):
<ThreadWorkerFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <GetThreadWork@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1144 <ThreadWorkerFunction+0x24>
jmp    1151 <ThreadWorkerFunction+0x31>
mov    -0x8(%rbp),%edi
call   1040 <workfunction@plt>
jmp    112b <ThreadWorkerFunction+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ThreadWorkerFunction>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <GetThreadWork@plt>
cmp    $0xffffffff,%eax
je     1145 <ThreadWorkerFunction+0x25>
mov    %eax,%edi
call   1040 <workfunction@plt>
jmp    1130 <ThreadWorkerFunction+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @ThreadWorkerFunction(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %1, %9
%5 = call i32 (...) @GetThreadWork()
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %4
br label %12
9: ; preds = %4
%10 = load i32, i32* %3
%11 = call i32 @workfunction(i32 %10)
br label %4
12: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @ThreadWorkerFunction(i32 %0) {
%2 = tail call i32 (...) @GetThreadWork()
%3 = icmp eq i32 %2, -1
br i1 %3, label %9, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ %2, %1 ]
%6 = tail call i32 @workfunction(i32 %5)
%7 = tail call i32 (...) @GetThreadWork()
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %4
9: ; preds = %4, %1
ret void
}