xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ drawInConsole();
int /*<<< orphan*/ getTime();
int /*<<< orphan*/ initFrameBuffer();
int main() {
  getTime();
  initFrameBuffer();
  drawInConsole();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <getTime@plt>
mov    $0x0,%al
call   1030 <initFrameBuffer@plt>
mov    $0x0,%al
call   1050 <drawInConsole@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @getTime()
%2 = call i32 (...) @initFrameBuffer()
%3 = call i32 (...) @drawInConsole()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @getTime()
%2 = tail call i32 (...) @initFrameBuffer()
%3 = tail call i32 (...) @drawInConsole()
ret i32 0
}
/* Variables and functions */
int daemon(int, int);
int mx_daemon(int nochdir, int noclose) { return daemon(nochdir, noclose); }


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

x86 assembly (clang, -O2):
<mx_daemon>:
jmp    1030 <daemon@plt>

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

LLVM IR (-O2):
define i32 @mx_daemon(i32 %0, i32 %1) {
%3 = tail call i32 @daemon(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
void *stb__realloc_raw(int /*<<< orphan*/, int);
void *stb__nptr_alloc(int size) { return stb__realloc_raw(0, size); }


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

x86 assembly (clang, -O2):
<stb__nptr_alloc>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <stb__realloc_raw@plt>

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

LLVM IR (-O2):
define i8* @stb__nptr_alloc(i32 %0) {
%2 = tail call i8* @stb__realloc_raw(i32 0, i32 %0)
ret i8* %2
}
void *f(void *x) {
  long y = (long)x;
  return (void *)(y * y);
}


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

x86 assembly (clang, -O2):
<f>:
mov    %rdi,%rax
imul   %rdi,%rax
ret

LLVM IR (-O0):
define i8* @f(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = load i64, i64* %3
%8 = mul nsw i64 %6, %7
%9 = inttoptr i64 %8 to i8*
ret i8* %9
}

LLVM IR (-O2):
define i8* @f(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = mul nsw i64 %2, %2
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
void set_dtLt(double fac) {
  int j;
  return;
}


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

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

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

LLVM IR (-O2):
define void @set_dtLt(double %0) {
ret void
}
/* Type definitions */
typedef scalar_t__ uid_t;

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int __syscall_setuid(scalar_t__);
int setuid(uid_t uid) {
  if (uid == (uid_t)~0 || uid != (uid_t)((int)uid)) {
    __set_errno(EINVAL);
    return -1;
  }
  return (__syscall_setuid(uid));
}


x86 assembly (clang, -O0):
<setuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0xffffffffffffffff,-0x10(%rbp)
je     114b <setuid+0x2b>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq %ecx,%rcx
cmp    %rcx,%rax
je     1165 <setuid+0x45>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <setuid+0x51>
mov    -0x10(%rbp),%rdi
call   1040 <__syscall_setuid@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setuid>:
cmp    $0xffffffffffffffff,%rdi
je     113a <setuid+0x1a>
mov    %rdi,%rax
sub    $0xffffffff80000000,%rax
shr    $0x20,%rax
jne    113a <setuid+0x1a>
jmp    1040 <__syscall_setuid@plt>
push   %rax
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @setuid(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, -1
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = load i64, i64* %3
%8 = load i64, i64* %3
%9 = trunc i64 %8 to i32
%10 = sext i32 %9 to i64
%11 = icmp ne i64 %7, %10
br i1 %11, label %12, label %15
12: ; preds = %6, %1
%13 = load i32, i32* @EINVAL
%14 = call i32 @__set_errno(i32 %13)
store i32 -1, i32* %2
br label %18
15: ; preds = %6
%16 = load i64, i64* %3
%17 = call i32 @__syscall_setuid(i64 %16)
store i32 %17, i32* %2
br label %18
18: ; preds = %15, %12
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @setuid(i64 %0) {
%2 = icmp ne i64 %0, -1
%3 = add i64 %0, 2147483648
%4 = icmp ult i64 %3, 4294967296
%5 = and i1 %2, %4
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* @EINVAL
%8 = tail call i32 @__set_errno(i32 %7)
br label %11
9: ; preds = %1
%10 = tail call i32 @__syscall_setuid(i64 %0)
br label %11
11: ; preds = %9, %6
%12 = phi i32 [ -1, %6 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
void drawOval(int x, int y, int width, int height) {
  printf("DO %i %i %i %i\n", x, y, width, height);
}


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"DO %i %i %i %i\0A\00"
define void @drawOval(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) { printf("Hello world\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void RTco_wait(__attribute__((unused)) int sid) {}


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

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

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

LLVM IR (-O2):
define void @RTco_wait(i32 %0) {
ret void
}
unsigned long int elf_hash(string) const char *string;
{ return _dl_elf_hash(string); }


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

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

LLVM IR (-O0):
define i64 @elf_hash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @_dl_elf_hash to i32 (i8*, ...)*)(i8* %3)
%5 = sext i32 %4 to i64
ret i64 %5
}

LLVM IR (-O2):
define i64 @elf_hash(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @_dl_elf_hash to i32 (i8*, ...)*)(i8* %0)
%3 = sext i32 %2 to i64
ret i64 %3
}
void av_malloc() {}


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

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

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

LLVM IR (-O2):
define void @av_malloc() {
ret void
}
/* Variables and functions */
void *av_realloc(void *, unsigned int);
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) {
  if (min_size < *size)
    return ptr;
  *size = 17 * min_size / 16 + 32;
  return av_realloc(ptr, *size);
}


x86 assembly (clang, -O0):
<av_fast_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jae    113f <av_fast_realloc+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1162 <av_fast_realloc+0x52>
imul   $0x11,-0x1c(%rbp),%ecx
shr    $0x4,%ecx
add    $0x20,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
call   1030 <av_realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<av_fast_realloc>:
cmp    %edx,(%rsi)
jbe    1118 <av_fast_realloc+0x8>
mov    %rdi,%rax
ret
mov    %edx,%eax
shl    $0x4,%eax
add    %edx,%eax
shr    $0x4,%eax
add    $0x20,%eax
mov    %eax,(%rsi)
mov    %eax,%esi
jmp    1030 <av_realloc@plt>

LLVM IR (-O0):
define i8* @av_fast_realloc(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
%11 = icmp ult i32 %8, %10
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load i8*, i8** %5
store i8* %13, i8** %4
br label %24
14: ; preds = %3
%15 = load i32, i32* %7
%16 = mul i32 17, %15
%17 = udiv i32 %16, 16
%18 = add i32 %17, 32
%19 = load i32*, i32** %6
store i32 %18, i32* %19
%20 = load i8*, i8** %5
%21 = load i32*, i32** %6
%22 = load i32, i32* %21
%23 = call i8* @av_realloc(i8* %20, i32 %22)
store i8* %23, i8** %4
br label %24
24: ; preds = %14, %12
%25 = load i8*, i8** %4
ret i8* %25
}

LLVM IR (-O2):
define i8* @av_fast_realloc(i8* %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %1
%5 = icmp ugt i32 %4, %2
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = mul i32 %2, 17
%8 = lshr i32 %7, 4
%9 = add nuw nsw i32 %8, 32
store i32 %9, i32* %1
%10 = tail call i8* @av_realloc(i8* %0, i32 %9)
br label %11
11: ; preds = %3, %6
%12 = phi i8* [ %10, %6 ], [ %0, %3 ]
ret i8* %12
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int /*<<< orphan*/ *);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ log_error(int, char *);
int pthread_mutex_destroy(int /*<<< orphan*/ *);
void mutexDestroy(pthread_mutex_t *mutex) {
  ASSERT(mutex);
  int r = pthread_mutex_destroy(mutex);
  if (r != 0) {
    log_error(r, "Error pthread_mutex_destroy()");
    abort();
  }
}


x86 assembly (clang, -O0):
<mutexDestroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <ASSERT@plt>
mov    -0x8(%rbp),%rdi
call   1050 <pthread_mutex_destroy@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1181 <mutexDestroy+0x41>
mov    -0xc(%rbp),%edi
lea    0xe8b(%rip),%rsi
call   1040 <log_error@plt>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mutexDestroy>:
push   %rbx
mov    %rdi,%rbx
call   1060 <ASSERT@plt>
mov    %rbx,%rdi
call   1050 <pthread_mutex_destroy@plt>
test   %eax,%eax
jne    1157 <mutexDestroy+0x17>
pop    %rbx
ret
lea    0xea2(%rip),%rsi
mov    %eax,%edi
call   1040 <log_error@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
@.str = [30 x i8] c"Error pthread_mutex_destroy()\00"
define void @mutexDestroy(i32* %0) {
%2 = tail call i32 @ASSERT(i32* %0)
%3 = tail call i32 @pthread_mutex_destroy(i32* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = tail call i32 @log_error(i32 %3, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret void
}
void CIntBin(int *p, int target) {
  if (target == 1) {
    *p = 1;
  } else {
    *p = target % 2;
    CIntBin(--p, (int)(target / 2));
  }
}


x86 assembly (clang, -O0):
<CIntBin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1138 <CIntBin+0x28>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
jmp    1167 <CIntBin+0x57>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
mov    %edx,(%rax)
mov    -0x8(%rbp),%rdi
add    $0xfffffffffffffffc,%rdi
mov    %rdi,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
call   1030 <CIntBin@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CIntBin>:
cmp    $0x1,%esi
je     1130 <CIntBin+0x30>
mov    %esi,%eax
nopw   0x0(%rax,%rax,1)
shr    $0x1f,%eax
add    %esi,%eax
mov    %eax,%ecx
and    $0xfffffffe,%ecx
mov    %esi,%edx
sub    %ecx,%edx
mov    %edx,(%rdi)
add    $0xfffffffffffffffc,%rdi
sar    %eax
and    $0xfffffffe,%esi
cmp    $0x2,%esi
mov    %eax,%esi
jne    1110 <CIntBin+0x10>
movl   $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @CIntBin(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32*, i32** %3
store i32 1, i32* %8
br label %17
9: ; preds = %2
%10 = load i32, i32* %4
%11 = srem i32 %10, 2
%12 = load i32*, i32** %3
store i32 %11, i32* %12
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i32 -1
store i32* %14, i32** %3
%15 = load i32, i32* %4
%16 = sdiv i32 %15, 2
br label %17
17: ; preds = %9, %7
ret void
}

LLVM IR (-O2):
define void @CIntBin(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 1
br i1 %3, label %4, label %6
4: ; preds = %6, %2
%5 = phi i32* [ %0, %2 ], [ %10, %6 ]
store i32 1, i32* %5
ret void
6: ; preds = %2, %6
%7 = phi i32 [ %11, %6 ], [ %1, %2 ]
%8 = phi i32* [ %10, %6 ], [ %0, %2 ]
%9 = srem i32 %7, 2
store i32 %9, i32* %8
%10 = getelementptr inbounds i32, i32* %8, i64 -1
%11 = sdiv i32 %7, 2
%12 = and i32 %7, -2
%13 = icmp eq i32 %12, 2
br i1 %13, label %4, label %6
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
void gpio_init_pad(volatile uint32_t *regp) {
  uint32_t reg;
  reg = *regp;
  do {
    (reg) &= ~((~(~0u << (12 - 12 + 1))) << (12));
    (reg) |= (0 << 12);
  } while (0);
  do {
    (reg) &= ~((~(~0u << (11 - 11 + 1))) << (11));
    (reg) |= (0 << 11);
  } while (0);
  do {
    (reg) &= ~((~(~0u << (5 - 3 + 1))) << (3));
    (reg) |= (3 << 3);
  } while (0);
  *regp = reg;
}


x86 assembly (clang, -O0):
<gpio_init_pad>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xffffefff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
or     $0x0,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <gpio_init_pad+0x2a>
mov    -0xc(%rbp),%eax
and    $0xfffff7ff,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
or     $0x0,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <gpio_init_pad+0x43>
mov    -0xc(%rbp),%eax
and    $0xffffffc7,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
or     $0x18,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_init_pad>:
mov    $0xffffe7c7,%eax
and    (%rdi),%eax
or     $0x18,%eax
mov    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @gpio_init_pad(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = load volatile i32, i32* %4
store i32 %5, i32* %3
br label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = and i32 %7, -4097
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = or i32 %9, 0
store i32 %10, i32* %3
br label %11
11: ; preds = %6
br label %12
12: ; preds = %11
%13 = load i32, i32* %3
%14 = and i32 %13, -2049
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = or i32 %15, 0
store i32 %16, i32* %3
br label %17
17: ; preds = %12
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = and i32 %19, -57
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = or i32 %21, 24
store i32 %22, i32* %3
br label %23
23: ; preds = %18
%24 = load i32, i32* %3
%25 = load i32*, i32** %2
store volatile i32 %24, i32* %25
ret void
}

LLVM IR (-O2):
define void @gpio_init_pad(i32* %0) {
%2 = load volatile i32, i32* %0
%3 = and i32 %2, -6201
%4 = or i32 %3, 24
store volatile i32 %4, i32* %0
ret void
}
int __xap_ap_free(int fd, unsigned long kind, void *val,
                  unsigned long *aperrno_p) {}


x86 assembly (clang, -O0):
<__xap_ap_free>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @__xap_ap_free(i32 %0, i64 %1, i8* nocapture readnone %2, i64* nocapture readnone %3) {
ret i32 undef
}
/* Type definitions */
struct stat {
  int st_size;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
int fsize(char *path) {
  struct stat buf;
  if (stat(path, &buf)) {
    return 0;
  } else {
    return buf.st_size;
  }
}


x86 assembly (clang, -O0):
<fsize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113f <fsize+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1145 <fsize+0x35>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsize>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1126 <fsize+0x16>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @fsize(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %12
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
store i32 %11, i32* %2
br label %12
12: ; preds = %9, %8
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @fsize(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = select i1 %5, i32 %7, i32 0
ret i32 %8
}
/* Variables and functions */
int ___sl_get_nondet_int();
int /*<<< orphan*/ strlen(char const *);
int strcmp(char const *__s1, char const *__s2) {
  int tmp;
  {
    {
      strlen(__s1);
      strlen(__s2);
      tmp = ___sl_get_nondet_int();
    }
    return (tmp);
  }
}


x86 assembly (clang, -O0):
<strcmp>:
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    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    $0x0,%al
call   1040 <___sl_get_nondet_int@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
push   %rbx
mov    %rsi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <___sl_get_nondet_int@plt>

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

LLVM IR (-O2):
define i32 @strcmp(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i32 (...) @___sl_get_nondet_int()
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ populateCQ(int *);
void initializeCQ(int CQ[], int *front, int *rear) {
  *front = -1;
  *rear = -1;
  populateCQ(CQ);
}


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

x86 assembly (clang, -O2):
<initializeCQ>:
movl   $0xffffffff,(%rsi)
movl   $0xffffffff,(%rdx)
jmp    1030 <populateCQ@plt>

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

LLVM IR (-O2):
define void @initializeCQ(i32* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
store i32 -1, i32* %1
store i32 -1, i32* %2
%4 = tail call i32 @populateCQ(i32* %0)
ret void
}
void isakmp_ph1delete_stub(p) void *p;
{ isakmp_ph1delete((struct ph1handle *)p); }


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

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

LLVM IR (-O0):
%struct.ph1handle = type opaque
define void @isakmp_ph1delete_stub(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.ph1handle*
%5 = call i32 (%struct.ph1handle*, ...) bitcast (i32 (...)* @isakmp_ph1delete to i32 (%struct.ph1handle*, ...)*)(%struct.ph1handle* %4)
ret void
}

LLVM IR (-O2):
%struct.ph1handle = type opaque
define void @isakmp_ph1delete_stub(i8* %0) {
%2 = bitcast i8* %0 to %struct.ph1handle*
%3 = tail call i32 (%struct.ph1handle*, ...) bitcast (i32 (...)* @isakmp_ph1delete to i32 (%struct.ph1handle*, ...)*)(%struct.ph1handle* %2)
ret void
}
int lower(int c) { return (c >= 'A' && c <= 'Z') ? c + 'a' - 'A' : c; }


x86 assembly (clang, -O0):
<lower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x41,-0x4(%rbp)
jl     112c <lower+0x2c>
cmpl   $0x5a,-0x4(%rbp)
jg     112c <lower+0x2c>
mov    -0x4(%rbp),%eax
add    $0x61,%eax
sub    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <lower+0x32>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @lower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 65
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 90
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 97
%11 = sub nsw i32 %10, 65
br label %14
12: ; preds = %5, %1
%13 = load i32, i32* %2
br label %14
14: ; preds = %12, %8
%15 = phi i32 [ %11, %8 ], [ %13, %12 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @lower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
void shift_l(char *s) {
  while ((s[0] = s[1]))
    ++s;
}


x86 assembly (clang, -O0):
<shift_l>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     112e <shift_l+0x2e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <shift_l+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<shift_l>:
add    $0x1,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rdi),%eax
mov    %al,-0x1(%rdi)
add    $0x1,%rdi
test   %al,%al
jne    1110 <shift_l+0x10>
ret

LLVM IR (-O0):
define void @shift_l(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %10, %1
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %5
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 %6, i8* %8
%9 = icmp ne i8 %6, 0
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @shift_l(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %4, %2 ]
%4 = getelementptr inbounds i8, i8* %3, i64 1
%5 = load i8, i8* %4
store i8 %5, i8* %3
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %2
7: ; preds = %2
ret void
}
int futex_available() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @futex_available() {
ret i32 1
}
__attribute__((always_)) void swapfloat(void *a, void *b) {
  float const t = *((float *)b);
  *((float *)b) = *((float *)a);
  *((float *)a) = t;
}


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

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

LLVM IR (-O0):
define void @swapfloat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca float
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to float*
%8 = load float, float* %7
store float %8, float* %5
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to float*
%11 = load float, float* %10
%12 = load i8*, i8** %4
%13 = bitcast i8* %12 to float*
store float %11, float* %13
%14 = load float, float* %5
%15 = load i8*, i8** %3
%16 = bitcast i8* %15 to float*
store float %14, float* %16
ret void
}

LLVM IR (-O2):
define void @swapfloat(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to float*
%4 = load float, float* %3
%5 = bitcast i8* %0 to float*
%6 = load float, float* %5
store float %6, float* %3
store float %4, float* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ signal(int /*<<< orphan*/, void (*)(int));
void handler(int sgn) {
  printf("NO!\n");
  signal(SIGINT, handler);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    0x2e99(%rip),%rsi
call   1040 <signal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
mov    0x2ea3(%rip),%rsi
pop    %rax
jmp    1040 <signal@plt>

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

LLVM IR (-O2):
@SIGINT = global i32 0
@str = [4 x i8] c"NO!\00"
define void @handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @SIGINT
%4 = tail call i32 @signal(i32 %3, void (i32)* @handler)
ret void
}
void MUSIC_SetSongPosition(int measure, int beat, int tick) {}


x86 assembly (clang, -O0):
<MUSIC_SetSongPosition>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @MUSIC_SetSongPosition(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
ret void
}

LLVM IR (-O2):
define void @MUSIC_SetSongPosition(i32 %0, i32 %1, i32 %2) {
ret void
}
char *setdec(char *s, unsigned int ui) {
  do {
    *--s = (ui % 10) + '0';
  } while (ui /= 10);
  return s;
}


x86 assembly (clang, -O0):
<setdec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,-0x1(%rax)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    110b <setdec+0xb>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setdec>:
mov    %rdi,%rax
mov    $0xcccccccd,%r8d
nopl   0x0(%rax)
mov    %esi,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%edi
lea    (%rdi,%rdi,4),%edi
mov    %esi,%ecx
sub    %edi,%ecx
or     $0x30,%cl
mov    %cl,-0x1(%rax)
add    $0xffffffffffffffff,%rax
cmp    $0x9,%esi
mov    %edx,%esi
ja     1110 <setdec+0x10>
ret

LLVM IR (-O0):
define i8* @setdec(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %12, %2
%6 = load i32, i32* %4
%7 = urem i32 %6, 10
%8 = add i32 %7, 48
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i32 -1
store i8* %11, i8** %3
store i8 %9, i8* %11
br label %12
12: ; preds = %5
%13 = load i32, i32* %4
%14 = udiv i32 %13, 10
store i32 %14, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %5, label %16
16: ; preds = %12
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
define i8* @setdec(i8* writeonly %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %9, %3 ]
%5 = phi i32 [ %1, %2 ], [ %10, %3 ]
%6 = urem i32 %5, 10
%7 = trunc i32 %6 to i8
%8 = or i8 %7, 48
%9 = getelementptr inbounds i8, i8* %4, i64 -1
store i8 %8, i8* %9
%10 = udiv i32 %5, 10
%11 = icmp ult i32 %5, 10
br i1 %11, label %12, label %3
12: ; preds = %3
ret i8* %9
}
int main() {
  int a = 9;
  int b = 9;
  int c = 9;
  int d = ((b * a) + (1 + c)) + c;
  int e = (a + c) * d;
  int f = c * a;
  d = c * e;
  e = c + f;
  f = (a + c) * e;
  for (; d;) {
    for (; e;) {
      for (; f;)
        ;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x9,-0x8(%rbp)
movl   $0x9,-0xc(%rbp)
movl   $0x9,-0x10(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
add    %ecx,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
imul   -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11a3 <main+0xa3>
jmp    117b <main+0x7b>
cmpl   $0x0,-0x18(%rbp)
je     119e <main+0x9e>
jmp    118a <main+0x8a>
cmpl   $0x0,-0x1c(%rbp)
je     1199 <main+0x99>
jmp    118a <main+0x8a>
jmp    117b <main+0x7b>
jmp    116c <main+0x6c>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 9, i32* %2
store i32 9, i32* %3
store i32 9, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = mul nsw i32 %8, %9
%11 = load i32, i32* %4
%12 = add nsw i32 1, %11
%13 = add nsw i32 %10, %12
%14 = load i32, i32* %4
%15 = add nsw i32 %13, %14
store i32 %15, i32* %5
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = add nsw i32 %16, %17
%19 = load i32, i32* %5
%20 = mul nsw i32 %18, %19
store i32 %20, i32* %6
%21 = load i32, i32* %4
%22 = load i32, i32* %2
%23 = mul nsw i32 %21, %22
store i32 %23, i32* %7
%24 = load i32, i32* %4
%25 = load i32, i32* %6
%26 = mul nsw i32 %24, %25
store i32 %26, i32* %5
%27 = load i32, i32* %4
%28 = load i32, i32* %7
%29 = add nsw i32 %27, %28
store i32 %29, i32* %6
%30 = load i32, i32* %2
%31 = load i32, i32* %4
%32 = add nsw i32 %30, %31
%33 = load i32, i32* %6
%34 = mul nsw i32 %32, %33
store i32 %34, i32* %7
br label %35
35: ; preds = %48, %0
%36 = load i32, i32* %5
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %49
38: ; preds = %35
br label %39
39: ; preds = %47, %38
%40 = load i32, i32* %6
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %48
42: ; preds = %39
br label %43
43: ; preds = %46, %42
%44 = load i32, i32* %7
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %43
br label %43
47: ; preds = %43
br label %39
48: ; preds = %39
br label %35
49: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int syscall(int, void *, unsigned long, char const *);
int init_module(void *a, unsigned long b, const char *c) {
  return syscall(128, a, b, c);
}


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

x86 assembly (clang, -O2):
<init_module>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x80,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @init_module(i8* %0, i64 %1, i8* %2) {
%4 = tail call i32 @syscall(i32 128, i8* %0, i64 %1, i8* %2)
ret i32 %4
}
double exp(double x __attribute__((unused))) { return 0.0; }


x86 assembly (clang, -O0):
<exp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<exp>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @exp(double %0) {
%2 = alloca double
store double %0, double* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @exp(double %0) {
ret double 0.000000e+00
}
void udelay(unsigned long x) {}


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

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

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

LLVM IR (-O2):
define void @udelay(i64 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ erase_and_free(void *);
void erase_and_freep(void *p) { erase_and_free(*(void **)p); }


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

x86 assembly (clang, -O2):
<erase_and_freep>:
mov    (%rdi),%rdi
jmp    1030 <erase_and_free@plt>

LLVM IR (-O0):
define void @erase_and_freep(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i8**
%5 = load i8*, i8** %4
%6 = call i32 @erase_and_free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @erase_and_freep(i8* nocapture %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
%4 = tail call i32 @erase_and_free(i8* %3)
ret void
}
get_3() { return 3; }


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

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

LLVM IR (-O0):
define i32 @get_3() {
ret i32 3
}

LLVM IR (-O2):
define i32 @get_3() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ alarm(unsigned int);
int send(int, char *, int, int /*<<< orphan*/);
int send_socket(int sock, char *buf, int size, unsigned int timeout) {
  int bytes_write = 0;
  alarm(timeout);
  bytes_write = send(sock, buf, size, 0);
  alarm(0);
  if (bytes_write <= 0)
    return (-1);
  return (bytes_write);
}


x86 assembly (clang, -O0):
<send_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <alarm@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %eax,-0x1c(%rbp)
xor    %edi,%edi
call   1040 <alarm@plt>
cmpl   $0x0,-0x1c(%rbp)
jg     1175 <send_socket+0x55>
movl   $0xffffffff,-0x4(%rbp)
jmp    117b <send_socket+0x5b>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_socket>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %ecx,%edi
call   1040 <alarm@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
xor    %ecx,%ecx
call   1030 <send@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1040 <alarm@plt>
test   %ebx,%ebx
mov    $0xffffffff,%eax
cmovg  %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @send_socket(i32 %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @alarm(i32 %3)
%6 = tail call i32 @send(i32 %0, i8* %1, i32 %2, i32 0)
%7 = tail call i32 @alarm(i32 0)
%8 = icmp slt i32 %6, 1
%9 = select i1 %8, i32 -1, i32 %6
ret i32 %9
}
int doubler(int x) { return x * 2; }


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

x86 assembly (clang, -O2):
<doubler>:
lea    (%rdi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @doubler(i32 %0) {
%2 = shl nsw i32 %0, 1
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ burnstack(int);
int /*<<< orphan*/ sign(int /*<<< orphan*/ *, int /*<<< orphan*/ const *,
                        int /*<<< orphan*/ const *, int /*<<< orphan*/ const *,
                        size_t);
void ed25519_sign(uint8_t sig[64], const uint8_t sec[32], const uint8_t pub[32],
                  const uint8_t *data, size_t len) {
  sign(sig, sec, pub, data, len);
  burnstack(4096);
}


x86 assembly (clang, -O0):
<ed25519_sign>:
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    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <sign@plt>
mov    $0x1000,%edi
call   1040 <burnstack@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ed25519_sign>:
push   %rax
call   1030 <sign@plt>
mov    $0x1000,%edi
pop    %rax
jmp    1040 <burnstack@plt>

LLVM IR (-O0):
define void @ed25519_sign(i32* %0, i32* %1, i32* %2, i32* %3, i64 %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i64
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i64 %4, i64* %10
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = load i32*, i32** %9
%15 = load i64, i64* %10
%16 = call i32 @sign(i32* %11, i32* %12, i32* %13, i32* %14, i64 %15)
%17 = call i32 @burnstack(i32 4096)
ret void
}

LLVM IR (-O2):
define void @ed25519_sign(i32* %0, i32* %1, i32* %2, i32* %3, i64 %4) {
%6 = tail call i32 @sign(i32* %0, i32* %1, i32* %2, i32* %3, i64 %4)
%7 = tail call i32 @burnstack(i32 4096)
ret void
}
unsigned int smp_processor_id(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @smp_processor_id() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *const);
int /*<<< orphan*/ stderr;
void err(const char *const msg) {
  fprintf(stderr, "%s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<err>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<err>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @err(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @err(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ PROT_READ;
int /*<<< orphan*/ __NR_mprotect;
int ppc_syscall(int /*<<< orphan*/, void *, unsigned int, int /*<<< orphan*/);
int ppc_mprotect_read(void *base, unsigned size) {
  return ppc_syscall(__NR_mprotect, base, size, PROT_READ);
}


x86 assembly (clang, -O0):
<ppc_mprotect_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    0x2ec2(%rip),%rax
mov    (%rax),%ecx
call   1030 <ppc_syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ppc_mprotect_read>:
mov    %esi,%edx
mov    %rdi,%rsi
mov    0x2ecc(%rip),%rax
mov    (%rax),%edi
mov    0x2ed3(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <ppc_syscall@plt>

LLVM IR (-O0):
@__NR_mprotect = global i32 0
@PROT_READ = global i32 0
define i32 @ppc_mprotect_read(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @__NR_mprotect
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = load i32, i32* @PROT_READ
%9 = call i32 @ppc_syscall(i32 %5, i8* %6, i32 %7, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
@__NR_mprotect = global i32 0
@PROT_READ = global i32 0
define i32 @ppc_mprotect_read(i8* %0, i32 %1) {
%3 = load i32, i32* @__NR_mprotect
%4 = load i32, i32* @PROT_READ
%5 = tail call i32 @ppc_syscall(i32 %3, i8* %0, i32 %1, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("usage: subtool <pattern db> [<pattern> <substitution>]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"usage: subtool <pattern db> [<pattern> <substitution>]\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [55 x i8] c"usage: subtool <pattern db> [<pattern> <substitution>]\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}