xunge/DecIR huggingface dataset:
void glmCopyVector2d(const double source[2], double target[2]) {
  target[0] = source[0];
  target[1] = source[1];
}


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

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

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

LLVM IR (-O2):
define void @glmCopyVector2d(double* nocapture %0, double* nocapture writeonly %1) {
%3 = load double, double* %0
store double %3, double* %1
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = getelementptr inbounds double, double* %1, i64 1
store double %5, double* %6
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void htonb2(uint16_t host, uint8_t *network2) {
  network2[0] = (host & 0xff00) >> 8;
  network2[1] = host & 0x00ff;
}


x86 assembly (clang, -O0):
<htonb2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<htonb2>:
mov    %edi,%eax
movzbl %ah,%ecx
mov    %ecx,(%rsi)
movzbl %al,%eax
mov    %eax,0x4(%rsi)
ret

LLVM IR (-O0):
define void @htonb2(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 = and i32 %5, 65280
%7 = ashr i32 %6, 8
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %3
%11 = and i32 %10, 255
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %11, i32* %13
ret void
}

LLVM IR (-O2):
define void @htonb2(i32 %0, i32* nocapture writeonly %1) {
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
store i32 %4, i32* %1
%5 = and i32 %0, 255
%6 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %5, i32* %6
ret void
}
int verify(int n, const volatile int *test, const int *verify) {
  int i;
  for (i = 0; i < n; i++) {
    int t = test[i];
    int v = verify[i];
    if (t != v)
      return i + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<verify>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    116b <verify+0x6b>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
je     1158 <verify+0x58>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1172 <verify+0x72>
jmp    115d <verify+0x5d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1116 <verify+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify>:
xor    %eax,%eax
test   %edi,%edi
cmovle %eax,%edi
xor    %ecx,%ecx
nopl   0x0(%rax)
cmp    %rcx,%rdi
je     1129 <verify+0x29>
mov    (%rsi,%rcx,4),%r9d
lea    0x1(%rcx),%r8
cmp    (%rdx,%rcx,4),%r9d
mov    %r8,%rcx
je     1110 <verify+0x10>
mov    %r8d,%eax
ret

LLVM IR (-O0):
define i32 @verify(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32 0, i32* %8
br label %11
11: ; preds = %33, %3
%12 = load i32, i32* %8
%13 = load i32, i32* %5
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %36
15: ; preds = %11
%16 = load i32*, i32** %6
%17 = load i32, i32* %8
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %16, i64 %18
%20 = load volatile i32, i32* %19
store i32 %20, i32* %9
%21 = load i32*, i32** %7
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %21, i64 %23
%25 = load i32, i32* %24
store i32 %25, i32* %10
%26 = load i32, i32* %9
%27 = load i32, i32* %10
%28 = icmp ne i32 %26, %27
br i1 %28, label %29, label %32
29: ; preds = %15
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %37
32: ; preds = %15
br label %33
33: ; preds = %32
%34 = load i32, i32* %8
%35 = add nsw i32 %34, 1
store i32 %35, i32* %8
br label %11
36: ; preds = %11
store i32 0, i32* %4
br label %37
37: ; preds = %36, %29
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
define i32 @verify(i32 %0, i32* %1, i32* nocapture %2) {
%4 = call i32 @llvm.smax.i32(i32 %0, i32 0)
%5 = zext i32 %4 to i64
br label %6
6: ; preds = %9, %3
%7 = phi i64 [ %15, %9 ], [ 0, %3 ]
%8 = icmp eq i64 %7, %5
br i1 %8, label %18, label %9
9: ; preds = %6
%10 = getelementptr inbounds i32, i32* %1, i64 %7
%11 = load volatile i32, i32* %10
%12 = getelementptr inbounds i32, i32* %2, i64 %7
%13 = load i32, i32* %12
%14 = icmp eq i32 %11, %13
%15 = add nuw nsw i64 %7, 1
br i1 %14, label %6, label %16
16: ; preds = %9
%17 = trunc i64 %15 to i32
br label %18
18: ; preds = %6, %16
%19 = phi i32 [ %17, %16 ], [ 0, %6 ]
ret i32 %19
}
/* Type definitions */
struct timeval {
  int /*<<< orphan*/ member_1;
  int /*<<< orphan*/ member_0;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int checkFd(int fd) {
  fd_set set;
  FD_ZERO(&set);
  FD_SET(fd, &set);
  struct timeval t = {0, 0};
  return select(fd + 1, &set, NULL, NULL, &t);
}


x86 assembly (clang, -O0):
<checkFd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <FD_ZERO@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1060 <FD_SET@plt>
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
lea    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
mov    %rcx,%rdx
call   1050 <select@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkFd>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0x14(%rsp),%r14
mov    %r14,%rdi
call   1030 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1050 <FD_SET@plt>
movq   $0x0,0x8(%rsp)
add    $0x1,%ebx
lea    0x8(%rsp),%r8
mov    %ebx,%edi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
call   1040 <select@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @checkFd(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.timeval
store i32 %0, i32* %2
%5 = call i32 @FD_ZERO(i32* %3)
%6 = load i32, i32* %2
%7 = call i32 @FD_SET(i32 %6, i32* %3)
%8 = bitcast %struct.timeval* %4 to i8*
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
%11 = call i32 @select(i32 %10, i32* %3, i32* null, i32* null, %struct.timeval* %4)
ret i32 %11
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @checkFd(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = bitcast i64* %3 to %struct.timeval*
%5 = bitcast i32* %2 to i8*
%6 = call i32 @FD_ZERO(i32* %2)
%7 = call i32 @FD_SET(i32 %0, i32* %2)
%8 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%9 = add nsw i32 %0, 1
%10 = call i32 @select(i32 %9, i32* %2, i32* null, i32* null, %struct.timeval* %4)
ret i32 %10
}
int width2unk(int w) {
  int u;
  u = (w >> 8) + 65;
  return u;
}


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

x86 assembly (clang, -O2):
<width2unk>:
sar    $0x8,%edi
lea    0x41(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @width2unk(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 8
%6 = add nsw i32 %5, 65
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @width2unk(i32 %0) {
%2 = ashr i32 %0, 8
%3 = add nsw i32 %2, 65
ret i32 %3
}
unsigned long hash_krm(const char *chave, int tamanho) {
  unsigned long h, i;
  h = 7;
  i = 0;
  while (chave[i])
    h += chave[i++];
  return h % tamanho;
}


x86 assembly (clang, -O0):
<hash_krm>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x7,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1152 <hash_krm+0x52>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x20(%rbp)
movsbq (%rax,%rcx,1),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    111b <hash_krm+0x1b>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_krm>:
mov    (%rdi),%cl
test   %cl,%cl
je     1124 <hash_krm+0x24>
add    $0x1,%rdi
mov    $0x7,%eax
nop
movsbq %cl,%rcx
add    %rcx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash_krm+0x10>
jmp    1129 <hash_krm+0x29>
mov    $0x7,%eax
movslq %esi,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     1141 <hash_krm+0x41>
xor    %edx,%edx
div    %rcx
mov    %rdx,%rax
ret
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i64 @hash_krm(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i64 [ %9, %5 ], [ 0, %2 ]
%8 = phi i64 [ %11, %5 ], [ 7, %2 ]
%9 = add i64 %7, 1
%10 = sext i8 %6 to i64
%11 = add i64 %8, %10
%12 = getelementptr inbounds i8, i8* %0, i64 %9
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i64 [ 7, %2 ], [ %11, %5 ]
%17 = sext i32 %1 to i64
%18 = urem i64 %16, %17
ret i64 %18
}
/* Variables and functions */
int /*<<< orphan*/ ssd1306_fillScreen16(int);
void ssd1306_clearScreen16(void) { ssd1306_fillScreen16(0x0000); }


x86 assembly (clang, -O0):
<ssd1306_clearScreen16>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <ssd1306_fillScreen16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssd1306_clearScreen16>:
xor    %edi,%edi
jmp    1030 <ssd1306_fillScreen16@plt>

LLVM IR (-O0):
define void @ssd1306_clearScreen16() {
%1 = call i32 @ssd1306_fillScreen16(i32 0)
ret void
}

LLVM IR (-O2):
define void @ssd1306_clearScreen16() {
%1 = tail call i32 @ssd1306_fillScreen16(i32 0)
ret void
}
int main(int argc, char *argv[]) {
  int a;
  a = 2;
  a *= 5;
  a %= 3;
  a <<= 1;
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
imul   $0x5,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 2, i32* %6
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 5
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = srem i32 %9, 3
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = shl i32 %11, 1
store i32 %12, i32* %6
%13 = load i32, i32* %6
ret i32 %13
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
void help(const char *name) {
  fprintf(stdout, "Usage:\n");
  fprintf(stdout, "%s [options] <input file>\n\n", name);
  fprintf(stdout, "-t t\tSet the tolerance\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<help>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xebf(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [28 x i8] c"%s [options] <input file>\0A\0A\00"
@.str.2 = [24 x i8] c"-t t\09Set the tolerance\0A\00"
define void @help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stdout
%6 = load i8*, i8** %2
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i32, i32* @stdout
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [28 x i8] c"%s [options] <input file>\0A\0A\00"
@.str.2 = [24 x i8] c"-t t\09Set the tolerance\0A\00"
define void @help(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @stdout
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
}
void _irq_default_handler() {
  while (1)
    ;
  return;
}


x86 assembly (clang, -O0):
<_irq_default_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <_irq_default_handler+0x9>
jmp    1109 <_irq_default_handler+0x9>

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

LLVM IR (-O0):
define void @_irq_default_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @_irq_default_handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ open_test();
int main(void) {
  open_test();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @open_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @open_test()
ret i32 0
}
/* Variables and functions */
scalar_t__ rand();
int randomInRange(int range_min, int range_max) {
  int result =
      (int)((double)rand() / (35535 + 1) * (range_max - range_min) + range_min);
  return result;
}


x86 assembly (clang, -O0):
<randomInRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
movsd  0xece(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
cvtsi2sd %eax,%xmm2
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomInRange>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
divsd  0xed5(%rip),%xmm0
sub    %ebp,%ebx
cvtsi2sd %ebx,%xmm1
cvtsi2sd %ebp,%xmm2
mulsd  %xmm0,%xmm1
addsd  %xmm1,%xmm2
cvttsd2si %xmm2,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @randomInRange(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i64 (...) @rand()
%7 = sitofp i64 %6 to double
%8 = fdiv double %7, 3.553600e+04
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = sitofp i32 %11 to double
%13 = load i32, i32* %3
%14 = sitofp i32 %13 to double
%15 = call double @llvm.fmuladd.f64(double %8, double %12, double %14)
%16 = fptosi double %15 to i32
store i32 %16, i32* %5
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
define i32 @randomInRange(i32 %0, i32 %1) {
%3 = tail call i64 (...) @rand()
%4 = sitofp i64 %3 to double
%5 = fdiv double %4, 3.553600e+04
%6 = sub nsw i32 %1, %0
%7 = sitofp i32 %6 to double
%8 = sitofp i32 %0 to double
%9 = tail call double @llvm.fmuladd.f64(double %5, double %7, double %8)
%10 = fptosi double %9 to i32
ret i32 %10
}
/* Variables and functions */
int partition(int *, int, int);
void quick_sort(int *num, int low, int high) {
  if (high - low <= 0) {
    return;
  }
  int pivotloc = partition(num, low, high);
  quick_sort(num, low, pivotloc - 1);
  quick_sort(num, pivotloc + 1, high);
}


x86 assembly (clang, -O0):
<quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x0,%eax
jg     1146 <quick_sort+0x26>
jmp    117c <quick_sort+0x5c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %esi,%edx
jle    1166 <quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, %1
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick_sort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ uchar_put(unsigned char const, int /*<<< orphan*/ *);
void std_uchar_str(const void *restrict self, const char *restrict format,
                   FILE *restrict stream) {
  (void)format;
  if (self)
    uchar_put(*(const unsigned char *)self, stream);
}


x86 assembly (clang, -O0):
<std_uchar_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1141 <std_uchar_str+0x31>
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    -0x18(%rbp),%rsi
movzbl %al,%edi
call   1030 <uchar_put@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<std_uchar_str>:
test   %rdi,%rdi
je     1120 <std_uchar_str+0x10>
movzbl (%rdi),%edi
mov    %rdx,%rsi
jmp    1030 <uchar_put@plt>
ret

LLVM IR (-O0):
define void @std_uchar_str(i8* noalias %0, i8* noalias %1, i32* noalias %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %4
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i8, i8* %11
%13 = load i32*, i32** %6
%14 = call i32 @uchar_put(i8 zeroext %12, i32* %13)
br label %15
15: ; preds = %10, %3
ret void
}

LLVM IR (-O2):
define void @std_uchar_str(i8* noalias %0, i8* noalias nocapture readnone %1, i32* noalias %2) {
%4 = icmp eq i8* %0, null
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = load i8, i8* %0
%7 = tail call i32 @uchar_put(i8 zeroext %6, i32* %2)
br label %8
8: ; preds = %5, %3
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ _write(int, int *, int);
void _led_display(int fd, uint8_t *val) {
  uint8_t buf[] = {0x02, val[3], val[2], val[1], val[0]};
  _write(fd, buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<_led_display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x14,%edx
call   1030 <_write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_led_display>:
sub    $0x18,%rsp
movl   $0x2,(%rsp)
movdqu (%rsi),%xmm0
pshufd $0x1b,%xmm0,%xmm0
movdqu %xmm0,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x14,%edx
call   1030 <_write@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define void @_led_display(i32 %0, i32* nocapture %1) {
%3 = alloca [5 x i32]
%4 = bitcast [5 x i32]* %3 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
store i32 2, i32* %5
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%7 = bitcast i32* %1 to <4 x i32>*
%8 = load <4 x i32>, <4 x i32>* %7
%9 = shufflevector <4 x i32> %8, <4 x i32> poison, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
%10 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %10
%11 = call i32 @_write(i32 %0, i32* %5, i32 20)
ret void
}
/* Type definitions */
struct yas530_driver {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ yas530_cdrv_term();
int suspend_yas530(struct yas530_driver *d) {
  ;
  (void)d;
  yas530_cdrv_term();
  ;
  return 0;
}


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

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

LLVM IR (-O0):
%struct.yas530_driver = type { i32 }
define i32 @suspend_yas530(%struct.yas530_driver* %0) {
%2 = alloca %struct.yas530_driver*
store %struct.yas530_driver* %0, %struct.yas530_driver** %2
%3 = load %struct.yas530_driver*, %struct.yas530_driver** %2
%4 = call i32 (...) @yas530_cdrv_term()
ret i32 0
}

LLVM IR (-O2):
%struct.yas530_driver = type { i32 }
define i32 @suspend_yas530(%struct.yas530_driver* nocapture readnone %0) {
%2 = tail call i32 (...) @yas530_cdrv_term()
ret i32 0
}
/* Type definitions */
struct expr_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int expr_eval_word(struct expr_node *, int /*<<< orphan*/ *,
                   int /*<<< orphan*/ *, long *);
int /*<<< orphan*/ expr_is_compile_constant(struct expr_node *);
int expr_eval_constant(struct expr_node *node, long *valuep) {
  assert(expr_is_compile_constant(node));
  return expr_eval_word(node, NULL, NULL, valuep);
}


x86 assembly (clang, -O0):
<expr_eval_constant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <expr_is_compile_constant@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1040 <expr_eval_word@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expr_eval_constant>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <expr_is_compile_constant@plt>
mov    %eax,%edi
call   1050 <assert@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <expr_eval_word@plt>

LLVM IR (-O0):
%struct.expr_node = type { i32 }
define i32 @expr_eval_constant(%struct.expr_node* %0, i64* %1) {
%3 = alloca %struct.expr_node*
%4 = alloca i64*
store %struct.expr_node* %0, %struct.expr_node** %3
store i64* %1, i64** %4
%5 = load %struct.expr_node*, %struct.expr_node** %3
%6 = call i32 @expr_is_compile_constant(%struct.expr_node* %5)
%7 = call i32 @assert(i32 %6)
%8 = load %struct.expr_node*, %struct.expr_node** %3
%9 = load i64*, i64** %4
%10 = call i32 @expr_eval_word(%struct.expr_node* %8, i32* null, i32* null, i64* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.expr_node = type { i32 }
define i32 @expr_eval_constant(%struct.expr_node* %0, i64* %1) {
%3 = tail call i32 @expr_is_compile_constant(%struct.expr_node* %0)
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @expr_eval_word(%struct.expr_node* %0, i32* null, i32* null, i64* %1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char const *, int);
double strtod(char *, char **);
double nmea_atof(const char *str, int str_sz) {
  char *tmp_ptr;
  char buff[(256)];
  double res = 0;
  if (str_sz < (256)) {
    memcpy(&buff[0], str, str_sz);
    buff[str_sz] = '\0';
    res = strtod(&buff[0], &tmp_ptr);
  }
  return res;
}


x86 assembly (clang, -O0):
<nmea_atof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
cmpl   $0x100,-0xc(%rbp)
jge    1181 <nmea_atof+0x61>
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x120(%rbp,%rax,1)
lea    -0x120(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x128(%rbp),%xmm0
ff
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmea_atof>:
push   %r14
push   %rbx
sub    $0x118,%rsp
mov    %esi,%ebx
xorps  %xmm0,%xmm0
cmp    $0xff,%esi
jg     115e <nmea_atof+0x3e>
mov    %rdi,%rsi
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    %ebx,%edx
call   1040 <memcpy@plt>
movslq %ebx,%rax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1030 <strtod@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @nmea_atof(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [256 x i8]
%7 = alloca double
store i8* %0, i8** %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %7
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 256
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%12 = load i8*, i8** %3
%13 = load i32, i32* %4
%14 = call i32 @memcpy(i8* %11, i8* %12, i32 %13)
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %16
store i8 0, i8* %17
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%19 = call double @strtod(i8* %18, i8** %5)
store double %19, double* %7
br label %20
20: ; preds = %10, %2
%21 = load double, double* %7
ret double %21
}

LLVM IR (-O2):
define double @nmea_atof(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca [256 x i8]
%5 = bitcast i8** %3 to i8*
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %1, 256
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = call i32 @memcpy(i8* %6, i8* %0, i32 %1)
%10 = sext i32 %1 to i64
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 %10
store i8 0, i8* %11
%12 = call double @strtod(i8* %6, i8** %3)
br label %13
13: ; preds = %8, %2
%14 = phi double [ %12, %8 ], [ 0.000000e+00, %2 ]
ret double %14
}
int myStrLen(char *pStr) {
  int ii = 0;
  while (*pStr++ != '\0')
    ii++;
  return ii;
}


x86 assembly (clang, -O0):
<myStrLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1138 <myStrLen+0x38>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <myStrLen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myStrLen>:
cmpb   $0x0,(%rdi)
je     111c <myStrLen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <myStrLen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @myStrLen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ BTJPG_DriverTryLoadConfig(char *);
void BTJPG_DriverReloadConfig(void) {
  char tb1[1024];
  char tb2[1024];
  BTJPG_DriverTryLoadConfig("~/.bt1hdrv_conf.txt");
}


x86 assembly (clang, -O0):
<BTJPG_DriverReloadConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x800,%rsp
lea    0xede(%rip),%rdi
call   1030 <BTJPG_DriverTryLoadConfig@plt>
add    $0x800,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [20 x i8] c"~/.bt1hdrv_conf.txt\00"
define void @BTJPG_DriverReloadConfig() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = call i32 @BTJPG_DriverTryLoadConfig(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"~/.bt1hdrv_conf.txt\00"
define void @BTJPG_DriverReloadConfig() {
%1 = tail call i32 @BTJPG_DriverTryLoadConfig(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  const int no_const_value = 0;
  int *const_value_p = &no_const_value;
  *const_value_p = 1;
  printf("%d\n", *const_value_p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xebb(%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    $0x1,%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 0, i32* %1
store i32 0, i32* %2
store i32* %2, i32** %3
%4 = load i32*, i32** %3
store i32 1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
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 1)
ret i32 0
}
void itoa_isnegative(int *n, int *negative) {
  if (*n < 0) {
    *n *= -1;
    *negative = 1;
  }
}


x86 assembly (clang, -O0):
<itoa_isnegative>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jge    112c <itoa_isnegative+0x2c>
mov    -0x8(%rbp),%rax
imul   $0xffffffff,(%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa_isnegative>:
mov    (%rdi),%eax
test   %eax,%eax
js     1107 <itoa_isnegative+0x7>
ret
neg    %eax
mov    %eax,(%rdi)
movl   $0x1,(%rsi)
ret

LLVM IR (-O0):
define void @itoa_isnegative(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* %5
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32*, i32** %3
%10 = load i32, i32* %9
%11 = mul nsw i32 %10, -1
store i32 %11, i32* %9
%12 = load i32*, i32** %4
store i32 1, i32* %12
br label %13
13: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @itoa_isnegative(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = sub nsw i32 0, %3
store i32 %6, i32* %0
store i32 1, i32* %1
br label %7
7: ; preds = %5, %2
ret void
}
int seccomp_mode(struct seccomp_struct *s) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.seccomp_struct = type opaque
define i32 @seccomp_mode(%struct.seccomp_struct* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: mkm [-v|-m] file.vm\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 = [28 x i8] c"Usage: mkm [-v|-m] file.vm\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [27 x i8] c"Usage: mkm [-v|-m] file.vm\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int sumOfNumbersInString(char *);
int main(void) {
  char array[100] = "a12b34c56";
  printf("%d", sumOfNumbersInString(array));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x64,%edx
call   1040 <memcpy@plt>
lea    -0x70(%rbp),%rdi
call   1050 <sumOfNumbersInString@plt>
mov    %eax,%esi
lea    0xefe(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
movaps 0xf25(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xf09(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xeed(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xeb5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
mov    %rsp,%rdi
call   1040 <sumOfNumbersInString@plt>
lea    0xee2(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
ret

LLVM IR (-O0):
@__const.main.array = [100 x i8] c"a12b34c56\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
store i32 0, i32* %1
%3 = bitcast [100 x i8]* %2 to i8*
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = call i32 @sumOfNumbersInString(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@__const.main.array = [100 x i8] c"a12b34c56\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @sumOfNumbersInString(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int ShowPort(const char *port, void *data) {
  printf("%s\n", port);
  return 1;
}


x86 assembly (clang, -O0):
<ShowPort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @ShowPort(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ getch();
int /*<<< orphan*/ showMenu();
int main() {
  showMenu();
  getch();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <showMenu@plt>
mov    $0x0,%al
call   1040 <getch@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @showMenu()
%3 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @showMenu()
%2 = tail call i32 (...) @getch()
ret i32 0
}
IR0AR1(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (*p0) = (p1[1111111 / 4]); }


x86 assembly (clang, -O0):
<IR0AR1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movss  0x10f444(%rax),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<IR0AR1>:
movss  0x10f444(%rcx),%xmm0
movss  %xmm0,(%rdx)
ret

LLVM IR (-O0):
define i32 @IR0AR1(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = getelementptr inbounds float, float* %16, i64 277777
%18 = load float, float* %17
%19 = load float*, float** %12
store float %18, float* %19
%20 = load i32, i32* %7
ret i32 %20
}

LLVM IR (-O2):
define i32 @IR0AR1(double %0, double %1, i32 %2, i32 %3, float* nocapture writeonly %4, float* nocapture %5) {
%7 = getelementptr inbounds float, float* %5, i64 277777
%8 = load float, float* %7
store float %8, float* %4
ret i32 undef
}
char *isaac_skip_nonblanks(const char *str) {
  while (*str && ((unsigned char)*str) > 32)
    str++;
  return (char *)str;
}


x86 assembly (clang, -O0):
<isaac_skip_nonblanks>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     112d <isaac_skip_nonblanks+0x2d>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x20,%eax
setg   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <isaac_skip_nonblanks+0x3d>
jmp    114e <isaac_skip_nonblanks+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <isaac_skip_nonblanks+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isaac_skip_nonblanks>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x20,0x1(%rax)
lea    0x1(%rax),%rax
ja     1110 <isaac_skip_nonblanks+0x10>
ret

LLVM IR (-O0):
define i8* @isaac_skip_nonblanks(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = icmp sgt i32 %11, 32
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @isaac_skip_nonblanks(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp ugt i8 %4, 32
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %2, label %7
7: ; preds = %2
ret i8* %3
}
unsigned int myrnd(void) {
  static unsigned int s = 1388815473;
  s *= 1103515245;
  s += 12345;
  return (s / 65536) % 2048;
}


x86 assembly (clang, -O0):
<myrnd>:
push   %rbp
mov    %rsp,%rbp
imul   $0x41c64e6d,0x2f12(%rip),%eax
4e c6 41
mov    %eax,0x2f0c(%rip)
mov    0x2f06(%rip),%eax
add    $0x3039,%eax
mov    %eax,0x2efb(%rip)
mov    0x2ef5(%rip),%eax
shr    $0x10,%eax
and    $0x7ff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myrnd>:
imul   $0x41c64e6d,0x2f16(%rip),%eax
4e c6 41
add    $0x3039,%eax
mov    %eax,0x2f0b(%rip)
shr    $0x10,%eax
and    $0x7ff,%eax
ret

LLVM IR (-O0):
@myrnd.s = internal global i32 1388815473
define i32 @myrnd() {
%1 = load i32, i32* @myrnd.s
%2 = mul i32 %1, 1103515245
store i32 %2, i32* @myrnd.s
%3 = load i32, i32* @myrnd.s
%4 = add i32 %3, 12345
store i32 %4, i32* @myrnd.s
%5 = load i32, i32* @myrnd.s
%6 = udiv i32 %5, 65536
%7 = urem i32 %6, 2048
ret i32 %7
}

LLVM IR (-O2):
@myrnd.s = internal unnamed_addr global i32 1388815473
define i32 @myrnd() {
%1 = load i32, i32* @myrnd.s
%2 = mul i32 %1, 1103515245
%3 = add i32 %2, 12345
store i32 %3, i32* @myrnd.s
%4 = lshr i32 %3, 16
%5 = and i32 %4, 2047
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void __attribute__((no)) foo(void) { exit(0); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @foo() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 @exit(i32 0)
unreachable
}