xunge/DecIR huggingface dataset:
int length(char a[]) {
  int i;
  for (i = 0; i <= 100; i++) {
    if (a[i] == '\0')
      break;
  }
  return i;
}


x86 assembly (clang, -O0):
<length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x64,-0xc(%rbp)
jg     1146 <length+0x46>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1133 <length+0x33>
jmp    1146 <length+0x46>
jmp    1138 <length+0x38>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <length+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<length>:
mov    $0x3,%eax
cmpb   $0x0,-0x3(%rdi,%rax,1)
je     1135 <length+0x35>
nopl   0x0(%rax)
cmp    $0x67,%rax
je     113a <length+0x3a>
cmpb   $0x0,-0x2(%rdi,%rax,1)
je     1140 <length+0x40>
cmpb   $0x0,-0x1(%rdi,%rax,1)
je     1145 <length+0x45>
cmpb   $0x0,(%rdi,%rax,1)
je     1149 <length+0x49>
add    $0x4,%rax
cmpb   $0x0,-0x3(%rdi,%rax,1)
jne    1110 <length+0x10>
add    $0xfffffffffffffffd,%rax
ret
mov    $0x65,%eax
ret
add    $0xfffffffffffffffe,%rax
ret
add    $0xffffffffffffffff,%rax
ret

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

