xunge/DecIR huggingface dataset:
/* Variables and functions */
int geohashGetDistanceIfInRadius(double, double, double, double, double,
                                 double *);
int geohashGetDistanceIfInRadiusWGS84(double x1, double y1, double x2,
                                      double y2, double radius,
                                      double *distance) {
  return geohashGetDistanceIfInRadius(x1, y1, x2, y2, radius, distance);
}


x86 assembly (clang, -O0):
<geohashGetDistanceIfInRadiusWGS84>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
mov    -0x30(%rbp),%rdi
call   1030 <geohashGetDistanceIfInRadius@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geohashGetDistanceIfInRadiusWGS84>:
jmp    1030 <geohashGetDistanceIfInRadius@plt>

LLVM IR (-O0):
define i32 @geohashGetDistanceIfInRadiusWGS84(double %0, double %1, double %2, double %3, double %4, double* %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double*
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double* %5, double** %12
%13 = load double, double* %7
%14 = load double, double* %8
%15 = load double, double* %9
%16 = load double, double* %10
%17 = load double, double* %11
%18 = load double*, double** %12
%19 = call i32 @geohashGetDistanceIfInRadius(double %13, double %14, double %15, double %16, double %17, double* %18)
ret i32 %19
}

LLVM IR (-O2):
define i32 @geohashGetDistanceIfInRadiusWGS84(double %0, double %1, double %2, double %3, double %4, double* %5) {
%7 = tail call i32 @geohashGetDistanceIfInRadius(double %0, double %1, double %2, double %3, double %4, double* %5)
ret i32 %7
}
void lgltravcounter(void *voidptr, int lit) {
  int *cntptr = voidptr;
  if (!lit)
    *cntptr += 1;
}


x86 assembly (clang, -O0):
<lgltravcounter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1128 <lgltravcounter+0x28>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<lgltravcounter>:
test   %esi,%esi
je     1105 <lgltravcounter+0x5>
ret
addl   $0x1,(%rdi)
ret

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

