xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strlen(char *);
char *_concatStrings(char *str1, char *str2) {
  char *nstring = (char *)malloc(strlen(str1) + strlen(str2) + 1);
  strcat(nstring, str1);
  strcat(nstring, str2);
  return nstring;
}


x86 assembly (clang, -O0):
<_concatStrings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_concatStrings>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @_concatStrings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = add nsw i64 %10, 1
%12 = call i64 @malloc(i64 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = call i32 @strcat(i8* %14, i8* %15)
%17 = load i8*, i8** %5
%18 = load i8*, i8** %4
%19 = call i32 @strcat(i8* %17, i8* %18)
%20 = load i8*, i8** %5
ret i8* %20
}

LLVM IR (-O2):
define i8* @_concatStrings(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 1
%6 = add i64 %5, %4
%7 = tail call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
%9 = tail call i32 @strcat(i8* %8, i8* %0)
%10 = tail call i32 @strcat(i8* %8, i8* %1)
ret i8* %8
}
/* Type definitions */
typedef int /*<<< orphan*/ err;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ write(int, char const *, int);
void __check_for_sync8_kernelhelper(void) {
  if ((*(unsigned int *)0xffff0ffc) < 5) {
    const char err[] = "A newer kernel is required to run this binary. "
                       "(__kernel_cmpxchg64 helper)\n";
    write(2, err, sizeof(err));
    abort();
  }
}