LLVM IR (-O2):
define i32 @length(i8* nocapture %0) {
br label %2
2: ; preds = %24, %1
%3 = phi i64 [ 0, %1 ], [ %25, %24 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
br i1 %6, label %26, label %7
7: ; preds = %2
%8 = or i64 %3, 1
%9 = icmp eq i64 %8, 101
br i1 %9, label %29, label %10
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %0, i64 %8
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %26, label %14
14: ; preds = %10
%15 = or i64 %3, 2
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %26, label %19
19: ; preds = %14
%20 = or i64 %3, 3
%21 = getelementptr inbounds i8, i8* %0, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %19
%25 = add nuw nsw i64 %3, 4
br label %2
26: ; preds = %19, %14, %10, %2
%27 = phi i64 [ %3, %2 ], [ %8, %10 ], [ %15, %14 ], [ %20, %19 ]
%28 = trunc i64 %27 to i32
br label %29
29: ; preds = %7, %26
%30 = phi i32 [ %28, %26 ], [ 101, %7 ]
ret i32 %30
}
int base64_encode_length(const int len) {
  return (((len * 8) / 6 + (4 - 1)) & ~(4 - 1));
}


x86 assembly (clang, -O0):
<base64_encode_length>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x3,%eax
and    $0xfffffffc,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64_encode_length>:
shl    $0x3,%edi
movslq %edi,%rax
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x20,%rcx
shr    $0x3f,%rax
add    %ecx,%eax
add    $0x3,%eax
and    $0xfffffffc,%eax
ret

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

LLVM IR (-O2):
define i32 @base64_encode_length(i32 %0) {
%2 = shl nsw i32 %0, 3
%3 = sdiv i32 %2, 6
%4 = add nsw i32 %3, 3
%5 = and i32 %4, -4
ret i32 %5
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ p;

/* Variables and functions */
uint32_t libcperciva_le32dec(const void *pp) {
  const uint8_t *p = (uint8_t const *)pp;
  return ((uint32_t)(p[0]) + ((uint32_t)(p[1]) << 8) +
          ((uint32_t)(p[2]) << 16) + ((uint32_t)(p[3]) << 24));
}


x86 assembly (clang, -O0):
<libcperciva_le32dec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x10(%rcx),%rcx
shl    $0x10,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%rcx
mov    0x18(%rcx),%rcx
shl    $0x18,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<libcperciva_le32dec>:
mov    0x8(%rdi),%eax
mov    0x10(%rdi),%ecx
shl    $0x8,%eax
add    (%rdi),%eax
shl    $0x10,%ecx
add    %eax,%ecx
mov    0x18(%rdi),%eax
shl    $0x18,%eax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @libcperciva_le32dec(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = getelementptr inbounds i8, i8* %0, i64 8
%6 = bitcast i8* %5 to i64*
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 8
%10 = add nsw i32 %9, %4
%11 = getelementptr inbounds i8, i8* %0, i64 16
%12 = bitcast i8* %11 to i64*
%13 = load i64, i64* %12
%14 = trunc i64 %13 to i32
%15 = shl i32 %14, 16
%16 = add nsw i32 %10, %15
%17 = getelementptr inbounds i8, i8* %0, i64 24
%18 = bitcast i8* %17 to i64*
%19 = load i64, i64* %18
%20 = trunc i64 %19 to i32
%21 = shl i32 %20, 24
%22 = add nsw i32 %16, %21
ret i32 %22
}
void rc_null_func() { return; }


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

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

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

LLVM IR (-O2):
define void @rc_null_func() {
ret void
}
/* Variables and functions */
int random();
int randbit(void) { return (random() >> 16) & 1; }


x86 assembly (clang, -O0):
<randbit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <random@plt>
sar    $0x10,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<randbit>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
shr    $0x10,%eax
and    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @randbit() {
%1 = call i32 (...) @random()
%2 = ashr i32 %1, 16
%3 = and i32 %2, 1
ret i32 %3
}

LLVM IR (-O2):
define i32 @randbit() {
%1 = tail call i32 (...) @random()
%2 = lshr i32 %1, 16
%3 = and i32 %2, 1
ret i32 %3
}
int hputr4(hstring, keyword, rval)
char *hstring;
const char *keyword;
const float *rval;
{
  char value[30];
  sprintf(value, "%f", *rval);
  fixnegzero(value);
  return (hputc(hstring, keyword, value));
}


x86 assembly (clang, -O0):
<hputr4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea5(%rip),%rsi
mov    $0x1,%al
call   1050 <sprintf@plt>
lea    -0x40(%rbp),%rdi
mov    $0x0,%al
call   1040 <fixnegzero@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x40(%rbp),%rdx
mov    $0x0,%al
call   1030 <hputc@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hputr4>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
movss  (%rdx),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1050 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <fixnegzero@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <hputc@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i32 @hputr4(i8* %0, i8* %1, float* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float*
%7 = alloca [30 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store float* %2, float** %6
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%9 = load float*, float** %6
%10 = load float, float* %9
%11 = fpext float %10 to double
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %11)
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @fixnegzero to i32 (i8*, ...)*)(i8* %13)
%15 = load i8*, i8** %4
%16 = load i8*, i8** %5
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %7, i64 0, i64 0
%18 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @hputc to i32 (i8*, i8*, i8*, ...)*)(i8* %15, i8* %16, i8* %17)
ret i32 %18
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @hputr4(i8* %0, i8* %1, float* nocapture %2) {
%4 = alloca [30 x i8]
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%6 = load float, float* %2
%7 = fpext float %6 to double
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %7)
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @fixnegzero to i32 (i8*, ...)*)(i8* %5)
%10 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @hputc to i32 (i8*, i8*, i8*, ...)*)(i8* %0, i8* %1, i8* %5)
ret i32 %10
}
int doshr(int a, int b) { return a << 2; }


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

x86 assembly (clang, -O2):
<doshr>:
lea    0x0(,%rdi,4),%eax
ret

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