LLVM IR (-O2):
define void @lgltravcounter(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = icmp eq i32 %1, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
br label %8
8: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void release(void) { print("\t(template driver) release()\n"); }


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"\09(template driver) release()\0A\00"
define void @release() {
%1 = call i32 @print(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"\09(template driver) release()\0A\00"
define void @release() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void pes_set_length(uint8_t *p_pes, uint16_t i_length) {
  p_pes[4] = i_length >> 8;
  p_pes[5] = i_length & 0xff;
}


x86 assembly (clang, -O0):
<pes_set_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pes_set_length>:
movzbl %sil,%eax
sar    $0x8,%esi
mov    %esi,0x10(%rdi)
mov    %eax,0x14(%rdi)
ret

LLVM IR (-O0):
define void @pes_set_length(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = ashr i32 %5, 8
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 4
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = and i32 %9, 255
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 5
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @pes_set_length(i32* nocapture writeonly %0, i32 %1) {
%3 = ashr i32 %1, 8
%4 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %3, i32* %4
%5 = and i32 %1, 255
%6 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %5, i32* %6
ret void
}
int nbs_send(const unsigned char *data) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @nbs_send(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int brk(void *);
int main(void) {
  void *addr = (void *)~0;
  return brk(addr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <brk@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0xffffffffffffffff,%rdi
jmp    1030 <brk@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
store i8* inttoptr (i64 -1 to i8*), i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @brk(i8* %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @brk(i8* inttoptr (i64 -1 to i8*))
ret i32 %1
}
int re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop)
struct re_pattern_buffer *bufp;
const char *string1, *string2;
int size1, size2;
int pos;
struct re_registers *regs;
int stop;
{
  int result = re_match_2_internal(bufp, string1, size1, string2, size2, pos,
                                   regs, stop);
  __builtin_alloca(0);
  return result;
}


x86 assembly (clang, -O0):
<re_match_2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9d,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%eax
mov    %r10,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <re_match_2_internal@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<re_match_2>:
push   %rax
mov    0x18(%rsp),%r10d
xor    %eax,%eax
push   %r10
push   0x18(%rsp)
call   1030 <re_match_2_internal@plt>
add    $0x10,%rsp
pop    %rcx
ret

LLVM IR (-O0):
%struct.re_pattern_buffer = type opaque
%struct.re_registers = type opaque
define i32 @re_match_2(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, %struct.re_registers* %6, i32 %7) {
%9 = alloca %struct.re_pattern_buffer*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca %struct.re_registers*
%16 = alloca i32
%17 = alloca i32
store %struct.re_pattern_buffer* %0, %struct.re_pattern_buffer** %9
store i8* %1, i8** %10
store i32 %2, i32* %11
store i8* %3, i8** %12
store i32 %4, i32* %13
store i32 %5, i32* %14
store %struct.re_registers* %6, %struct.re_registers** %15
store i32 %7, i32* %16
%18 = load %struct.re_pattern_buffer*, %struct.re_pattern_buffer** %9
%19 = load i8*, i8** %10
%20 = load i32, i32* %11
%21 = load i8*, i8** %12
%22 = load i32, i32* %13
%23 = load i32, i32* %14
%24 = load %struct.re_registers*, %struct.re_registers** %15
%25 = load i32, i32* %16
%26 = call i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, %struct.re_registers*, i32, ...) bitcast (i32 (...)* @re_match_2_internal to i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, %struct.re_registers*, i32, ...)*)(%struct.re_pattern_buffer* %18, i8* %19, i32 %20, i8* %21, i32 %22, i32 %23, %struct.re_registers* %24, i32 %25)
store i32 %26, i32* %17
%27 = alloca i8, i64 0
%28 = load i32, i32* %17
ret i32 %28
}

LLVM IR (-O2):
%struct.re_pattern_buffer = type opaque
%struct.re_registers = type opaque
define i32 @re_match_2(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, %struct.re_registers* %6, i32 %7) {
%9 = tail call i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, %struct.re_registers*, i32, ...) bitcast (i32 (...)* @re_match_2_internal to i32 (%struct.re_pattern_buffer*, i8*, i32, i8*, i32, i32, %struct.re_registers*, i32, ...)*)(%struct.re_pattern_buffer* %0, i8* %1, i32 %2, i8* %3, i32 %4, i32 %5, %struct.re_registers* %6, i32 %7)
ret i32 %9
}
/* Type definitions */
struct rq_asset_irovernight {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ rq_asset_irovernight_free(struct rq_asset_irovernight *);
void rq_asset_irovernight_freefunc(void *asset_data) {
  rq_asset_irovernight_free((struct rq_asset_irovernight *)asset_data);
}


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

x86 assembly (clang, -O2):
<rq_asset_irovernight_freefunc>:
jmp    1030 <rq_asset_irovernight_free@plt>

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

LLVM IR (-O2):
%struct.rq_asset_irovernight = type { i32 }
define void @rq_asset_irovernight_freefunc(i8* %0) {
%2 = bitcast i8* %0 to %struct.rq_asset_irovernight*
%3 = tail call i32 @rq_asset_irovernight_free(%struct.rq_asset_irovernight* %2)
ret void
}
void UARTParityModeSet(unsigned long ulBase, unsigned long ulParity) {
  ;

  ;
  (*((volatile unsigned long *)(ulBase + 0x0000000C))) =
      (((*((volatile unsigned long *)(ulBase + 0x0000000C))) &
        ~(0x00000400 | 0x00000200)) |
       ulParity);
}


x86 assembly (clang, -O0):
<UARTParityModeSet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%rcx
and    $0xfffffffffffff9ff,%rcx
or     -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTParityModeSet>:
mov    $0xfffffffffffff9ff,%rax
and    0xc(%rdi),%rax
or     %rsi,%rax
mov    %rax,0xc(%rdi)
ret

LLVM IR (-O0):
define void @UARTParityModeSet(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = add i64 %5, 12
%7 = inttoptr i64 %6 to i64*
%8 = load volatile i64, i64* %7
%9 = and i64 %8, -1537
%10 = load i64, i64* %4
%11 = or i64 %9, %10
%12 = load i64, i64* %3
%13 = add i64 %12, 12
%14 = inttoptr i64 %13 to i64*
store volatile i64 %11, i64* %14
ret void
}

LLVM IR (-O2):
define void @UARTParityModeSet(i64 %0, i64 %1) {
%3 = add i64 %0, 12
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = and i64 %5, -1537
%7 = or i64 %6, %1
store volatile i64 %7, i64* %4
ret void
}
void ASN1_STRING_set_default_mask(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_STRING_set_default_mask() {
ret void
}
unsigned short int cast_char_ushort(char x) { return (unsigned short int)x; }


x86 assembly (clang, -O0):
<cast_char_ushort>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
movzwl %ax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @cast_char_ushort(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i16
ret i16 %4
}

LLVM IR (-O2):
define zeroext i16 @cast_char_ushort(i8 signext %0) {
%2 = sext i8 %0 to i16
ret i16 %2
}
int fun(int x) { return x + 1; }


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

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

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

LLVM IR (-O2):
define i32 @fun(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
char EOF;
char getchar();
void flushStdin() {
  char c;
  while ((c = getchar()) != EOF && c != '\n' && c != '\r') {
  };
}


x86 assembly (clang, -O0):
<flushStdin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%ecx
mov    0x2ebc(%rip),%rax
movsbl (%rax),%edx
xor    %eax,%eax
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
je     115b <flushStdin+0x4b>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     115b <flushStdin+0x4b>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    116b <flushStdin+0x5b>
jmp    1170 <flushStdin+0x60>
jmp    1118 <flushStdin+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flushStdin>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    (%rbx),%al
je     1133 <flushStdin+0x23>
cmp    $0xd,%al
je     1133 <flushStdin+0x23>
cmp    $0xa,%al
jne    1120 <flushStdin+0x10>
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define void @flushStdin() {
%1 = alloca i8
br label %2
2: ; preds = %18, %0
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
%4 = sext i8 %3 to i32
%5 = load i8, i8* @EOF
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %4, %6
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %16
12: ; preds = %8
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 13
br label %16
16: ; preds = %12, %8, %2
%17 = phi i1 [ false, %8 ], [ false, %2 ], [ %15, %12 ]
br i1 %17, label %18, label %19
18: ; preds = %16
br label %2
19: ; preds = %16
ret void
}

LLVM IR (-O2):
@EOF = global i8 0
define void @flushStdin() {
br label %1
1: ; preds = %6, %0
%2 = tail call signext i8 (...) @getchar()
%3 = load i8, i8* @EOF
%4 = freeze i8 %3
%5 = icmp eq i8 %2, %4
br i1 %5, label %7, label %6
6: ; preds = %1
switch i8 %2, label %1 [
i8 13, label %7
i8 10, label %7
]
7: ; preds = %6, %6, %1
ret void
}
int Calculator_div(int a, int b) { return a / b; }


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

x86 assembly (clang, -O2):
<Calculator_div>:
mov    %edi,%eax
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @Calculator_div(i32 %0, i32 %1) {
%3 = sdiv i32 %0, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printSum(int n, double x) { printf("printSum says %f.\n", n + x); }


x86 assembly (clang, -O0):
<printSum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printSum>:
cvtsi2sd %edi,%xmm1
addsd  %xmm0,%xmm1
cvttsd2si %xmm1,%esi
lea    0xedd(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"printSum says %f.\0A\00"
define void @printSum(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to double
%7 = load double, double* %4
%8 = fadd double %6, %7
%9 = fptosi double %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"printSum says %f.\0A\00"
define void @printSum(i32 %0, double %1) {
%3 = sitofp i32 %0 to double
%4 = fadd double %3, %1
%5 = fptosi double %4 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}
__attribute__((always_)) void rep_nop(void) {
  __asm__ __volatile__("rep;nop" : : : "memory");
}


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

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

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

LLVM IR (-O2):
define void @rep_nop() {
tail call void asm sideeffect "rep;nop", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int get_random_number(const int bits, unsigned *const state) {
  const int r = *state;
  unsigned bit = ((r >> 0) ^ (r >> 1) ^ (r >> 3) ^ (r >> 12)) & 1;
  *state = (r >> 1) | (bit << 15);
  return (*state >> (16 - bits)) & ((1 << bits) - 1);
}


x86 assembly (clang, -O0):
<get_random_number>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x0,%eax
mov    -0x14(%rbp),%ecx
sar    $0x1,%ecx
xor    %ecx,%eax
mov    -0x14(%rbp),%ecx
sar    $0x3,%ecx
xor    %ecx,%eax
mov    -0x14(%rbp),%ecx
sar    $0xc,%ecx
xor    %ecx,%eax
and    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
sar    $0x1,%ecx
mov    -0x18(%rbp),%eax
shl    $0xf,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0x10,%ecx
sub    -0x4(%rbp),%ecx
shr    %cl,%eax
mov    -0x4(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random_number>:
mov    %edi,%r8d
mov    (%rsi),%eax
mov    %eax,%ecx
sar    %ecx
mov    %ecx,%edx
xor    %eax,%edx
mov    %eax,%edi
shr    $0x3,%edi
shr    $0xc,%eax
xor    %edi,%eax
xor    %edx,%eax
shl    $0xf,%eax
movzwl %ax,%edx
or     %ecx,%edx
mov    %edx,(%rsi)
mov    $0x10,%cl
sub    %r8b,%cl
shr    %cl,%edx
mov    $0xffffffff,%eax
mov    %r8d,%ecx
shl    %cl,%eax
not    %eax
and    %edx,%eax
ret

LLVM IR (-O0):
define i32 @get_random_number(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = ashr i32 %9, 0
%11 = load i32, i32* %5
%12 = ashr i32 %11, 1
%13 = xor i32 %10, %12
%14 = load i32, i32* %5
%15 = ashr i32 %14, 3
%16 = xor i32 %13, %15
%17 = load i32, i32* %5
%18 = ashr i32 %17, 12
%19 = xor i32 %16, %18
%20 = and i32 %19, 1
store i32 %20, i32* %6
%21 = load i32, i32* %5
%22 = ashr i32 %21, 1
%23 = load i32, i32* %6
%24 = shl i32 %23, 15
%25 = or i32 %22, %24
%26 = load i32*, i32** %4
store i32 %25, i32* %26
%27 = load i32*, i32** %4
%28 = load i32, i32* %27
%29 = load i32, i32* %3
%30 = sub nsw i32 16, %29
%31 = lshr i32 %28, %30
%32 = load i32, i32* %3
%33 = shl i32 1, %32
%34 = sub nsw i32 %33, 1
%35 = and i32 %31, %34
ret i32 %35
}

LLVM IR (-O2):
define i32 @get_random_number(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = ashr i32 %3, 1
%5 = xor i32 %4, %3
%6 = lshr i32 %3, 3
%7 = xor i32 %5, %6
%8 = lshr i32 %3, 12
%9 = xor i32 %7, %8
%10 = shl i32 %9, 15
%11 = and i32 %10, 32768
%12 = or i32 %11, %4
store i32 %12, i32* %1
%13 = sub nsw i32 16, %0
%14 = lshr i32 %12, %13
%15 = shl nsw i32 -1, %0
%16 = xor i32 %15, -1
%17 = and i32 %14, %16
ret i32 %17
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void set_uint32_be(uint32_t v, uint8_t *buf) {
  buf[0] = v >> 24;
  buf[1] = v >> 16;
  buf[2] = v >> 8;
  buf[3] = v;
}


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

x86 assembly (clang, -O2):
<set_uint32_be>:
mov    %edi,%eax
sar    $0x18,%eax
mov    %eax,(%rsi)
mov    %edi,%eax
sar    $0x10,%eax
mov    %eax,0x4(%rsi)
mov    %edi,%eax
sar    $0x8,%eax
mov    %eax,0x8(%rsi)
mov    %edi,0xc(%rsi)
ret

LLVM IR (-O0):
define void @set_uint32_be(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 = ashr i32 %5, 24
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %6, i32* %8
%9 = load i32, i32* %3
%10 = ashr i32 %9, 16
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 %10, i32* %12
%13 = load i32, i32* %3
%14 = ashr i32 %13, 8
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 2
store i32 %14, i32* %16
%17 = load i32, i32* %3
%18 = load i32*, i32** %4
%19 = getelementptr inbounds i32, i32* %18, i64 3
store i32 %17, i32* %19
ret void
}

LLVM IR (-O2):
define void @set_uint32_be(i32 %0, i32* nocapture writeonly %1) {
%3 = ashr i32 %0, 24
store i32 %3, i32* %1
%4 = ashr i32 %0, 16
%5 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %4, i32* %5
%6 = ashr i32 %0, 8
%7 = getelementptr inbounds i32, i32* %1, i64 2
store i32 %6, i32* %7
%8 = getelementptr inbounds i32, i32* %1, i64 3
store i32 %0, i32* %8
ret void
}
void element2backreference() {}


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

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

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

LLVM IR (-O2):
define void @element2backreference() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ backtrack(int *, int /*<<< orphan*/, int, int *, int *,
                             int *, int *);
int maxSubArray(int *nums, int numsSize) {
  if (numsSize <= 0)
    return 0;
  int left_max, right_max, current_max, sum;
  backtrack(nums, 0, numsSize - 1, &left_max, &right_max, &current_max, &sum);
  return current_max;
}


x86 assembly (clang, -O0):
<maxSubArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     1135 <maxSubArray+0x25>
movl   $0x0,-0x4(%rbp)
jmp    1160 <maxSubArray+0x50>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
lea    -0x20(%rbp),%r9
lea    -0x24(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <backtrack@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxSubArray>:
test   %esi,%esi
jle    1145 <maxSubArray+0x35>
sub    $0x18,%rsp
mov    %esi,%edx
add    $0xffffffff,%edx
lea    0xc(%rsp),%rax
mov    %rax,(%rsp)
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
lea    0x8(%rsp),%r9
xor    %esi,%esi
call   1030 <backtrack@plt>
mov    0x8(%rsp),%eax
add    $0x18,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @maxSubArray(i32* %0, i32 %1) {
%3 = alloca i32
%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
%10 = load i32, i32* %5
%11 = icmp sle i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %19
13: ; preds = %2
%14 = load i32*, i32** %4
%15 = load i32, i32* %5
%16 = sub nsw i32 %15, 1
%17 = call i32 @backtrack(i32* %14, i32 0, i32 %16, i32* %6, i32* %7, i32* %8, i32* %9)
%18 = load i32, i32* %8
store i32 %18, i32* %3
br label %19
19: ; preds = %13, %12
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @maxSubArray(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = icmp slt i32 %1, 1
br i1 %7, label %16, label %8
8: ; preds = %2
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = add nsw i32 %1, -1
%14 = call i32 @backtrack(i32* %0, i32 0, i32 %13, i32* %3, i32* %4, i32* %5, i32* %6)
%15 = load i32, i32* %5
br label %16
16: ; preds = %2, %8
%17 = phi i32 [ %15, %8 ], [ 0, %2 ]
ret i32 %17
}
float map(float x, float in_min, float in_max, float out_min, float out_max) {
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}


x86 assembly (clang, -O0):
<map>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
addss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<map>:
subss  %xmm1,%xmm0
subss  %xmm3,%xmm4
mulss  %xmm4,%xmm0
subss  %xmm1,%xmm2
divss  %xmm2,%xmm0
addss  %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @map(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%11 = load float, float* %6
%12 = load float, float* %7
%13 = fsub float %11, %12
%14 = load float, float* %10
%15 = load float, float* %9
%16 = fsub float %14, %15
%17 = fmul float %13, %16
%18 = load float, float* %8
%19 = load float, float* %7
%20 = fsub float %18, %19
%21 = fdiv float %17, %20
%22 = load float, float* %9
%23 = fadd float %21, %22
ret float %23
}

LLVM IR (-O2):
define float @map(float %0, float %1, float %2, float %3, float %4) {
%6 = fsub float %0, %1
%7 = fsub float %4, %3
%8 = fmul float %6, %7
%9 = fsub float %2, %1
%10 = fdiv float %8, %9
%11 = fadd float %10, %3
ret float %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("--daemon - run as daemon\n"
         "--debug - enable debug logs\n"
         "--console - output logs to console\n"
         "-l, -log_file - select logs output file\n"
         "-s, -server_port - server listening port\n"
         "-h, -db_host - database host name or ip address. Default: "
         "\"localhost\"\n"
         "-m, -db_port - database port. Default: 3306\n"
         "-n, -db_name - database name. Default: \"task_transporter\"\n"
         "-u, -db_user - database user. Default: \"root\"\n"
         "-p, -db_password - database password, leave empty to connect without "
         "password. Default: \"\"\n"
         "Example:\n"
         "tasktransporter -s 4300 -h localhost -n task_transporter -u root -p "
         "mypassword --daemon\n");
}


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

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

LLVM IR (-O0):
@.str = [576 x i8] c"--daemon - run as daemon\0A--debug - enable debug logs\0A--console - output logs to console\0A-l, -log_file - select logs output file\0A-s, -server_port - server listening port\0A-h, -db_host - database host name or ip address. Default: \22localhost\22\0A-m, -db_port - database port. Default: 3306\0A-n, -db_name - database name. Default: \22task_transporter\22\0A-u, -db_user - database user. Default: \22root\22\0A-p, -db_password - database password, leave empty to connect without password. Default: \22\22\0AExample:\0Atasktransporter -s 4300 -h localhost -n task_transporter -u root -p mypassword --daemon\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([576 x i8], [576 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [575 x i8] c"--daemon - run as daemon\0A--debug - enable debug logs\0A--console - output logs to console\0A-l, -log_file - select logs output file\0A-s, -server_port - server listening port\0A-h, -db_host - database host name or ip address. Default: \22localhost\22\0A-m, -db_port - database port. Default: 3306\0A-n, -db_name - database name. Default: \22task_transporter\22\0A-u, -db_user - database user. Default: \22root\22\0A-p, -db_password - database password, leave empty to connect without password. Default: \22\22\0AExample:\0Atasktransporter -s 4300 -h localhost -n task_transporter -u root -p mypassword --daemon\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([575 x i8], [575 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int do_lib_for_each(int (*)(void *, struct track_info *), void *, int);
int lib_for_each_filtered(int (*cb)(void *data, struct track_info *ti),
                          void *data) {
  return do_lib_for_each(cb, data, 1);
}


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

x86 assembly (clang, -O2):
<lib_for_each_filtered>:
mov    $0x1,%edx
jmp    1030 <do_lib_for_each@plt>

LLVM IR (-O0):
%struct.track_info = type opaque
%struct.track_info.0 = type opaque
define i32 @lib_for_each_filtered(i32 (i8*, %struct.track_info*)* %0, i8* %1) {
%3 = alloca i32 (i8*, %struct.track_info*)*
%4 = alloca i8*
store i32 (i8*, %struct.track_info*)* %0, i32 (i8*, %struct.track_info*)** %3
store i8* %1, i8** %4
%5 = load i32 (i8*, %struct.track_info*)*, i32 (i8*, %struct.track_info*)** %3
%6 = bitcast i32 (i8*, %struct.track_info*)* %5 to i32 (i8*, %struct.track_info.0*)*
%7 = load i8*, i8** %4
%8 = call i32 @do_lib_for_each(i32 (i8*, %struct.track_info.0*)* %6, i8* %7, i32 1)
ret i32 %8
}

LLVM IR (-O2):
%struct.track_info = type opaque
%struct.track_info.0 = type opaque
define i32 @lib_for_each_filtered(i32 (i8*, %struct.track_info*)* %0, i8* %1) {
%3 = bitcast i32 (i8*, %struct.track_info*)* %0 to i32 (i8*, %struct.track_info.0*)*
%4 = tail call i32 @do_lib_for_each(i32 (i8*, %struct.track_info.0*)* %3, i8* %1, i32 1)
ret i32 %4
}
void option_unset_group2dash_option_unset() {}


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

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

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

LLVM IR (-O2):
define void @option_unset_group2dash_option_unset() {
ret void
}
void fix_name(char *n) {
  while (*n) {
    if (' ' == *n)
      *n = '_';
    ++n;
  }
}


x86 assembly (clang, -O0):
<fix_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1141 <fix_name+0x41>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x20,%eax
cmp    %ecx,%eax
jne    1130 <fix_name+0x30>
mov    -0x8(%rbp),%rax
movb   $0x5f,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <fix_name+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fix_name>:
jmp    1117 <fix_name+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x5f,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x20,%al
je     1110 <fix_name+0x10>
test   %al,%al
jne    1113 <fix_name+0x13>
ret

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

LLVM IR (-O2):
define void @fix_name(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 32, label %5
]
5: ; preds = %2
store i8 95, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
int main(void) {
  1 / 1.0;
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
void MWU_IRQHandler(void) { assert(false); }


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

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

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

LLVM IR (-O2):
define void @MWU_IRQHandler() {
%1 = tail call i32 @assert(i32 0)
ret void
}
/* Variables and functions */
void *realloc(void *, size_t);
void *LibTomRealloc(void *p, size_t n) { return realloc(p, n); }


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

x86 assembly (clang, -O2):
<LibTomRealloc>:
jmp    1030 <realloc@plt>

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

LLVM IR (-O2):
define noalias i8* @LibTomRealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void WriteLn(FILE *Fl, char *Buf) { fprintf(Fl, "%s\n", Buf); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @WriteLn(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
void imprime(char *s) {
  while (*s != 0x00) {
    putchar(*s++);
  }
}


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

x86 assembly (clang, -O2):
<imprime>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <imprime+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <imprime+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @imprime(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %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 %14
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = call i32 @putchar(i32 %12)
br label %3
14: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @imprime(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = sext i8 %5 to i32
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = tail call i32 @putchar(i32 %7)
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ overflow(int *, size_t const);
int main(int argc, char **argv) {
  const size_t length = 10;
  int buffer[length];
  overflow(buffer, length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0xa,-0x18(%rbp)
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
mov    $0xa,%esi
call   1030 <overflow@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    %rsp,%rdi
mov    $0xa,%esi
call   1030 <overflow@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 10, i64* %6
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %7
%9 = alloca i32, i64 10
%10 = call i32 @overflow(i32* %9, i64 10)
store i32 0, i32* %3
%11 = load i8*, i8** %7
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i32]
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 0
%5 = call i32 @overflow(i32* %4, i64 10)
ret i32 0
}
int foo(char k) {
  while (k < 100) {
    int i = 0;
    int j = k;
    while (i < j) {
      i = i + 1;
      j = j - 1;
    }
    k = k + 1;
  }
  return k;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x64,%eax
jge    1157 <foo+0x57>
movl   $0x0,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1148 <foo+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <foo+0x25>
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x1(%rbp)
jmp    110a <foo+0xa>
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0x63,%al
sub    %dil,%al
cmp    $0x64,%dil
movzbl %al,%eax
lea    0x1(%rdi,%rax,1),%eax
cmovge %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = icmp slt i8 %0, 100
%4 = sub i8 99, %0
%5 = zext i8 %4 to i32
%6 = add nsw i32 %2, %5
%7 = add nsw i32 %6, 1
%8 = select i1 %3, i32 %7, i32 %2
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ t01_log(int, char *, ...);
void _t01_assert(char *estr, char *file, int line) {
  t01_log(3, "=== ASSERTION FAILED ===");
  t01_log(3, "==> %s:%d '%s' is not true", file, line, estr);
  *((char *)-1) = 'x';
}


x86 assembly (clang, -O0):
<_t01_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x3,%edi
lea    0xed1(%rip),%rsi
mov    $0x0,%al
call   1030 <t01_log@plt>
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%r8
mov    $0x3,%edi
lea    0xecc(%rip),%rsi
mov    $0x0,%al
call   1030 <t01_log@plt>
mov    $0xffffffffffffffff,%rax
movb   $0x78,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_t01_assert>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xedc(%rip),%rsi
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <t01_log@plt>
lea    0xee2(%rip),%rsi
mov    $0x3,%edi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    %rbp,%r8
xor    %eax,%eax
call   1030 <t01_log@plt>
movb   $0x78,0xffffffffffffffff
78
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"=== ASSERTION FAILED ===\00"
@.str.1 = [27 x i8] c"==> %s:%d '%s' is not true\00"
define void @_t01_assert(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = call i32 (i32, i8*, ...) @t01_log(i32 3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i8*, i8** %4
%11 = call i32 (i32, i8*, ...) @t01_log(i32 3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %8, i32 %9, i8* %10)
store i8 120, i8* inttoptr (i64 -1 to i8*)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"=== ASSERTION FAILED ===\00"
@.str.1 = [27 x i8] c"==> %s:%d '%s' is not true\00"
define void @_t01_assert(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 (i32, i8*, ...) @t01_log(i32 3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i32, i8*, ...) @t01_log(i32 3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2, i8* %0)
store i8 120, i8* inttoptr (i64 -1 to i8*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int cusp_icmp_close(void *session) {
  free(session);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @cusp_icmp_close(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i32 0
}
void INT_P6(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_P6() {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool handle_dform(uint32_t insn, unsigned long *gprs, unsigned long *addr) {
  if ((((insn) >> (32 - (11) - (5))) & ((1 << (5)) - 1)) != 0)
    *addr = gprs[(((insn) >> (32 - (11) - (5))) & ((1 << (5)) - 1))];
  *addr +=
      ((((unsigned long)((((insn) >> (32 - (16) - (16))) & ((1 << (16)) - 1))) &
         (((unsigned long)1 << (16)) - 1)) ^
        ((unsigned long)1 << ((16) - 1))) -
       ((unsigned long)1 << ((16) - 1)));
  return true;
}


x86 assembly (clang, -O0):
<handle_dform>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
and    $0x1f,%eax
cmp    $0x0,%eax
je     113c <handle_dform+0x3c>
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
sar    $0x10,%ecx
and    $0x1f,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
and    $0xffff,%eax
movslq %eax,%rcx
and    $0xffff,%rcx
xor    $0x8000,%rcx
sub    $0x8000,%rcx
mov    -0x18(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_dform>:
movzwl %di,%eax
mov    %edi,%ecx
shr    $0x10,%ecx
and    $0x1f,%ecx
lea    (%rsi,%rcx,8),%rcx
cmove  %rdx,%rcx
mov    (%rcx),%rcx
xor    $0x8000,%eax
add    %rcx,%rax
add    $0xffffffffffff8000,%rax
mov    %rax,(%rdx)
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @handle_dform(i32 %0, i64* nocapture %1, i64* nocapture %2) {
%4 = lshr i32 %0, 16
%5 = and i32 %4, 31
%6 = icmp eq i32 %5, 0
%7 = zext i32 %5 to i64
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = select i1 %6, i64* %2, i64* %8
%10 = load i64, i64* %9
%11 = and i32 %0, 65535
%12 = xor i32 %11, 32768
%13 = zext i32 %12 to i64
%14 = add nsw i64 %13, -32768
%15 = add i64 %14, %10
store i64 %15, i64* %2
ret i32 1
}
int test_imm_80uint32_reg(unsigned int val) {
  return ((val) & (0x80 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_80uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x80,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_80uint32_reg>:
test   $0x80,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_80uint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 128
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_80uint32_reg(i32 %0) {
%2 = and i32 %0, 128
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}