xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
float stdlib_strided_smeanlipw(int, float *, int);
int main() {
  float x[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0};
  int64_t N = 4;
  int64_t stride = 2;
  float v = stdlib_strided_smeanlipw(N, x, stride);
  printf("mean: %f\n", v);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
mov    -0x24(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%edx
call   1040 <stdlib_strided_smeanlipw@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edi
mov    $0x2,%edx
call   1040 <stdlib_strided_smeanlipw@plt>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.x = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [10 x i8] c"mean: %f\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = bitcast [8 x float]* %1 to i8*
store i32 4, i32* %2
store i32 2, i32* %3
%6 = load i32, i32* %2
%7 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call float @stdlib_strided_smeanlipw(i32 %6, float* %7, i32 %8)
store float %9, float* %4
%10 = load float, float* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), float %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.x = [8 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00, float 5.000000e+00, float 6.000000e+00, float 7.000000e+00, float 8.000000e+00]
@.str = [10 x i8] c"mean: %f\0A\00"
define i32 @main() {
%1 = alloca [8 x float]
%2 = bitcast [8 x float]* %1 to i8*
%3 = getelementptr inbounds [8 x float], [8 x float]* %1, i64 0, i64 0
%4 = call float @stdlib_strided_smeanlipw(i32 4, float* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), float %4)
ret i32 0
}
double mod(double x) {
  if (x < 0)
    x = x * (-1);
  return x;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1129 <mod+0x29>
movsd  0xee1(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @mod(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fmul double %6, -1.000000e+00
store double %7, double* %2
br label %8
8: ; preds = %5, %1
%9 = load double, double* %2
ret double %9
}

LLVM IR (-O2):
define double @mod(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
/* Variables and functions */
scalar_t__ jumphash(unsigned int, size_t);
size_t _bucket_for(unsigned int hash_str, size_t num_buckets,
                   int force_consistent_hashing) {
  size_t bucket;
  if (force_consistent_hashing) {
    bucket = (size_t)jumphash(hash_str, num_buckets);
  } else {
    bucket = hash_str % num_buckets;
  }
  return bucket;
}


x86 assembly (clang, -O0):
<_bucket_for>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1141 <_bucket_for+0x31>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <jumphash@plt>
mov    %rax,-0x20(%rbp)
jmp    1150 <_bucket_for+0x40>
mov    -0x4(%rbp),%eax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_bucket_for>:
test   %edx,%edx
je     1119 <_bucket_for+0x9>
jmp    1030 <jumphash@plt>
mov    %edi,%eax
cmp    %rsi,%rax
jb     1126 <_bucket_for+0x16>
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i64 @_bucket_for(i32 %0, i64 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
%7 = alloca i64
store i32 %0, i32* %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32, i32* %4
%12 = load i64, i64* %5
%13 = call i64 @jumphash(i32 %11, i64 %12)
store i64 %13, i64* %7
br label %19
14: ; preds = %3
%15 = load i32, i32* %4
%16 = zext i32 %15 to i64
%17 = load i64, i64* %5
%18 = urem i64 %16, %17
store i64 %18, i64* %7
br label %19
19: ; preds = %14, %10
%20 = load i64, i64* %7
ret i64 %20
}

LLVM IR (-O2):
define i64 @_bucket_for(i32 %0, i64 %1, i32 %2) {
%4 = icmp eq i32 %2, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i64 @jumphash(i32 %0, i64 %1)
br label %10
7: ; preds = %3
%8 = zext i32 %0 to i64
%9 = urem i64 %8, %1
br label %10
10: ; preds = %7, %5
%11 = phi i64 [ %6, %5 ], [ %9, %7 ]
ret i64 %11
}
void ipf_except() {}


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

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

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

LLVM IR (-O2):
define void @ipf_except() {
ret void
}
/* Type definitions */
struct Address {
  int dummy;
};

/* Variables and functions */
int address_compare(struct Address *, struct Address *);
int /*<<< orphan*/ free(struct Address *);
struct Address *new_address(char const *);
int compare_address_strings(const char *a, const char *b) {
  struct Address *addr_a = new_address(a);
  struct Address *addr_b = new_address(b);
  int result = address_compare(addr_a, addr_b);
  free(addr_a);
  free(addr_b);
  return result;
}


x86 assembly (clang, -O0):
<compare_address_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <new_address@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <new_address@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <address_compare@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_address_strings>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1050 <new_address@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1050 <new_address@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <address_compare@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.Address = type { i32 }
define i32 @compare_address_strings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.Address*
%6 = alloca %struct.Address*
%7 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = call %struct.Address* @new_address(i8* %8)
store %struct.Address* %9, %struct.Address** %5
%10 = load i8*, i8** %4
%11 = call %struct.Address* @new_address(i8* %10)
store %struct.Address* %11, %struct.Address** %6
%12 = load %struct.Address*, %struct.Address** %5
%13 = load %struct.Address*, %struct.Address** %6
%14 = call i32 @address_compare(%struct.Address* %12, %struct.Address* %13)
store i32 %14, i32* %7
%15 = load %struct.Address*, %struct.Address** %5
%16 = call i32 @free(%struct.Address* %15)
%17 = load %struct.Address*, %struct.Address** %6
%18 = call i32 @free(%struct.Address* %17)
%19 = load i32, i32* %7
ret i32 %19
}

LLVM IR (-O2):
%struct.Address = type { i32 }
define i32 @compare_address_strings(i8* %0, i8* %1) {
%3 = tail call %struct.Address* @new_address(i8* %0)
%4 = tail call %struct.Address* @new_address(i8* %1)
%5 = tail call i32 @address_compare(%struct.Address* %3, %struct.Address* %4)
%6 = tail call i32 @free(%struct.Address* %3)
%7 = tail call i32 @free(%struct.Address* %4)
ret i32 %5
}
int getTxPowerScale(int mode) {
  switch (mode) {
  case 0:
    return 0;
  case 1:
    return 3;
  case 2:
    return 6;
  case 3:
    return 9;
  case 4:
    return 17;
  }
}


x86 assembly (clang, -O0):
<getTxPowerScale>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x4,%rax
ja     1163 <getTxPowerScale+0x63>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    1163 <getTxPowerScale+0x63>
movl   $0x3,-0x4(%rbp)
jmp    1163 <getTxPowerScale+0x63>
movl   $0x6,-0x4(%rbp)
jmp    1163 <getTxPowerScale+0x63>
movl   $0x9,-0x4(%rbp)
jmp    1163 <getTxPowerScale+0x63>
movl   $0x11,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getTxPowerScale>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x3,%edi
ja     1117 <getTxPowerScale+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @getTxPowerScale(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 0, label %5
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
]
5: ; preds = %1
store i32 0, i32* %2
br label %10
6: ; preds = %1
store i32 3, i32* %2
br label %10
7: ; preds = %1
store i32 6, i32* %2
br label %10
8: ; preds = %1
store i32 9, i32* %2
br label %10
9: ; preds = %1
store i32 17, i32* %2
br label %10
10: ; preds = %5, %6, %7, %8, %9, %1
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@switch.table.getTxPowerScale = [4 x i32] [i32 3, i32 6, i32 9, i32 17]
define i32 @getTxPowerScale(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 4
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.getTxPowerScale, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
int inc(int pos, int n) {
  if (pos + n < 128) {
    return pos + n;
  } else {
    putchar('\n');
    return n;
  }
}


x86 assembly (clang, -O0):
<inc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x80,%eax
jge    113d <inc+0x2d>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114d <inc+0x3d>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inc>:
mov    %edi,%eax
add    %esi,%eax
cmp    $0x80,%eax
jl     112b <inc+0x1b>
push   %rbx
mov    %esi,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @inc(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = add nsw i32 %6, %7
%9 = icmp slt i32 %8, 128
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
store i32 %13, i32* %3
br label %17
14: ; preds = %2
%15 = call i32 @putchar(i8 signext 10)
%16 = load i32, i32* %5
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @inc(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
%4 = icmp slt i32 %3, 128
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @putchar(i8 signext 10)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %1, %5 ], [ %3, %2 ]
ret i32 %8
}
/* Type definitions */
struct location_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void sky_location_endian_swap(struct location_t *p) {
  assert(p != NULL);
  ;
  ;
  ;
  ;
}


x86 assembly (clang, -O0):
<sky_location_endian_swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sky_location_endian_swap>:
xor    %eax,%eax
test   %rdi,%rdi
setne  %al
mov    %eax,%edi
jmp    1030 <assert@plt>

LLVM IR (-O0):
%struct.location_t = type { i32 }
define void @sky_location_endian_swap(%struct.location_t* %0) {
%2 = alloca %struct.location_t*
store %struct.location_t* %0, %struct.location_t** %2
%3 = load %struct.location_t*, %struct.location_t** %2
%4 = icmp ne %struct.location_t* %3, null
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
ret void
}

LLVM IR (-O2):
%struct.location_t = type { i32 }
define void @sky_location_endian_swap(%struct.location_t* readnone %0) {
%2 = icmp ne %struct.location_t* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
ret void
}
void g_filename_to_uri() {}


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

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

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

LLVM IR (-O2):
define void @g_filename_to_uri() {
ret void
}
/* Variables and functions */
size_t write(int, ...);
int send_bytes(int fd, const char *msg, size_t len) {
  int result = -1;
  if (write(fd, &len, sizeof(size_t)) > 0)
    if (write(fd, msg, len) == len)
      result = 0;
  return result;
}


x86 assembly (clang, -O0):
<send_bytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <write@plt>
cmp    $0x0,%rax
jbe    116f <send_bytes+0x5f>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1030 <write@plt>
cmp    -0x18(%rbp),%rax
jne    116a <send_bytes+0x5a>
movl   $0x0,-0x1c(%rbp)
jmp    116f <send_bytes+0x5f>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_bytes>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rdx,(%rsp)
mov    %rsp,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1030 <write@plt>
test   %rax,%rax
je     1150 <send_bytes+0x40>
mov    (%rsp),%rdx
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <write@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    (%rsp),%rcx
setne  %al
neg    %eax
jmp    1155 <send_bytes+0x45>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @send_bytes(i32 %0, i8* %1, i64 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
store i32 -1, i32* %7
%8 = load i32, i32* %4
%9 = call i64 (i32, ...) @write(i32 %8, i64* %6, i64 8)
%10 = icmp ugt i64 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %3
%12 = load i32, i32* %4
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = call i64 (i32, ...) @write(i32 %12, i8* %13, i64 %14)
%16 = load i64, i64* %6
%17 = icmp eq i64 %15, %16
br i1 %17, label %18, label %19
18: ; preds = %11
store i32 0, i32* %7
br label %19
19: ; preds = %18, %11
br label %20
20: ; preds = %19, %3
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
define i32 @send_bytes(i32 %0, i8* %1, i64 %2) {
%4 = alloca i64
store i64 %2, i64* %4
%5 = call i64 (i32, ...) @write(i32 %0, i64* %4, i64 8)
%6 = icmp eq i64 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %3
%8 = load i64, i64* %4
%9 = call i64 (i32, ...) @write(i32 %0, i8* %1, i64 %8)
%10 = load i64, i64* %4
%11 = icmp ne i64 %9, %10
%12 = sext i1 %11 to i32
br label %13
13: ; preds = %7, %3
%14 = phi i32 [ -1, %3 ], [ %12, %7 ]
ret i32 %14
}
void hieth_phy_reset(void) {}


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

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

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

LLVM IR (-O2):
define void @hieth_phy_reset() {
ret void
}
char *bazelSays(void) { return "It's me, Bazel!"; }


x86 assembly (clang, -O0):
<bazelSays>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bazelSays>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [16 x i8] c"It's me, Bazel!\00"
define i8* @bazelSays() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [16 x i8] c"It's me, Bazel!\00"
define i8* @bazelSays() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ minprintf(char *, int, double, ...);
int main(void) {
  minprintf("i:%d, j:%f, k:%s\n", 1, 2.1, "test");
  minprintf("i:%x, j:%e\n", 18, 2.1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee2(%rip),%rdi
mov    $0x1,%esi
movsd  0xecd(%rip),%xmm0
lea    0xee0(%rip),%rdx
mov    $0x1,%al
call   1030 <minprintf@plt>
lea    0xed7(%rip),%rdi
mov    $0x12,%esi
movsd  0xeab(%rip),%xmm0
mov    $0x1,%al
call   1030 <minprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
lea    0xefb(%rip),%rdx
movsd  0xed9(%rip),%xmm0
mov    $0x1,%esi
mov    $0x1,%al
call   1030 <minprintf@plt>
lea    0xee5(%rip),%rdi
mov    $0x12,%esi
movsd  0xeb9(%rip),%xmm0
mov    $0x1,%al
call   1030 <minprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"i:%d, j:%f, k:%s\0A\00"
@.str.1 = [5 x i8] c"test\00"
@.str.2 = [12 x i8] c"i:%x, j:%e\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, i32, double, ...) @minprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1, double 2.100000e+00, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (i8*, i32, double, ...) @minprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 18, double 2.100000e+00)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"i:%d, j:%f, k:%s\0A\00"
@.str.1 = [5 x i8] c"test\00"
@.str.2 = [12 x i8] c"i:%x, j:%e\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, i32, double, ...) @minprintf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 1, double 2.100000e+00, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (i8*, i32, double, ...) @minprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 18, double 2.100000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(double *, char const *, int);
double bson_parse_double(const char *cur) {
  double out;
  (memcpy(&out, cur, 8));
  return out;
}


x86 assembly (clang, -O0):
<bson_parse_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bson_parse_double>:
push   %rax
mov    %rdi,%rsi
mov    %rsp,%rdi
mov    $0x8,%edx
call   1030 <memcpy@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @bson_parse_double(i8* %0) {
%2 = alloca i8*
%3 = alloca double
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @memcpy(double* %3, i8* %4, i32 8)
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @bson_parse_double(i8* %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
%4 = call i32 @memcpy(double* %2, i8* %0, i32 8)
%5 = load double, double* %2
ret double %5
}
/* Variables and functions */
void const *GppcFinfoV1();
const void *pg_finfo_datefunc3_mday(void) { return GppcFinfoV1(); }


x86 assembly (clang, -O0):
<pg_finfo_datefunc3_mday>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <GppcFinfoV1@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @pg_finfo_datefunc3_mday() {
%1 = call i8* (...) @GppcFinfoV1()
ret i8* %1
}

LLVM IR (-O2):
define i8* @pg_finfo_datefunc3_mday() {
%1 = tail call i8* (...) @GppcFinfoV1()
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int help_load(int argc, char **argv) {
  printf("\n\033[1mload [filename]\033[0m\n"
         "  Load the configuration/script from the file [filename] "
         "(startup.vpc is the default filename).\n"
         "  When the file is loaded, commands will be displayed before being "
         "executed \n"
         "  if the state of the echo flag is on. See \033[1mset echo\033[0m\n"
         "  \033[1msleep\033[0m command will ignore \033[1mset echo on\033[0m, "
         "ONLY if \033[1msleep\033[0m misses the <text>\n"
         "  parameter. \n\n"
         "  Note: Press Ctrl+C to interrupt the running script\n");
  return 1;
}


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

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

LLVM IR (-O0):
@.str = [424 x i8] c"\0A\1B[1mload [filename]\1B[0m\0A Load the configuration/script from the file [filename] (startup.vpc is the default filename).\0A When the file is loaded, commands will be displayed before being executed \0A if the state of the echo flag is on. See \1B[1mset echo\1B[0m\0A \1B[1msleep\1B[0m command will ignore \1B[1mset echo on\1B[0m, ONLY if \1B[1msleep\1B[0m misses the <text>\0A parameter. \0A\0A Note: Press Ctrl+C to interrupt the running script\0A\00"
define i32 @help_load(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([424 x i8], [424 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@str = [423 x i8] c"\0A\1B[1mload [filename]\1B[0m\0A Load the configuration/script from the file [filename] (startup.vpc is the default filename).\0A When the file is loaded, commands will be displayed before being executed \0A if the state of the echo flag is on. See \1B[1mset echo\1B[0m\0A \1B[1msleep\1B[0m command will ignore \1B[1mset echo on\1B[0m, ONLY if \1B[1msleep\1B[0m misses the <text>\0A parameter. \0A\0A Note: Press Ctrl+C to interrupt the running script\00"
define i32 @help_load(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([423 x i8], [423 x i8]* @str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
int icost(int);
int isind(int d) {
  int dd = 64 - d / 4;
  return icost(dd);
}


x86 assembly (clang, -O0):
<isind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    $0x40,%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <icost@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isind>:
lea    0x3(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x2,%eax
mov    $0x40,%edi
sub    %eax,%edi
jmp    1030 <icost@plt>

LLVM IR (-O0):
define i32 @isind(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 4
%6 = sub nsw i32 64, %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @icost(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @isind(i32 %0) {
%2 = sdiv i32 %0, -4
%3 = add nsw i32 %2, 64
%4 = tail call i32 @icost(i32 %3)
ret i32 %4
}
void gtk_tool_item_get_orientation() {}


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

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

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

LLVM IR (-O2):
define void @gtk_tool_item_get_orientation() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cos(int /*<<< orphan*/);
int /*<<< orphan*/ exp(double);
double pow(int /*<<< orphan*/, double);
double f(double x, void *params) {
  double f = pow(cos(exp(x)), 2.0);
  return f;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
mov    %eax,%edi
call   1040 <cos@plt>
mov    %eax,%edi
movsd  0xea4(%rip),%xmm0
call   1050 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
call   1030 <exp@plt>
mov    %eax,%edi
call   1040 <cos@plt>
movsd  0xebb(%rip),%xmm0
mov    %eax,%edi
pop    %rax
jmp    1050 <pow@plt>

LLVM IR (-O0):
define double @f(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca double
store double %0, double* %3
store i8* %1, i8** %4
%6 = load double, double* %3
%7 = call i32 @exp(double %6)
%8 = call i32 @cos(i32 %7)
%9 = call double @pow(i32 %8, double 2.000000e+00)
store double %9, double* %5
%10 = load double, double* %5
ret double %10
}

LLVM IR (-O2):
define double @f(double %0, i8* nocapture readnone %1) {
%3 = tail call i32 @exp(double %0)
%4 = tail call i32 @cos(i32 %3)
%5 = tail call double @pow(i32 %4, double 2.000000e+00)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(int arr[], int _arraySize) {
  int i;
  for (i = 0; i < _arraySize; i++)
    printf("%d\t", *(arr + i));
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_array+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @print_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
int unlink(char *name) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @unlink(i8* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ date_unix2dos(int /*<<< orphan*/, unsigned short *,
                                 unsigned short *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned short, unsigned short);
void unix2yapp(time_t unix_date, char *buffer) {
  unsigned short time, date;
  date_unix2dos(unix_date, &time, &date);
  sprintf(buffer, "%04X%04X", date, time);
}


x86 assembly (clang, -O0):
<unix2yapp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x12(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <date_unix2dos@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ax
lea    0xeb2(%rip),%rsi
movzwl %ax,%edx
movzwl -0x12(%rbp),%ecx
call   1040 <sprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unix2yapp>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xe(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1030 <date_unix2dos@plt>
movzwl 0xc(%rsp),%edx
movzwl 0xe(%rsp),%ecx
lea    0xeb8(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%04X%04X\00"
define void @unix2yapp(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i16
store i32 %0, i32* %3
store i8* %1, i8** %4
%7 = load i32, i32* %3
%8 = call i32 @date_unix2dos(i32 %7, i16* %5, i16* %6)
%9 = load i8*, i8** %4
%10 = load i16, i16* %6
%11 = load i16, i16* %5
%12 = call i32 @sprintf(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i16 zeroext %10, i16 zeroext %11)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%04X%04X\00"
define void @unix2yapp(i32 %0, i8* nocapture writeonly %1) {
%3 = alloca i16
%4 = alloca i16
%5 = bitcast i16* %3 to i8*
%6 = bitcast i16* %4 to i8*
%7 = call i32 @date_unix2dos(i32 %0, i16* %3, i16* %4)
%8 = load i16, i16* %4
%9 = load i16, i16* %3
%10 = call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i16 zeroext %8, i16 zeroext %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void foo(int n, int m) {
  if (m == 0)
    exit(0);
  else if (n != 0)
    abort();
  else
    foo(n++, m - 1);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    114f <foo+0x1f>
xor    %edi,%edi
call   1050 <exit@plt>
cmpl   $0x0,-0x4(%rbp)
je     1160 <foo+0x30>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1040 <foo@plt>
jmp    117b <foo+0x4b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
test   %esi,%esi
je     1130 <foo+0x10>
test   %edi,%edi
je     1130 <foo+0x10>
xor    %eax,%eax
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %9
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
br label %19
19: ; preds = %14
br label %20
20: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = icmp eq i32 %0, 0
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
%9 = tail call i32 (...) @abort()
unreachable
}
unsigned int digits(unsigned int x, int base) {
  if (x == 0)
    return 1;
  unsigned int ret;
  for (ret = 0; x > 0; x /= base, ++ret)
    ;
  return ret;
}


x86 assembly (clang, -O0):
<digits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1120 <digits+0x20>
movl   $0x1,-0x4(%rbp)
jmp    1157 <digits+0x57>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jbe    1151 <digits+0x51>
jmp    1136 <digits+0x36>
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
xor    %edx,%edx
div    %ecx
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1127 <digits+0x27>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digits>:
test   %edi,%edi
je     1122 <digits+0x22>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %esi
add    $0x1,%ecx
cmp    %esi,%edi
mov    %eax,%edi
jae    1110 <digits+0x10>
mov    %ecx,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @digits(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %10, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %8, %4 ], [ 0, %2 ]
%6 = phi i32 [ %7, %4 ], [ %0, %2 ]
%7 = udiv i32 %6, %1
%8 = add i32 %5, 1
%9 = icmp ult i32 %6, %1
br i1 %9, label %10, label %4
10: ; preds = %4, %2
%11 = phi i32 [ 1, %2 ], [ %8, %4 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("test"); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"test\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ roadmap_mood_dialog(int /*<<< orphan*/ *);
void roadmap_mood(void) { roadmap_mood_dialog(NULL); }


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

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

LLVM IR (-O0):
define void @roadmap_mood() {
%1 = call i32 @roadmap_mood_dialog(i32* null)
ret void
}

LLVM IR (-O2):
define void @roadmap_mood() {
%1 = tail call i32 @roadmap_mood_dialog(i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int /*<<< orphan*/ xxx(int);
int main() {
  foo(27);
  xxx(27);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1b,%edi
call   1040 <foo@plt>
mov    $0x1b,%edi
call   1030 <xxx@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @foo(i32 27)
%2 = call i32 @xxx(i32 27)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @foo(i32 27)
%2 = tail call i32 @xxx(i32 27)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void banner(void) {
  fprintf(stderr, "ECM - Encoder for Error Code Modeler format v1.0\n"
                  "Copyright (C) 2002 Neill Corlett\n\n");
}


x86 assembly (clang, -O0):
<banner>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<banner>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [84 x i8] c"ECM - Encoder for Error Code Modeler format v1.0\0ACopyright (C) 2002 Neill Corlett\0A\0A\00"
define void @banner() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [84 x i8] c"ECM - Encoder for Error Code Modeler format v1.0\0ACopyright (C) 2002 Neill Corlett\0A\0A\00"
define void @banner() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([84 x i8], [84 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_64uint8_reg(unsigned char val) {
  return ((val) & (-0x64 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_64uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffff9c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_64uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -100
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int intlen(int i) {
  int len = 0;
  if (i < 0) {
    len++;
    i = -i;
  }
  do {
    len++;
    i /= 10;
  } while (i);
  return len;
}


x86 assembly (clang, -O0):
<intlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1129 <intlen+0x29>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112e <intlen+0x2e>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112e <intlen+0x2e>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<intlen>:
mov    %edi,%eax
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
shr    $0x1f,%eax
nopl   0x0(%rax)
add    $0x1,%eax
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
add    $0x9,%edx
cmp    $0x12,%edx
ja     1110 <intlen+0x10>
ret

LLVM IR (-O0):
define i32 @intlen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = sub nsw i32 0, %9
store i32 %10, i32* %2
br label %11
11: ; preds = %6, %1
br label %12
12: ; preds = %17, %11
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = load i32, i32* %2
%16 = sdiv i32 %15, 10
store i32 %16, i32* %2
br label %17
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp ne i32 %18, 0
br i1 %19, label %12, label %20
20: ; preds = %17
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @intlen(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%3 = lshr i32 %0, 31
br label %4
4: ; preds = %4, %1
%5 = phi i32 [ %2, %1 ], [ %8, %4 ]
%6 = phi i32 [ %3, %1 ], [ %7, %4 ]
%7 = add nuw nsw i32 %6, 1
%8 = sdiv i32 %5, 10
%9 = add i32 %5, 9
%10 = icmp ult i32 %9, 19
br i1 %10, label %11, label %4
11: ; preds = %4
ret i32 %7
}
double count_flops(int n) {
  return ((4.0 * (double)n - 3.0) * (double)n - 1.0) * (double)n / 6.0;
}


x86 assembly (clang, -O0):
<count_flops>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xefc(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xef8(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed3(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeb6(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_flops>:
cvtsi2sd %edi,%xmm1
movsd  0xef4(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xef0(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0xeec(%rip),%xmm0
mulsd  %xmm1,%xmm0
divsd  0xee8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @count_flops(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %4, double -3.000000e+00)
%6 = load i32, i32* %2
%7 = sitofp i32 %6 to double
%8 = call double @llvm.fmuladd.f64(double %5, double %7, double -1.000000e+00)
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = fmul double %8, %10
%12 = fdiv double %11, 6.000000e+00
ret double %12
}

LLVM IR (-O2):
define double @count_flops(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 4.000000e+00, double -3.000000e+00)
%4 = tail call double @llvm.fmuladd.f64(double %3, double %2, double -1.000000e+00)
%5 = fmul double %4, %2
%6 = fdiv double %5, 6.000000e+00
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ printHexWord(unsigned short);
void printHexDword(unsigned int dword) {
  printHexWord((unsigned short)((dword & 0xFFFF0000) >> 16));
  printHexWord((unsigned short)(dword & 0xFFFF));
}


x86 assembly (clang, -O0):
<printHexDword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xffff0000,%eax
shr    $0x10,%eax
movzwl %ax,%edi
call   1030 <printHexWord@plt>
mov    -0x4(%rbp),%eax
and    $0xffff,%eax
movzwl %ax,%edi
call   1030 <printHexWord@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printHexDword>:
push   %rbx
mov    %edi,%ebx
shr    $0x10,%edi
call   1030 <printHexWord@plt>
movzwl %bx,%edi
pop    %rbx
jmp    1030 <printHexWord@plt>

LLVM IR (-O0):
define void @printHexDword(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -65536
%5 = lshr i32 %4, 16
%6 = trunc i32 %5 to i16
%7 = call i32 @printHexWord(i16 zeroext %6)
%8 = load i32, i32* %2
%9 = and i32 %8, 65535
%10 = trunc i32 %9 to i16
%11 = call i32 @printHexWord(i16 zeroext %10)
ret void
}

LLVM IR (-O2):
define void @printHexDword(i32 %0) {
%2 = lshr i32 %0, 16
%3 = trunc i32 %2 to i16
%4 = tail call i32 @printHexWord(i16 zeroext %3)
%5 = trunc i32 %0 to i16
%6 = tail call i32 @printHexWord(i16 zeroext %5)
ret void
}
int str_to_int(const char *text) {
  int v = 0;
  while (*text >= '0' && *text <= '9') {
    char num;
    num = *text++ - '0';
    if (v)
      v *= 10;
    v += num;
  }
  return v;
}


x86 assembly (clang, -O0):
<str_to_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0xe(%rbp)
jl     1134 <str_to_int+0x34>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
test   $0x1,%al
jne    1144 <str_to_int+0x44>
jmp    117c <str_to_int+0x7c>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %al,-0xd(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116d <str_to_int+0x6d>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
movsbl -0xd(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <str_to_int+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_to_int>:
mov    (%rdi),%cl
lea    -0x30(%rcx),%edx
xor    %eax,%eax
cmp    $0x9,%dl
ja     113b <str_to_int+0x3b>
add    $0x1,%rdi
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0xd0,%cl
lea    (%rax,%rax,4),%eax
movzbl %cl,%ecx
lea    (%rcx,%rax,2),%eax
movzbl (%rdi),%ecx
lea    -0x30(%rcx),%edx
add    $0x1,%rdi
cmp    $0xa,%dl
jb     1120 <str_to_int+0x20>
ret

LLVM IR (-O0):
define i32 @str_to_int(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %3
br label %5
5: ; preds = %29, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp sge i32 %8, 48
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp sle i32 %13, 57
br label %15
15: ; preds = %10, %5
%16 = phi i1 [ false, %5 ], [ %14, %10 ]
br i1 %16, label %17, label %34
17: ; preds = %15
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
%20 = load i8, i8* %18
%21 = sext i8 %20 to i32
%22 = sub nsw i32 %21, 48
%23 = trunc i32 %22 to i8
store i8 %23, i8* %4
%24 = load i32, i32* %3
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %17
%27 = load i32, i32* %3
%28 = mul nsw i32 %27, 10
store i32 %28, i32* %3
br label %29
29: ; preds = %26, %17
%30 = load i8, i8* %4
%31 = sext i8 %30 to i32
%32 = load i32, i32* %3
%33 = add nsw i32 %32, %31
store i32 %33, i32* %3
br label %5
34: ; preds = %15
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @str_to_int(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -48
%4 = icmp ult i8 %3, 10
br i1 %4, label %5, label %17
5: ; preds = %1, %5
%6 = phi i8 [ %14, %5 ], [ %2, %1 ]
%7 = phi i8* [ %9, %5 ], [ %0, %1 ]
%8 = phi i32 [ %13, %5 ], [ 0, %1 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = add nsw i8 %6, -48
%11 = mul i32 %8, 10
%12 = zext i8 %10 to i32
%13 = add nsw i32 %11, %12
%14 = load i8, i8* %9
%15 = add i8 %14, -48
%16 = icmp ult i8 %15, 10
br i1 %16, label %5, label %17
17: ; preds = %5, %1
%18 = phi i32 [ 0, %1 ], [ %13, %5 ]
ret i32 %18
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t subp12345(uint32_t x) { return x - 12345; }


x86 assembly (clang, -O0):
<subp12345>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x3039,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<subp12345>:
lea    -0x3039(%rdi),%rax
ret

LLVM IR (-O0):
define i64 @subp12345(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub nsw i64 %3, 12345
ret i64 %4
}

LLVM IR (-O2):
define i64 @subp12345(i64 %0) {
%2 = add nsw i64 %0, -12345
ret i64 %2
}