LLVM IR (-O2):
define i32 @doshr(i32 %0, i32 %1) {
%3 = shl i32 %0, 2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ oof(int);
int com(int *blah) {
  int z = *blah;
  if (z == 256) {
    oof(z);
    abort();
  }
  return *blah;
}


x86 assembly (clang, -O0):
<com>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jne    1151 <com+0x31>
mov    -0xc(%rbp),%edi
call   1040 <oof@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<com>:
push   %rax
mov    (%rdi),%eax
cmp    $0x100,%eax
je     112c <com+0xc>
pop    %rcx
ret
mov    $0x100,%edi
call   1040 <oof@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @com(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 256
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 @oof(i32 256)
%6 = tail call i32 (...) @abort()
unreachable
7: ; preds = %1
ret i32 %2
}
int main() {
  int val = 5;
  int *p;
  p = &val;
  return *p;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void drflac__free_default(void *p, void *pUserData) {
  (void)pUserData;
  free((p));
}


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

x86 assembly (clang, -O2):
<drflac__free_default>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @drflac__free_default(i8* nocapture %0, i8* nocapture readnone %1) {
%3 = tail call i32 @free(i8* %0)
ret void
}
int compareInts(const void *a, const void *b) {
  int ia = *((int *)(a));
  int ib = *((int *)(b));
  if (ia > ib)
    return 1;
  else if (ia < ib)
    return -1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<compareInts>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1136 <compareInts+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1155 <compareInts+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    114e <compareInts+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <compareInts+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareInts>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @compareInts(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main() {
  int i;
  int j;
  i = 0;
  j = 5;
  while (i < 100) {
    i = i + 1;
    j = j + 1;
  }
  assert(j == 105);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    114e <main+0x3e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
cmpl   $0x69,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ toolkit_func();
int runTests() {
  puts("Hello debug world tests");
  toolkit_func();
  return 0;
}


x86 assembly (clang, -O0):
<runTests>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <toolkit_func@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [24 x i8] c"Hello debug world tests\00"
define i32 @runTests() {
%1 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @toolkit_func()
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Hello debug world tests\00"
define i32 @runTests() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @toolkit_func()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
short producerStringWithXrefEntries(int /*<<< orphan*/ *, int);
short producerStringPresent(FILE *file) {
  return producerStringWithXrefEntries(file, 75);
}


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

x86 assembly (clang, -O2):
<producerStringPresent>:
mov    $0x4b,%esi
jmp    1030 <producerStringWithXrefEntries@plt>

LLVM IR (-O0):
define signext i16 @producerStringPresent(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call signext i16 @producerStringWithXrefEntries(i32* %3, i32 75)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @producerStringPresent(i32* %0) {
%2 = tail call signext i16 @producerStringWithXrefEntries(i32* %0, i32 75)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ read_random(void *, int);
void get_random_bytes(void *buf, int nbytes) { read_random(buf, nbytes); }


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

x86 assembly (clang, -O2):
<get_random_bytes>:
jmp    1030 <read_random@plt>

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

LLVM IR (-O2):
define void @get_random_bytes(i8* %0, i32 %1) {
%3 = tail call i32 @read_random(i8* %0, i32 %1)
ret void
}
void REMR3NotifyHandlerPhysicalRegister(void) {}


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

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

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

LLVM IR (-O2):
define void @REMR3NotifyHandlerPhysicalRegister() {
ret void
}
/* Variables and functions */
unsigned char __io_getchar();
size_t _read(int handle, unsigned char *buffer, size_t size) {
  *buffer = __io_getchar();
  return 1;
}


x86 assembly (clang, -O0):
<_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <__io_getchar@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_read>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
call   1030 <__io_getchar@plt>
mov    %al,(%rbx)
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @_read(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = call zeroext i8 (...) @__io_getchar()
%8 = load i8*, i8** %5
store i8 %7, i8* %8
ret i64 1
}

LLVM IR (-O2):
define i64 @_read(i32 %0, i8* nocapture writeonly %1, i64 %2) {
%4 = tail call zeroext i8 (...) @__io_getchar()
store i8 %4, i8* %1
ret i64 1
}
void INT_Excep_TPU2_TCI2V(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_TPU2_TCI2V() {
ret void
}
int doublecmp(void *o1, void *o2) {
  double d1, d2;
  d1 = *(double *)o1;
  d2 = *(double *)o2;
  if (d1 > d2)
    return -1;
  else if (d1 < d2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<doublecmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1142 <doublecmp+0x42>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <doublecmp+0x6e>
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1162 <doublecmp+0x62>
movl   $0x1,-0x4(%rbp)
jmp    116e <doublecmp+0x6e>
jmp    1167 <doublecmp+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<doublecmp>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
ucomisd %xmm1,%xmm0
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @doublecmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
store double %10, double* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to double*
%13 = load double, double* %12
store double %13, double* %7
%14 = load double, double* %6
%15 = load double, double* %7
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %25
18: ; preds = %2
%19 = load double, double* %6
%20 = load double, double* %7
%21 = fcmp olt double %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 1, i32* %3
br label %25
23: ; preds = %18
br label %24
24: ; preds = %23
store i32 0, i32* %3
br label %25
25: ; preds = %24, %22, %17
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @doublecmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = fcmp olt double %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int bang(int x) {
  x |= x >> 16;
  x |= x >> 8;
  x |= x >> 4;
  x |= x >> 2;
  x |= x >> 1;
  return ~x & 1;
}


x86 assembly (clang, -O0):
<bang>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bang>:
mov    %edi,%eax
sar    $0x10,%eax
or     %edi,%eax
mov    %eax,%ecx
sar    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x4,%eax
or     %ecx,%eax
mov    %eax,%ecx
sar    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    %eax
or     %ecx,%eax
not    %eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @bang(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 16
%5 = load i32, i32* %2
%6 = or i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = ashr i32 %7, 8
%9 = load i32, i32* %2
%10 = or i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = ashr i32 %11, 4
%13 = load i32, i32* %2
%14 = or i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = ashr i32 %15, 2
%17 = load i32, i32* %2
%18 = or i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = ashr i32 %19, 1
%21 = load i32, i32* %2
%22 = or i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = xor i32 %23, -1
%25 = and i32 %24, 1
ret i32 %25
}

LLVM IR (-O2):
define i32 @bang(i32 %0) {
%2 = ashr i32 %0, 16
%3 = or i32 %2, %0
%4 = ashr i32 %3, 8
%5 = or i32 %4, %3
%6 = ashr i32 %5, 4
%7 = or i32 %6, %5
%8 = ashr i32 %7, 2
%9 = or i32 %8, %7
%10 = lshr i32 %9, 1
%11 = or i32 %10, %9
%12 = and i32 %11, 1
%13 = xor i32 %12, 1
ret i32 %13
}
void mod3_fini2(void) {}


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

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

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

LLVM IR (-O2):
define void @mod3_fini2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/);
void free_arg(char **arg) {
  while (*arg)
    free(*arg++);
}


x86 assembly (clang, -O0):
<free_arg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1148 <free_arg+0x38>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%rax
mov    %eax,%edi
call   1030 <free@plt>
jmp    111c <free_arg+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_arg>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1131 <free_arg+0x21>
add    $0x8,%rbx
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1120 <free_arg+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @free_arg(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %11, %4 ], [ %2, %1 ]
%6 = phi i8** [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = ptrtoint i8* %5 to i64
%9 = trunc i64 %8 to i32
%10 = tail call i32 @free(i32 %9)
%11 = load i8*, i8** %7
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ intersect_general16(int /*<<< orphan*/ const *, size_t,
                                       int /*<<< orphan*/ const *, size_t,
                                       int /*<<< orphan*/ *);
int32_t intersect_uint16(const uint16_t *A, size_t s_a, const uint16_t *B,
                         size_t s_b, uint16_t *C) {
  return intersect_general16(A, s_a, B, s_b, C);
}


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

x86 assembly (clang, -O2):
<intersect_uint16>:
jmp    1030 <intersect_general16@plt>

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

LLVM IR (-O2):
define i32 @intersect_uint16(i32* %0, i64 %1, i32* %2, i64 %3, i32* %4) {
%6 = tail call i32 @intersect_general16(i32* %0, i64 %1, i32* %2, i64 %3, i32* %4)
ret i32 %6
}
/* Variables and functions */
char *GetEnvVar(char const *);
float atof(char const *);
int GetEnvVarFloat(const char *name, float *f, float def) {
  const char *s = GetEnvVar(name);
  *f = s ? atof(s) : def;
  return s != NULL;
}


x86 assembly (clang, -O0):
<GetEnvVarFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <GetEnvVar@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1160 <GetEnvVarFloat+0x40>
mov    -0x20(%rbp),%rdi
call   1030 <atof@plt>
movss  %xmm0,-0x24(%rbp)
jmp    116a <GetEnvVarFloat+0x4a>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
cmpq   $0x0,-0x20(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetEnvVarFloat>:
push   %r14
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
mov    %rsi,%r14
call   1040 <GetEnvVar@plt>
movss  0x4(%rsp),%xmm0
mov    %rax,%rbx
test   %rax,%rax
je     1148 <GetEnvVarFloat+0x28>
mov    %rbx,%rdi
call   1030 <atof@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
movss  %xmm0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @GetEnvVarFloat(i8* %0, float* %1, float %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca float
%7 = alloca i8*
store i8* %0, i8** %4
store float* %1, float** %5
store float %2, float* %6
%8 = load i8*, i8** %4
%9 = call i8* @GetEnvVar(i8* %8)
store i8* %9, i8** %7
%10 = load i8*, i8** %7
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i8*, i8** %7
%14 = call float @atof(i8* %13)
br label %17
15: ; preds = %3
%16 = load float, float* %6
br label %17
17: ; preds = %15, %12
%18 = phi float [ %14, %12 ], [ %16, %15 ]
%19 = load float*, float** %5
store float %18, float* %19
%20 = load i8*, i8** %7
%21 = icmp ne i8* %20, null
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @GetEnvVarFloat(i8* %0, float* nocapture writeonly %1, float %2) {
%4 = tail call i8* @GetEnvVar(i8* %0)
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call float @atof(i8* %4)
br label %8
8: ; preds = %3, %6
%9 = phi float [ %7, %6 ], [ %2, %3 ]
store float %9, float* %1
%10 = zext i1 %5 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  char i;
  unsigned int j;
  for (i = 0; i < 300; ++i) {
    printf("%d", i);
  }
  for (j = 30; j >= 0; --j) {
    printf("%d", j);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x12c,%eax
jge    114f <main+0x3f>
movsbl -0x5(%rbp),%esi
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    1123 <main+0x13>
movl   $0x1e,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jb     117d <main+0x6d>
mov    -0xc(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <main+0x46>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
movsbl %bl,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%bl
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i8 0, i8* %2
br label %4
4: ; preds = %12, %0
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = icmp slt i32 %6, 300
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %8
%13 = load i8, i8* %2
%14 = add i8 %13, 1
store i8 %14, i8* %2
br label %4
15: ; preds = %4
store i32 30, i32* %3
br label %16
16: ; preds = %22, %15
%17 = load i32, i32* %3
%18 = icmp uge i32 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i32, i32* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19
%23 = load i32, i32* %3
%24 = add i32 %23, -1
store i32 %24, i32* %3
br label %16
25: ; preds = %16
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i8 [ 0, %0 ], [ %5, %1 ]
%3 = sext i8 %2 to i32
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = add i8 %2, 1
br label %1
}
void foo(unsigned p, unsigned a, unsigned b) {
  unsigned q = p + 7;
  if (a - (1U + 0x7fffffff) >= 2)
    __builtin_unreachable();
  int d = p + b;
  int c = p + a;
  if (c - d != 0x7fffffff)
    __builtin_abort();
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x80000000,%eax
cmp    $0x2,%eax
jb     113b <foo+0x2b>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
cmp    $0x7fffffff,%eax
je     1163 <foo+0x53>
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
sub    %edx,%esi
cmp    $0x7fffffff,%esi
jne    111b <foo+0xb>
ret
push   %rax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, -2147483646
tail call void @llvm.assume(i1 %4)
%5 = sub i32 %1, %2
%6 = icmp eq i32 %5, 2147483647
br i1 %6, label %8, label %7
7: ; preds = %3
tail call void @abort()
unreachable
8: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strlen2(char *);
int main(void) {
  char text[] = "Text!";
  printf("%d\n", strlen2(text));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xa(%rbp),%rdi
call   1040 <strlen2@plt>
mov    %eax,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movw   $0x21,0x4(%rsp)
movl   $0x74786554,(%rsp)
mov    %rsp,%rdi
call   1040 <strlen2@plt>
lea    0xec8(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@__const.main.text = [6 x i8] c"Text!\00"
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 @strlen2(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
void RAND_query_egd_bytes(void) {}


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

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

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

LLVM IR (-O2):
define void @RAND_query_egd_bytes() {
ret void
}
int numsort(const void *a, const void *b) {
  int *pa = (int *)a;
  int *pb = (int *)b;
  return *pa - *pb;
}


x86 assembly (clang, -O0):
<numsort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numsort>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

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

LLVM IR (-O2):
define i32 @numsort(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
int toss_coin(sides)
int sides;
{ return rand() % sides; }


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

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

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

LLVM IR (-O2):
define i32 @toss_coin(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
void set_ipv6_pkt(int fd) { const int on = 1; }


x86 assembly (clang, -O0):
<set_ipv6_pkt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @set_ipv6_pkt(i32 %0) {
ret void
}
/* Type definitions */
struct OutputStream {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ PrintCh(int /*<<< orphan*/, struct OutputStream *);
void PrintStr(const char *Str, struct OutputStream *Stream) {
  while (*Str != 0)
    PrintCh(*Str++, Stream);
}


x86 assembly (clang, -O0):
<PrintStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1150 <PrintStr+0x40>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <PrintCh@plt>
jmp    1120 <PrintStr+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintStr>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     1146 <PrintStr+0x36>
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <PrintCh@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <PrintStr+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.OutputStream = type { i32 }
define void @PrintStr(i8* %0, %struct.OutputStream* %1) {
%3 = alloca i8*
%4 = alloca %struct.OutputStream*
store i8* %0, i8** %3
store %struct.OutputStream* %1, %struct.OutputStream** %4
br label %5
5: ; preds = %10, %2
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = load %struct.OutputStream*, %struct.OutputStream** %4
%16 = call i32 @PrintCh(i32 %14, %struct.OutputStream* %15)
br label %5
17: ; preds = %5
ret void
}

LLVM IR (-O2):
%struct.OutputStream = type { i32 }
define void @PrintStr(i8* nocapture %0, %struct.OutputStream* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = sext i8 %6 to i32
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = tail call i32 @PrintCh(i32 %8, %struct.OutputStream* %1)
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_p256_opp(uintptr_t, uintptr_t);
void fiat_p256_opp(uint64_t out1[4], const uint64_t arg1[4]) {
  internal_fiat_p256_opp((uintptr_t)out1, (uintptr_t)arg1);
}


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

x86 assembly (clang, -O2):
<fiat_p256_opp>:
jmp    1030 <internal_fiat_p256_opp@plt>

LLVM IR (-O0):
define void @fiat_p256_opp(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 = ptrtoint i32* %5 to i64
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = call i32 @internal_fiat_p256_opp(i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fiat_p256_opp(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = tail call i32 @internal_fiat_p256_opp(i64 %3, i64 %4)
ret void
}
int doublecpy(void *o1, void *o2) {
  double *d1, *d2;
  d1 = (double *)o1;
  d2 = (double *)o2;
  *d1 = *d2;
  return 0;
}


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

x86 assembly (clang, -O2):
<doublecpy>:
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rdi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @doublecpy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = bitcast i8* %1 to double*
%5 = load double, double* %4
store double %5, double* %3
ret i32 0
}
int e8_cmp(double a, double b) { return a == b ? 0 : (a < b ? -1 : 1); }


x86 assembly (clang, -O0):
<e8_cmp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    112e <e8_cmp+0x2e>
jp     112e <e8_cmp+0x2e>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    114c <e8_cmp+0x4c>
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<e8_cmp>:
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
setbe  %cl
xor    %eax,%eax
ucomisd %xmm1,%xmm0
lea    -0x1(%rcx,%rcx,1),%ecx
cmovne %ecx,%eax
cmovp  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @e8_cmp(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 = load double, double* %4
%7 = fcmp oeq double %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
br label %15
9: ; preds = %2
%10 = load double, double* %3
%11 = load double, double* %4
%12 = fcmp olt double %10, %11
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 -1, i32 1
br label %15
15: ; preds = %9, %8
%16 = phi i32 [ 0, %8 ], [ %14, %9 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @e8_cmp(double %0, double %1) {
%3 = fcmp oeq double %0, %1
%4 = fcmp olt double %0, %1
%5 = select i1 %4, i32 -1, i32 1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
int FBTest_Initialize(int nFrameWidth, int nFrameHeight) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @FBTest_Initialize(i32 %0, i32 %1) {
ret i32 0
}
void gtk_radio_tool_button_get_type() {}


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

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

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

LLVM IR (-O2):
define void @gtk_radio_tool_button_get_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ goodbye();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello, World\n");
  goodbye();
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Hello, World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @goodbye()
ret i32 0
}