x86 assembly (clang, -O0):
<__check_for_sync8_kernelhelper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    $0xffff0ffc,%eax
cmpl   $0x5,(%rax)
jae    1175 <__check_for_sync8_kernelhelper+0x45>
lea    -0x50(%rbp),%rdi
lea    0xeaf(%rip),%rsi
mov    $0x4c,%edx
call   1050 <memcpy@plt>
lea    -0x50(%rbp),%rsi
mov    $0x2,%edi
mov    $0x4c,%edx
call   1040 <write@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__check_for_sync8_kernelhelper>:
sub    $0x58,%rsp
mov    $0xffff0ffc,%eax
cmpl   $0x4,(%rax)
jbe    1133 <__check_for_sync8_kernelhelper+0x13>
add    $0x58,%rsp
ret
movups 0xf02(%rip),%xmm0
movups %xmm0,0x3c(%rsp)
movaps 0xeea(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xece(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb2(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe96(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edi
mov    $0x4c,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@__const.__check_for_sync8_kernelhelper.err = [76 x i8] c"A newer kernel is required to run this binary. (__kernel_cmpxchg64 helper)\0A\00"
define void @__check_for_sync8_kernelhelper() {
%1 = alloca [76 x i8]
%2 = load i32, i32* inttoptr (i64 4294905852 to i32*)
%3 = icmp ult i32 %2, 5
br i1 %3, label %4, label %9
4: ; preds = %0
%5 = bitcast [76 x i8]* %1 to i8*
%6 = getelementptr inbounds [76 x i8], [76 x i8]* %1, i64 0, i64 0
%7 = call i32 @write(i32 2, i8* %6, i32 76)
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %0
ret void
}

LLVM IR (-O2):
@__const.__check_for_sync8_kernelhelper.err = [76 x i8] c"A newer kernel is required to run this binary. (__kernel_cmpxchg64 helper)\0A\00"
define void @__check_for_sync8_kernelhelper() {
%1 = alloca [76 x i8]
%2 = load i32, i32* inttoptr (i64 4294905852 to i32*)
%3 = icmp ult i32 %2, 5
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = getelementptr inbounds [76 x i8], [76 x i8]* %1, i64 0, i64 0
%6 = call i32 @write(i32 2, i8* %5, i32 76)
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %0
ret void
}
void crstrns(double *x, double *y) {
  x[0] = y[3];
  x[1] = y[2];
  x[2] = y[1];
  x[3] = y[0];
  return;
}


x86 assembly (clang, -O0):
<crstrns>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x18(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<crstrns>:
movsd  0x18(%rsi),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x10(%rsi),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x10(%rdi)
movsd  (%rsi),%xmm0
movsd  %xmm0,0x18(%rdi)
ret

LLVM IR (-O0):
define void @crstrns(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = getelementptr inbounds double, double* %5, i64 3
%7 = load double, double* %6
%8 = load double*, double** %3
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
%10 = load double*, double** %4
%11 = getelementptr inbounds double, double* %10, i64 2
%12 = load double, double* %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 1
store double %12, double* %14
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 1
%17 = load double, double* %16
%18 = load double*, double** %3
%19 = getelementptr inbounds double, double* %18, i64 2
store double %17, double* %19
%20 = load double*, double** %4
%21 = getelementptr inbounds double, double* %20, i64 0
%22 = load double, double* %21
%23 = load double*, double** %3
%24 = getelementptr inbounds double, double* %23, i64 3
store double %22, double* %24
ret void
}

LLVM IR (-O2):
define void @crstrns(double* nocapture writeonly %0, double* nocapture %1) {
%3 = getelementptr inbounds double, double* %1, i64 3
%4 = load double, double* %3
store double %4, double* %0
%5 = getelementptr inbounds double, double* %1, i64 2
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %0, i64 1
store double %6, double* %7
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = getelementptr inbounds double, double* %0, i64 2
store double %9, double* %10
%11 = load double, double* %1
%12 = getelementptr inbounds double, double* %0, i64 3
store double %11, double* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ appear_party_map_event(char);
void appear_party_last_boss(void) { appear_party_map_event('a'); }


x86 assembly (clang, -O0):
<appear_party_last_boss>:
push   %rbp
mov    %rsp,%rbp
mov    $0x61,%edi
call   1030 <appear_party_map_event@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<appear_party_last_boss>:
mov    $0x61,%edi
jmp    1030 <appear_party_map_event@plt>

LLVM IR (-O0):
define void @appear_party_last_boss() {
%1 = call i32 @appear_party_map_event(i8 signext 97)
ret void
}

LLVM IR (-O2):
define void @appear_party_last_boss() {
%1 = tail call i32 @appear_party_map_event(i8 signext 97)
ret void
}
/* Variables and functions */
short h_mod(short *, short *);
short intr_wrap_384(short p1, short p2) { return h_mod(&p1, &p2); }


x86 assembly (clang, -O0):
<intr_wrap_384>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
lea    -0x2(%rbp),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <h_mod@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_384>:
push   %rax
mov    %di,0x6(%rsp)
mov    %si,0x4(%rsp)
lea    0x6(%rsp),%rdi
lea    0x4(%rsp),%rsi
call   1030 <h_mod@plt>
pop    %rcx
ret

LLVM IR (-O0):
define signext i16 @intr_wrap_384(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = call signext i16 @h_mod(i16* %3, i16* %4)
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @intr_wrap_384(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = call signext i16 @h_mod(i16* %3, i16* %4)
ret i16 %5
}
AR0AX1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{ (p0[10000000]) = (((short *)11111111)[x1]); }


x86 assembly (clang, -O0):
<AR0AX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
movslq -0x10(%rbp),%rcx
mov    $0xa98ac7,%eax
mov    (%rax,%rcx,2),%cx
mov    -0x18(%rbp),%rax
mov    %cx,0x1312d00(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AR0AX1>:
movslq %ecx,%rax
movzwl 0xa98ac7(%rax,%rax,1),%eax
mov    %ax,0x1312d00(%r8)
01
ret

LLVM IR (-O0):
define i32 @AR0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i32, i32* %11
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i16, i16* inttoptr (i64 11111111 to i16*), i64 %17
%19 = load i16, i16* %18
%20 = load i16*, i16** %12
%21 = getelementptr inbounds i16, i16* %20, i64 10000000
store i16 %19, i16* %21
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @AR0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture writeonly %4, i16* nocapture readnone %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i16, i16* inttoptr (i64 11111111 to i16*), i64 %7
%9 = load i16, i16* %8
%10 = getelementptr inbounds i16, i16* %4, i64 10000000
store i16 %9, i16* %10
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ notifyEvent(char *, int, int /*<<< orphan*/,
                               int /*<<< orphan*/);
void sesc_memfence(int vaddr) { notifyEvent("sesc_memfence", vaddr, 0, 0); }


x86 assembly (clang, -O0):
<sesc_memfence>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <notifyEvent@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sesc_memfence>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <notifyEvent@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"sesc_memfence\00"
define void @sesc_memfence(i32 %0) {
%2 = tail call i32 @notifyEvent(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0, i32 0, i32 0)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int round_up(int, int);
uint32_t graph_nverts(size_t nkeys, int r) {
  uint32_t nverts =
      (r == 2) ? 2 * nkeys + (nkeys + 7) / 8 : 1 * nkeys + (nkeys + 3) / 4;
  nverts = round_up(nverts, r);
  return nverts;
}


x86 assembly (clang, -O0):
<graph_nverts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    1149 <graph_nverts+0x39>
mov    -0x8(%rbp),%rax
shl    $0x1,%rax
mov    -0x8(%rbp),%rcx
add    $0x7,%rcx
shr    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
jmp    1164 <graph_nverts+0x54>
mov    -0x8(%rbp),%rax
shl    $0x0,%rax
mov    -0x8(%rbp),%rcx
add    $0x3,%rcx
shr    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <round_up@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graph_nverts>:
xor    %eax,%eax
cmp    $0x2,%esi
sete   %al
lea    (%rdi,%rax,4),%rdx
add    $0x3,%rdx
lea    0x2(%rax),%ecx
shr    %cl,%rdx
mov    %eax,%ecx
shl    %cl,%edi
add    %edx,%edi
jmp    1030 <round_up@plt>

LLVM IR (-O0):
define i32 @graph_nverts(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i64, i64* %3
%10 = mul i64 2, %9
%11 = load i64, i64* %3
%12 = add i64 %11, 7
%13 = udiv i64 %12, 8
%14 = add i64 %10, %13
br label %22
15: ; preds = %2
%16 = load i64, i64* %3
%17 = mul i64 1, %16
%18 = load i64, i64* %3
%19 = add i64 %18, 3
%20 = udiv i64 %19, 4
%21 = add i64 %17, %20
br label %22
22: ; preds = %15, %8
%23 = phi i64 [ %14, %8 ], [ %21, %15 ]
%24 = trunc i64 %23 to i32
store i32 %24, i32* %5
%25 = load i32, i32* %5
%26 = load i32, i32* %4
%27 = call i32 @round_up(i32 %25, i32 %26)
store i32 %27, i32* %5
%28 = load i32, i32* %5
ret i32 %28
}

LLVM IR (-O2):
define i32 @graph_nverts(i64 %0, i32 %1) {
%3 = icmp eq i32 %1, 2
%4 = select i1 %3, i64 7, i64 3
%5 = select i1 %3, i64 3, i64 2
%6 = zext i1 %3 to i64
%7 = shl i64 %0, %6
%8 = add i64 %4, %0
%9 = lshr i64 %8, %5
%10 = add i64 %9, %7
%11 = trunc i64 %10 to i32
%12 = tail call i32 @round_up(i32 %11, i32 %1)
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int main() {
  fputc('!', stderr);
  fputc('\n', stderr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
mov    $0x21,%edi
call   1030 <fputc@plt>
mov    0x2eb2(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%esi
mov    $0x21,%edi
call   1030 <fputc@plt>
mov    (%rbx),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputc(i8 signext 33, i32 %1)
%3 = load i32, i32* @stderr
%4 = call i32 @fputc(i8 signext 10, i32 %3)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
define i32 @main() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputc(i8 signext 33, i32 %1)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fputc(i8 signext 10, i32 %3)
ret i32 0
}
long double test5l(long double x) { return __builtin_logl(x); }


x86 assembly (clang, -O0):
<test5l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <logl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5l>:
jmp    1030 <logl@plt>

LLVM IR (-O0):
define x86_fp80 @test5l(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @logl(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define x86_fp80 @test5l(x86_fp80 %0) {
%2 = tail call x86_fp80 @logl(x86_fp80 %0)
ret x86_fp80 %2
}
int get_b_link(const int *mem, int header) { return (mem[header + 2]); }


x86 assembly (clang, -O0):
<get_b_link>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_b_link>:
movslq %esi,%rax
mov    0x8(%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @get_b_link(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 = add nsw i32 %6, 2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %5, i64 %8
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @get_b_link(i32* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, 2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}
/* Variables and functions */
int rand();
int getRandomNumber(int max) { return (rand() % max) + 1; }


x86 assembly (clang, -O0):
<getRandomNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandomNumber>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getRandomNumber(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @rand()
%4 = load i32, i32* %2
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @getRandomNumber(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
%4 = add nsw i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, char, int);
char *charSetMemAtIndex(char *pt, char c, int n) {
  memset(pt, c, n);
  pt = (char *)pt + n;
  return pt;
}


x86 assembly (clang, -O0):
<charSetMemAtIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
mov    -0x10(%rbp),%edx
movsbl %al,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charSetMemAtIndex>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rdi,%r14
call   1030 <memset@plt>
movslq %ebx,%rax
add    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @charSetMemAtIndex(i8* %0, i8 signext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
store i8* %0, i8** %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i8, i8* %5
%9 = load i32, i32* %6
%10 = call i32 @memset(i8* %7, i8 signext %8, i32 %9)
%11 = load i8*, i8** %4
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8* %14, i8** %4
%15 = load i8*, i8** %4
ret i8* %15
}

LLVM IR (-O2):
define i8* @charSetMemAtIndex(i8* %0, i8 signext %1, i32 %2) {
%4 = tail call i32 @memset(i8* %0, i8 signext %1, i32 %2)
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
ret i8* %6
}
void enable_ints(void) { __asm__ volatile("sti" : : : "cc"); }


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

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

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

LLVM IR (-O2):
define void @enable_ints() {
tail call void asm sideeffect "sti", "~{cc},~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ allLexicographic(char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char str[] = "ABC";
  printf("All permutations with repetition of %s are: \n", str);
  allLexicographic(str);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x8(%rbp),%rdi
call   1050 <allLexicographic@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x434241,0xc(%rsp)
lea    0xebc(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1050 <allLexicographic@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [4 x i8] c"ABC\00"
@.str = [46 x i8] c"All permutations with repetition of %s are: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
store i32 0, i32* %1
%3 = bitcast [4 x i8]* %2 to i8*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%7 = call i32 @allLexicographic(i8* %6)
%8 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"All permutations with repetition of %s are: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 4407873, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @allLexicographic(i8* %2)
%5 = call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ myJSFunc();
int add(int x, int y) {
  myJSFunc();
  return x + y;
}


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

x86 assembly (clang, -O2):
<add>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <myJSFunc@plt>
add    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @add(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 (...) @myJSFunc()
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
%3 = tail call i32 (...) @myJSFunc()
%4 = add nsw i32 %1, %0
ret i32 %4
}
/* Variables and functions */
void *calloc(size_t, size_t);
void *mbedtls_calloc_wrap(size_t n, size_t sz) { return calloc(n, sz); }


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

x86 assembly (clang, -O2):
<mbedtls_calloc_wrap>:
jmp    1030 <calloc@plt>

LLVM IR (-O0):
define i8* @mbedtls_calloc_wrap(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* @calloc(i64 %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @mbedtls_calloc_wrap(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ main_clk_init();
int /*<<< orphan*/ pll_init();
int /*<<< orphan*/ sys_clk_init();
void clk_init() {
  pll_init();
  main_clk_init();
  sys_clk_init();
}


x86 assembly (clang, -O0):
<clk_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <pll_init@plt>
mov    $0x0,%al
call   1040 <main_clk_init@plt>
mov    $0x0,%al
call   1030 <sys_clk_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clk_init>:
push   %rax
xor    %eax,%eax
call   1050 <pll_init@plt>
xor    %eax,%eax
call   1040 <main_clk_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <sys_clk_init@plt>

LLVM IR (-O0):
define void @clk_init() {
%1 = call i32 (...) @pll_init()
%2 = call i32 (...) @main_clk_init()
%3 = call i32 (...) @sys_clk_init()
ret void
}

LLVM IR (-O2):
define void @clk_init() {
%1 = tail call i32 (...) @pll_init()
%2 = tail call i32 (...) @main_clk_init()
%3 = tail call i32 (...) @sys_clk_init()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void StartSwitch2(FILE *fh) {
  fprintf(fh, "Opcode = R.InterruptVectorBase;\r\n");
  fprintf(fh, "Opcode = Opcode & 0x0ff;\r\n");
  fprintf(fh, "switch (Opcode)\r\n");
  fprintf(fh, "{\r\n");
}


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

x86 assembly (clang, -O2):
<StartSwitch2>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    $0x21,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xeee(%rip),%rdi
mov    $0x1a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xef0(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xee9(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"Opcode = R.InterruptVectorBase;\0D\0A\00"
@.str.1 = [27 x i8] c"Opcode = Opcode & 0x0ff;\0D\0A\00"
@.str.2 = [18 x i8] c"switch (Opcode)\0D\0A\00"
@.str.3 = [4 x i8] c"{\0D\0A\00"
define void @StartSwitch2(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%7 = load i32*, i32** %2
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%9 = load i32*, i32** %2
%10 = call i32 @fprintf(i32* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Opcode = R.InterruptVectorBase;\0D\0A\00"
@.str.1 = [27 x i8] c"Opcode = Opcode & 0x0ff;\0D\0A\00"
@.str.2 = [18 x i8] c"switch (Opcode)\0D\0A\00"
@.str.3 = [4 x i8] c"{\0D\0A\00"
define void @StartSwitch2(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i64 33, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 26, i64 1, i32* %0)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 17, i64 1, i32* %0)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i64 3, i64 1, i32* %0)
ret void
}
int fixed_point_sub(int x, int y) { return x - y; }


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

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

LLVM IR (-O0):
define i32 @fixed_point_sub(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @fixed_point_sub(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ SIGCHLD;
int /*<<< orphan*/ SYS_clone;
int syscall6(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
             int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
             int /*<<< orphan*/);
int sys_fork() { return syscall6(SYS_clone, SIGCHLD, 0, 0, 0, 0, 0); }


x86 assembly (clang, -O0):
<sys_fork>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1030 <syscall6@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_fork>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
movl   $0x0,(%rsp)
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <syscall6@plt>
pop    %rcx
ret

LLVM IR (-O0):
@SYS_clone = global i32 0
@SIGCHLD = global i32 0
define i32 @sys_fork() {
%1 = load i32, i32* @SYS_clone
%2 = load i32, i32* @SIGCHLD
%3 = call i32 @syscall6(i32 %1, i32 %2, i32 0, i32 0, i32 0, i32 0, i32 0)
ret i32 %3
}

LLVM IR (-O2):
@SYS_clone = global i32 0
@SIGCHLD = global i32 0
define i32 @sys_fork() {
%1 = load i32, i32* @SYS_clone
%2 = load i32, i32* @SIGCHLD
%3 = tail call i32 @syscall6(i32 %1, i32 %2, i32 0, i32 0, i32 0, i32 0, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ srandom(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void seed_rng(void) { srandom(time(NULL)); }


x86 assembly (clang, -O0):
<seed_rng>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srandom@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<seed_rng>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <srandom@plt>

LLVM IR (-O0):
define void @seed_rng() {
%1 = call i32 @time(i32* null)
%2 = call i32 @srandom(i32 %1)
ret void
}

LLVM IR (-O2):
define void @seed_rng() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srandom(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int a = 2, b = 1;
  int c = a + b;
  printf("%d\n", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _string_upper_element(char *);
int /*<<< orphan*/ string_is_empty(char *);
int /*<<< orphan*/ string_to_lower(char *);
int strlen(char *);
void string_capitalized(char *text) {
  if (!string_is_empty(text)) {
    _string_upper_element(text);
    if (strlen(text) >= 2) {
      string_to_lower(&text[1]);
    }
  }
}


x86 assembly (clang, -O0):
<string_capitalized>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <string_is_empty@plt>
cmp    $0x0,%eax
jne    118b <string_capitalized+0x4b>
mov    -0x8(%rbp),%rdi
call   1060 <_string_upper_element@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     1186 <string_capitalized+0x46>
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1040 <string_to_lower@plt>
jmp    118b <string_capitalized+0x4b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_capitalized>:
push   %rbx
mov    %rdi,%rbx
call   1050 <string_is_empty@plt>
test   %eax,%eax
jne    116f <string_capitalized+0x2f>
mov    %rbx,%rdi
call   1060 <_string_upper_element@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     116f <string_capitalized+0x2f>
add    $0x1,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <string_to_lower@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @string_capitalized(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @string_is_empty(i8* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @_string_upper_element(i8* %7)
%9 = load i8*, i8** %2
%10 = call i32 @strlen(i8* %9)
%11 = icmp sge i32 %10, 2
br i1 %11, label %12, label %16
12: ; preds = %6
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = call i32 @string_to_lower(i8* %14)
br label %16
16: ; preds = %12, %6
br label %17
17: ; preds = %16, %1
ret void
}

LLVM IR (-O2):
define void @string_capitalized(i8* %0) {
%2 = tail call i32 @string_is_empty(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %11
4: ; preds = %1
%5 = tail call i32 @_string_upper_element(i8* %0)
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = tail call i32 @string_to_lower(i8* %9)
br label %11
11: ; preds = %4, %8, %1
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void pwm_enable_clk(void) {
  volatile uint32_t *addr = (uint32_t *)(0x01c14000 + 0x180);
  uint32_t reg = *addr;
  reg |= (1 << 12);
  *addr = reg;
}


x86 assembly (clang, -O0):
<pwm_enable_clk>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1c14180,%eax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
or     $0x1000,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pwm_enable_clk>:
orl    $0x1000,0x1c14180
ret

LLVM IR (-O0):
define void @pwm_enable_clk() {
%1 = alloca i32*
%2 = alloca i32
store i32* inttoptr (i64 29442432 to i32*), i32** %1
%3 = load i32*, i32** %1
%4 = load volatile i32, i32* %3
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = or i32 %5, 4096
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = load i32*, i32** %1
store volatile i32 %7, i32* %8
ret void
}

LLVM IR (-O2):
define void @pwm_enable_clk() {
%1 = load volatile i32, i32* inttoptr (i64 29442432 to i32*)
%2 = or i32 %1, 4096
store volatile i32 %2, i32* inttoptr (i64 29442432 to i32*)
ret void
}
void XDrawPoint() {}


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

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

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

LLVM IR (-O2):
define void @XDrawPoint() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ uart_send_str(char *);
void terminate_kernel() {
  uart_send_str(">>>> ");
  uart_send_str("Exit kernel\n");
  ;
}


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

x86 assembly (clang, -O2):
<terminate_kernel>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <uart_send_str@plt>
lea    0xee2(%rip),%rdi
pop    %rax
jmp    1030 <uart_send_str@plt>

LLVM IR (-O0):
@.str = [6 x i8] c">>>> \00"
@.str.1 = [13 x i8] c"Exit kernel\0A\00"
define void @terminate_kernel() {
%1 = call i32 @uart_send_str(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @uart_send_str(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c">>>> \00"
@.str.1 = [13 x i8] c"Exit kernel\0A\00"
define void @terminate_kernel() {
%1 = tail call i32 @uart_send_str(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @uart_send_str(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void swapF(double *a, double *b) {
  double temp = *a;
  *a = *b;
  *b = temp;
}


x86 assembly (clang, -O0):
<swapF>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapF>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
movsd  %xmm1,(%rdi)
movsd  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @swapF(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %3
%7 = load double, double* %6
store double %7, double* %5
%8 = load double*, double** %4
%9 = load double, double* %8
%10 = load double*, double** %3
store double %9, double* %10
%11 = load double, double* %5
%12 = load double*, double** %4
store double %11, double* %12
ret void
}

LLVM IR (-O2):
define void @swapF(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
store double %4, double* %0
store double %3, double* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ asprintf(char **, char *, char *, char *, char *, char *);
int /*<<< orphan*/ rename(char *, char *);
void mv_file(char *username, char *filename, char *cwd_n_file) {
  char *dirfile = "/.local/share/Trash/files/";
  asprintf(&dirfile, "%s%s%s%s", "/home/", username, dirfile, filename);
  rename(cwd_n_file, dirfile);
}


x86 assembly (clang, -O0):
<mv_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xec5(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    -0x20(%rbp),%rdi
lea    0xec5(%rip),%rsi
lea    0xec7(%rip),%rdx
call   1030 <asprintf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <rename@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mv_file>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r9
mov    %rdi,%rcx
lea    0xecb(%rip),%r8
mov    %r8,0x8(%rsp)
lea    0xeda(%rip),%rsi
lea    0xedc(%rip),%rdx
lea    0x8(%rsp),%rdi
call   1030 <asprintf@plt>
mov    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <rename@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"/.local/share/Trash/files/\00"
@.str.1 = [9 x i8] c"%s%s%s%s\00"
@.str.2 = [7 x i8] c"/home/\00"
define void @mv_file(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %7
%8 = load i8*, i8** %4
%9 = load i8*, i8** %7
%10 = load i8*, i8** %5
%11 = call i32 @asprintf(i8** %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = call i32 @rename(i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"/.local/share/Trash/files/\00"
@.str.1 = [9 x i8] c"%s%s%s%s\00"
@.str.2 = [7 x i8] c"/home/\00"
define void @mv_file(i8* %0, i8* %1, i8* nocapture %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8** %4
%6 = call i32 @asprintf(i8** %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %1)
%7 = load i8*, i8** %4
%8 = call i32 @rename(i8* %2, i8* %7)
ret void
}
/* Variables and functions */
bool is_full_tariff(int hour) {
  return (hour >= 8 && hour < 23) ? true : false;
}


x86 assembly (clang, -O0):
<is_full_tariff>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x8,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <is_full_tariff+0x20>
cmpl   $0x17,-0x4(%rbp)
setl   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_full_tariff>:
add    $0xfffffff8,%edi
xor    %eax,%eax
cmp    $0xf,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @is_full_tariff(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 8
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 23
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 1, i32 0
ret i32 %11
}

LLVM IR (-O2):
define i32 @is_full_tariff(i32 %0) {
%2 = add i32 %0, -8
%3 = icmp ult i32 %2, 15
%4 = zext i1 %3 to i32
ret i32 %4
}
void INT_Excep_SCI7_TEI7(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_SCI7_TEI7() {
ret void
}
void doNotRunMe(const void *vp) { return; }


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

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

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

LLVM IR (-O2):
define void @doNotRunMe(i8* nocapture %0) {
ret void
}
plus(i) { return i + 1; }


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

x86 assembly (clang, -O2):
<plus>:
lea    0x1(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @plus(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
ret i32 %4
}

LLVM IR (-O2):
define i32 @plus(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x63() {
  Assert_real((isspace(99) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              500, ("isspace should be 0 for c"));
}


x86 assembly (clang, -O0):
<t_isspace_0x63>:
push   %rbp
mov    %rsp,%rbp
mov    $0x63,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x1f4,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0x63>:
push   %rax
mov    $0x63,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x1f4,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for c\00"
define void @t_isspace_0x63() {
%1 = call i64 @isspace(i32 99)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [26 x i8] c"isspace should be 0 for c\00"
define void @t_isspace_0x63() {
%1 = tail call i64 @isspace(i32 99)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 500, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ core7_swap(char *, int);
void U_EMRSETBRUSHORGEX_swap(char *record, int torev) {
  core7_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_EMRSETBRUSHORGEX_swap>:
jmp    1030 <core7_swap@plt>

LLVM IR (-O0):
define void @U_EMRSETBRUSHORGEX_swap(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 @core7_swap(i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @U_EMRSETBRUSHORGEX_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core7_swap(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int get_clock_rate(int);
int get_speed() {
  static int speed = 0;
  if (!speed) {
    speed = get_clock_rate(0x000000003) / 1000000;
  }
  return speed;
}


x86 assembly (clang, -O0):
<get_speed>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x0,0x2f11(%rip)
jne    1139 <get_speed+0x29>
mov    $0x3,%edi
call   1030 <get_clock_rate@plt>
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,0x2ef3(%rip)
mov    0x2eed(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_speed>:
push   %rax
mov    0x2f15(%rip),%eax
test   %eax,%eax
je     111d <get_speed+0xd>
pop    %rcx
ret
mov    $0x3,%edi
call   1030 <get_clock_rate@plt>
cltq
imul   $0x431bde83,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
mov    %eax,0x2ee9(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@get_speed.speed = internal global i32 0
define i32 @get_speed() {
%1 = load i32, i32* @get_speed.speed
%2 = icmp ne i32 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = call i32 @get_clock_rate(i32 3)
%5 = sdiv i32 %4, 1000000
store i32 %5, i32* @get_speed.speed
br label %6
6: ; preds = %3, %0
%7 = load i32, i32* @get_speed.speed
ret i32 %7
}

LLVM IR (-O2):
@get_speed.speed = internal unnamed_addr global i32 0
define i32 @get_speed() {
%1 = load i32, i32* @get_speed.speed
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @get_clock_rate(i32 3)
%5 = sdiv i32 %4, 1000000
store i32 %5, i32* @get_speed.speed
br label %6
6: ; preds = %3, %0
%7 = phi i32 [ %5, %3 ], [ %1, %0 ]
ret i32 %7
}
_Noreturn void testerr(void) { exit(1); }


x86 assembly (clang, -O0):
<testerr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<testerr>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @testerr() {
unreachable
}

LLVM IR (-O2):
define void @testerr() {
tail call void @exit(i32 1)
unreachable
}