xunge/DecIR huggingface dataset:
_setrand(i) int i;
{ srand(i); }


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

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

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

LLVM IR (-O2):
define i32 @_setrand(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @srand to i32 (i32, ...)*)(i32 %0)
ret i32 undef
}
/* Variables and functions */
scalar_t__ sum(int *, unsigned int);
float average(signed *numbers, unsigned length) {
  float s = (float)sum(numbers, length);
  return s / length;
}


x86 assembly (clang, -O0):
<average>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <sum@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
mov    -0xc(%rbp),%eax
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<average>:
push   %rbx
mov    %esi,%ebx
call   1030 <sum@plt>
cvtsi2ss %rax,%xmm0
mov    %ebx,%eax
cvtsi2ss %rax,%xmm1
divss  %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define float @average(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca float
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %4
%8 = call i64 @sum(i32* %6, i32 %7)
%9 = sitofp i64 %8 to float
store float %9, float* %5
%10 = load float, float* %5
%11 = load i32, i32* %4
%12 = uitofp i32 %11 to float
%13 = fdiv float %10, %12
ret float %13
}

LLVM IR (-O2):
define float @average(i32* %0, i32 %1) {
%3 = tail call i64 @sum(i32* %0, i32 %1)
%4 = sitofp i64 %3 to float
%5 = uitofp i32 %1 to float
%6 = fdiv float %4, %5
ret float %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, int /*<<< orphan*/ *, int);
void pack_to_h64(void *v, uint64_t u) { memcpy(v, &u, sizeof(uint64_t)); }


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

x86 assembly (clang, -O2):
<pack_to_h64>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @pack_to_h64(i8* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 @memcpy(i8* %0, i32* %3, i32 4)
ret void
}
/* Variables and functions */
int M_PI;
float dToR(int deg) { return (2 * M_PI * deg) / 360; }


x86 assembly (clang, -O0):
<dToR>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
imul   -0x4(%rbp),%eax
mov    $0x168,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dToR>:
mov    0x2ee1(%rip),%rax
imul   (%rax),%edi
mov    %edi,%eax
add    %edi,%eax
cltq
imul   $0xffffffffb60b60b7,%rax,%rax
shr    $0x20,%rax
lea    (%rax,%rdi,2),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
sar    $0x8,%eax
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
ret

LLVM IR (-O0):
@M_PI = global i32 0
define float @dToR(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @M_PI
%4 = mul nsw i32 2, %3
%5 = load i32, i32* %2
%6 = mul nsw i32 %4, %5
%7 = sdiv i32 %6, 360
%8 = sitofp i32 %7 to float
ret float %8
}

LLVM IR (-O2):
@M_PI = global i32 0
define float @dToR(i32 %0) {
%2 = load i32, i32* @M_PI
%3 = shl i32 %0, 1
%4 = mul i32 %3, %2
%5 = sdiv i32 %4, 360
%6 = sitofp i32 %5 to float
ret float %6
}
/* Variables and functions */
long long gcd(long long, long long);
void divGCD(long long *a, long long *b) {
  long long g = gcd(*a, *b);
  *a /= g;
  *b /= g;
}


x86 assembly (clang, -O0):
<divGCD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1030 <gcd@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    (%rax),%rax
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    (%rax),%rax
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<divGCD>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rdi
mov    (%rsi),%rsi
call   1030 <gcd@plt>
mov    %rax,%rcx
mov    (%rbx),%rax
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     113e <divGCD+0x2e>
cqto
idiv   %rcx
jmp    1142 <divGCD+0x32>
xor    %edx,%edx
div    %ecx
mov    %rax,(%rbx)
mov    (%r14),%rax
mov    %rcx,%rdx
or     %rax,%rdx
shr    $0x20,%rdx
je     115b <divGCD+0x4b>
cqto
idiv   %rcx
jmp    115f <divGCD+0x4f>
xor    %edx,%edx
div    %ecx
mov    %rax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @divGCD(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i64
store i64* %0, i64** %3
store i64* %1, i64** %4
%6 = load i64*, i64** %3
%7 = load i64, i64* %6
%8 = load i64*, i64** %4
%9 = load i64, i64* %8
%10 = call i64 @gcd(i64 %7, i64 %9)
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = load i64*, i64** %3
%13 = load i64, i64* %12
%14 = sdiv i64 %13, %11
store i64 %14, i64* %12
%15 = load i64, i64* %5
%16 = load i64*, i64** %4
%17 = load i64, i64* %16
%18 = sdiv i64 %17, %15
store i64 %18, i64* %16
ret void
}

LLVM IR (-O2):
define void @divGCD(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %0
%4 = load i64, i64* %1
%5 = tail call i64 @gcd(i64 %3, i64 %4)
%6 = load i64, i64* %0
%7 = sdiv i64 %6, %5
store i64 %7, i64* %0
%8 = load i64, i64* %1
%9 = sdiv i64 %8, %5
store i64 %9, i64* %1
ret void
}
void teamd_zmq_fini(struct teamd_context *ctx) {}


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

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

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

LLVM IR (-O2):
%struct.teamd_context = type opaque
define void @teamd_zmq_fini(%struct.teamd_context* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void tcphead(int osvers, int osrel, int ossub) {
  printf("insegs/s outsegs/s  actopen/s pasopen/s  "
         "nowopen                _tcp_");
}


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

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

LLVM IR (-O0):
@.str = [70 x i8] c"insegs/s outsegs/s actopen/s pasopen/s nowopen _tcp_\00"
define void @tcphead(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"insegs/s outsegs/s actopen/s pasopen/s nowopen _tcp_\00"
define void @tcphead(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ser_out(char);
size_t l4kdb_write(void *data, long int position, size_t count, void *handle) {
  size_t i;
  char *real_data = data;
  for (i = 0; i < count; i++)
    ser_out(real_data[i]);
  return count;
}


x86 assembly (clang, -O0):
<l4kdb_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1168 <l4kdb_write+0x58>
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <ser_out@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1138 <l4kdb_write+0x28>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<l4kdb_write>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
test   %rdx,%rdx
je     1143 <l4kdb_write+0x33>
mov    %rdi,%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%r14,%rbx,1),%edi
call   1030 <ser_out@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <l4kdb_write+0x20>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @l4kdb_write(i8* nocapture %0, i64 %1, i64 returned %2, i8* nocapture readnone %3) {
%5 = icmp eq i64 %2, 0
br i1 %5, label %13, label %6
6: ; preds = %4, %6
%7 = phi i64 [ %11, %6 ], [ 0, %4 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = tail call i32 @ser_out(i8 signext %9)
%11 = add nuw i64 %7, 1
%12 = icmp eq i64 %11, %2
br i1 %12, label %13, label %6
13: ; preds = %6, %4
ret i64 %2
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int compare_eq8(uint8_t *p1, uint8_t *p2) {
  uint64_t *sp1, *sp2;
  sp1 = (uint64_t *)p1;
  sp2 = (uint64_t *)p2;
  return (p1[0] == p2[0]);
}


x86 assembly (clang, -O0):
<compare_eq8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_eq8>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmp    (%rsi),%rcx
sete   %al
ret

LLVM IR (-O0):
define i32 @compare_eq8(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca i32*
%6 = alloca i32*
store i64* %0, i64** %3
store i64* %1, i64** %4
%7 = load i64*, i64** %3
%8 = bitcast i64* %7 to i32*
store i32* %8, i32** %5
%9 = load i64*, i64** %4
%10 = bitcast i64* %9 to i32*
store i32* %10, i32** %6
%11 = load i64*, i64** %3
%12 = getelementptr inbounds i64, i64* %11, i64 0
%13 = load i64, i64* %12
%14 = load i64*, i64** %4
%15 = getelementptr inbounds i64, i64* %14, i64 0
%16 = load i64, i64* %15
%17 = icmp eq i64 %13, %16
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @compare_eq8(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %0
%4 = load i64, i64* %1
%5 = icmp eq i64 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ _nb_tests_lassert(int);
int _start_test_lassert(int option, int set_start) {
  static int started = 0;
  if (option) {
    if (!started) {
      started = set_start;
    }
    _nb_tests_lassert(-1);
  } else
    started = 0;
  return started;
}


x86 assembly (clang, -O0):
<_start_test_lassert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     114d <_start_test_lassert+0x3d>
cmpl   $0x0,0x2efd(%rip)
jne    113e <_start_test_lassert+0x2e>
mov    -0x8(%rbp),%eax
mov    %eax,0x2eee(%rip)
mov    $0xffffffff,%edi
call   1030 <_nb_tests_lassert@plt>
jmp    1157 <_start_test_lassert+0x47>
movl   $0x0,0x2ed5(%rip)
mov    0x2ecf(%rip),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_start_test_lassert>:
push   %rax
test   %edi,%edi
je     1136 <_start_test_lassert+0x26>
cmpl   $0x0,0x2f10(%rip)
jne    1124 <_start_test_lassert+0x14>
mov    %esi,0x2f08(%rip)
mov    $0xffffffff,%edi
call   1030 <_nb_tests_lassert@plt>
mov    0x2ef8(%rip),%eax
pop    %rcx
ret
movl   $0x0,0x2eec(%rip)
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@_start_test_lassert.started = internal global i32 0
define i32 @_start_test_lassert(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* @_start_test_lassert.started
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = load i32, i32* %4
store i32 %11, i32* @_start_test_lassert.started
br label %12
12: ; preds = %10, %7
%13 = call i32 @_nb_tests_lassert(i32 -1)
br label %15
14: ; preds = %2
store i32 0, i32* @_start_test_lassert.started
br label %15
15: ; preds = %14, %12
%16 = load i32, i32* @_start_test_lassert.started
ret i32 %16
}

LLVM IR (-O2):
@_start_test_lassert.started = internal unnamed_addr global i32 0
define i32 @_start_test_lassert(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = load i32, i32* @_start_test_lassert.started
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %4
store i32 %1, i32* @_start_test_lassert.started
br label %8
8: ; preds = %7, %4
%9 = tail call i32 @_nb_tests_lassert(i32 -1)
%10 = load i32, i32* @_start_test_lassert.started
br label %12
11: ; preds = %2
store i32 0, i32* @_start_test_lassert.started
br label %12
12: ; preds = %11, %8
%13 = phi i32 [ 0, %11 ], [ %10, %8 ]
ret i32 %13
}
int test_imm_C1uint16_mem(unsigned short *val) {
  return ((*val) & (-0xC1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C1uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xffffff3f,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C1uint16_mem>:
movzwl (%rdi),%eax
test   $0xff3f,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_C1uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -193
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct timeval {
  long tv_usec;
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long current_time_us(void) {
  struct timeval t;
  gettimeofday(&t, NULL);
  return t.tv_usec + t.tv_sec * 1000000;
}


x86 assembly (clang, -O0):
<current_time_us>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x10(%rbp),%rax
imul   $0xf4240,-0x8(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_time_us>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x10(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x8(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i32 }
define i64 @current_time_us() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i32, i32* %5
%7 = mul nsw i32 %6, 1000000
%8 = sext i32 %7 to i64
%9 = add nsw i64 %4, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i64, i32 }
define i64 @current_time_us() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000000
%9 = sext i32 %8 to i64
%10 = add nsw i64 %5, %9
ret i64 %10
}
/* Variables and functions */
int __isascii(char);
int /*<<< orphan*/ assert(int);
int isascii(char);
int main() {
  assert(isascii('0'));
  assert(isascii('b'));
  assert(__isascii('['));
  assert((((125) & ~0x7f) == 0));
  assert((((127) & ~0x7f) == 0));
  assert(!(((128) & ~0x7f) == 0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x30,%edi
call   1050 <isascii@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x62,%edi
call   1050 <isascii@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x5b,%edi
call   1030 <__isascii@plt>
mov    %eax,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @isascii(i8 signext 48)
%3 = call i32 @assert(i32 %2)
%4 = call i32 @isascii(i8 signext 98)
%5 = call i32 @assert(i32 %4)
%6 = call i32 @__isascii(i8 signext 91)
%7 = call i32 @assert(i32 %6)
%8 = call i32 @assert(i32 1)
%9 = call i32 @assert(i32 1)
%10 = call i32 @assert(i32 1)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @isascii(i8 signext 48)
%2 = tail call i32 @assert(i32 %1)
%3 = tail call i32 @isascii(i8 signext 98)
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @__isascii(i8 signext 91)
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
void FileIO_setFileContent(char *file_path, char *file_content) {
  FILE *fp;
  fp = fopen(file_path, "w+");
  fputs(file_content, fp);
  fclose(fp);
}


x86 assembly (clang, -O0):
<FileIO_setFileContent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FileIO_setFileContent>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
lea    0xec2(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"w+\00"
define void @FileIO_setFileContent(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i8*, i8** %4
%9 = load i32*, i32** %5
%10 = call i32 @fputs(i8* %8, i32* %9)
%11 = load i32*, i32** %5
%12 = call i32 @fclose(i32* %11)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"w+\00"
define void @FileIO_setFileContent(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @fputs(i8* %1, i32* %3)
%5 = tail call i32 @fclose(i32* %3)
ret void
}
void *utf8cpy(void *__restrict__ dst, const void *__restrict__ src) {
  char *d = (char *)dst;
  const char *s = (const char *)src;
  while ('\0' != *s) {
    *d++ = *s++;
  }
  *d = '\0';
  return dst;
}


x86 assembly (clang, -O0):
<utf8cpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     1154 <utf8cpy+0x54>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    111c <utf8cpy+0x1c>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8cpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %rdi,%rdx
test   %cl,%cl
je     1131 <utf8cpy+0x31>
add    $0x1,%rsi
mov    %rax,%rdx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %cl,(%rdx)
add    $0x1,%rdx
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1120 <utf8cpy+0x20>
movb   $0x0,(%rdx)
ret

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

LLVM IR (-O2):
define i8* @utf8cpy(i8* noalias returned writeonly %0, i8* noalias nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %8
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret i8* %0
}
int check_ippkt_is_ok(struct netutil_iphdr *iphdr) { return 1; }


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

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

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

LLVM IR (-O2):
%struct.netutil_iphdr = type opaque
define i32 @check_ippkt_is_ok(%struct.netutil_iphdr* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void copyright() { printf("CMD2CAS 1.0 (C) 2005 by Attila Grosz\n"); }


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"CMD2CAS 1.0 (C) 2005 by Attila Grosz\0A\00"
define void @copyright() {
%1 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [37 x i8] c"CMD2CAS 1.0 (C) 2005 by Attila Grosz\00"
define void @copyright() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int x_root;
};
typedef TYPE_1__ XKeyPressedEvent;

/* Variables and functions */
void set_XKeyPressedEvent_x_root(void *_p, int _v) {
  ((XKeyPressedEvent *)_p)->x_root = (int)_v;
}


x86 assembly (clang, -O0):
<set_XKeyPressedEvent_x_root>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XKeyPressedEvent_x_root>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XKeyPressedEvent_x_root(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XKeyPressedEvent_x_root(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int htonl(int /*<<< orphan*/);
int /*<<< orphan*/ sysv_chksm(unsigned char const *, int);
int zyxel_chksm(const unsigned char *data, int size) {
  return htonl(sysv_chksm(data, size));
}


x86 assembly (clang, -O0):
<zyxel_chksm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <sysv_chksm@plt>
mov    %eax,%edi
call   1030 <htonl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zyxel_chksm>:
push   %rax
call   1040 <sysv_chksm@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <htonl@plt>

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

LLVM IR (-O2):
define i32 @zyxel_chksm(i8* %0, i32 %1) {
%3 = tail call i32 @sysv_chksm(i8* %0, i32 %1)
%4 = tail call i32 @htonl(i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void grpcsharp_channel_args_create() {
  fprintf(stderr, "Should never reach here");
  abort();
}


x86 assembly (clang, -O0):
<grpcsharp_channel_args_create>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<grpcsharp_channel_args_create>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_channel_args_create() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Should never reach here\00"
define void @grpcsharp_channel_args_create() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0xff() {
  Assert_real((isodigit(255) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              1280, ("isodigit should be 0 for 0xff"));
}


x86 assembly (clang, -O0):
<t_isodigit_0xff>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff,%edi
call   1040 <isodigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x500,%edx
lea    0xf5c(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isodigit_0xff>:
push   %rax
mov    $0xff,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x500,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xff\00"
define void @t_isodigit_0xff() {
%1 = call i64 @isodigit(i32 255)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1280, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xff\00"
define void @t_isodigit_0xff() {
%1 = tail call i64 @isodigit(i32 255)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1280, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int RAND_MAX;
long long get_next_random();
int cl_rand_from_interval(const int a, const int b) {
  long long r = get_next_random();
  r = a + (r * (b - a) + RAND_MAX / 2) / RAND_MAX;
  return r;
}


x86 assembly (clang, -O0):
<cl_rand_from_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get_next_random@plt>
mov    %rax,-0x10(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
movslq %ecx,%rcx
imul   %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    0x2e7e(%rip),%rcx
movslq (%rcx),%rcx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cl_rand_from_interval>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <get_next_random@plt>
sub    %ebx,%ebp
movslq %ebp,%rdx
imul   %rax,%rdx
mov    0x2eba(%rip),%rax
movslq (%rax),%rcx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
cltq
add    %rdx,%rax
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
je     1152 <cl_rand_from_interval+0x42>
cqto
idiv   %rcx
jmp    1156 <cl_rand_from_interval+0x46>
xor    %edx,%edx
div    %ecx
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i32 0
define i32 @cl_rand_from_interval(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i64 (...) @get_next_random()
store i64 %6, i64* %5
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = load i64, i64* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = sub nsw i32 %10, %11
%13 = sext i32 %12 to i64
%14 = mul nsw i64 %9, %13
%15 = load i32, i32* @RAND_MAX
%16 = sdiv i32 %15, 2
%17 = sext i32 %16 to i64
%18 = add nsw i64 %14, %17
%19 = load i32, i32* @RAND_MAX
%20 = sext i32 %19 to i64
%21 = sdiv i64 %18, %20
%22 = add nsw i64 %8, %21
store i64 %22, i64* %5
%23 = load i64, i64* %5
%24 = trunc i64 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
@RAND_MAX = global i32 0
define i32 @cl_rand_from_interval(i32 %0, i32 %1) {
%3 = tail call i64 (...) @get_next_random()
%4 = sub nsw i32 %1, %0
%5 = sext i32 %4 to i64
%6 = mul nsw i64 %3, %5
%7 = load i32, i32* @RAND_MAX
%8 = sdiv i32 %7, 2
%9 = sext i32 %8 to i64
%10 = add nsw i64 %6, %9
%11 = sext i32 %7 to i64
%12 = sdiv i64 %10, %11
%13 = trunc i64 %12 to i32
%14 = add i32 %13, %0
ret i32 %14
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t next_ptr(uint32_t ptr, uint32_t size, uint32_t alignment_bits) {
  uint32_t a = (1 << alignment_bits) - 1;
  return (ptr + size + a) & ~a;
}


x86 assembly (clang, -O0):
<next_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_ptr>:
mov    %edx,%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
mov    %edx,%eax
not    %eax
add    %edi,%eax
add    %esi,%eax
and    %edx,%eax
ret

LLVM IR (-O0):
define i32 @next_ptr(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = shl i32 1, %8
%10 = sub nsw i32 %9, 1
store i32 %10, i32* %7
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = add nsw i32 %11, %12
%14 = load i32, i32* %7
%15 = add nsw i32 %13, %14
%16 = load i32, i32* %7
%17 = xor i32 %16, -1
%18 = and i32 %15, %17
ret i32 %18
}

LLVM IR (-O2):
define i32 @next_ptr(i32 %0, i32 %1, i32 %2) {
%4 = shl nsw i32 -1, %2
%5 = xor i32 %4, -1
%6 = add nsw i32 %1, %0
%7 = add nsw i32 %6, %5
%8 = and i32 %7, %4
ret i32 %8
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t get_short(const void *ptr) {
  const uint8_t *cp = (const uint8_t *)ptr;
  uint16_t sh;
  sh = *cp++;
  sh = (sh << 8) | *cp;
  return (sh);
}


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

x86 assembly (clang, -O2):
<get_short>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @get_short(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = getelementptr inbounds i8, i8* %0, i64 4
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %2
%6 = shl i32 %5, 8
%7 = load i32, i32* %4
%8 = or i32 %6, %7
ret i32 %8
}
/* Type definitions */
typedef scalar_t__ int64_t;

/* Variables and functions */
int64_t bound_int64(int64_t val, int64_t min, int64_t max) {
  return val < min ? min : (val > max ? max : val);
}


x86 assembly (clang, -O0):
<bound_int64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    112b <bound_int64+0x2b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1156 <bound_int64+0x56>
mov    -0x8(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1146 <bound_int64+0x46>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    114e <bound_int64+0x4e>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bound_int64>:
mov    %rdx,%rax
cmp    %rdx,%rdi
cmovle %rdi,%rax
cmp    %rsi,%rdi
cmovl  %rsi,%rax
ret

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

LLVM IR (-O2):
define i64 @bound_int64(i64 %0, i64 %1, i64 %2) {
%4 = icmp slt i64 %0, %1
%5 = icmp sgt i64 %0, %2
%6 = select i1 %5, i64 %2, i64 %0
%7 = select i1 %4, i64 %1, i64 %6
ret i64 %7
}
/* Variables and functions */
int EXIT_SUCCESS;
int runforpath(char *);
int main(int argc, char **argv) {
  int status = EXIT_SUCCESS;
  for (int argi = 1; argi < argc; ++argi) {
    status = runforpath(argv[argi]);
  }
  return status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1167 <main+0x57>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <runforpath@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1139 <main+0x29>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     1144 <main+0x34>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1030 <runforpath@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <main+0x20>
jmp    114d <main+0x3d>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = zext i32 %0 to i64
br label %9
7: ; preds = %9, %2
%8 = phi i32 [ %3, %2 ], [ %13, %9 ]
ret i32 %8
9: ; preds = %5, %9
%10 = phi i64 [ 1, %5 ], [ %14, %9 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %10
%12 = load i8*, i8** %11
%13 = tail call i32 @runforpath(i8* %12)
%14 = add nuw nsw i64 %10, 1
%15 = icmp eq i64 %14, %6
br i1 %15, label %7, label %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ bswap_32(int /*<<< orphan*/);
uint32_t ByteSwap32(uint32_t d) { return bswap_32(d); }


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

x86 assembly (clang, -O2):
<ByteSwap32>:
jmp    1030 <bswap_32@plt>

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

LLVM IR (-O2):
define i32 @ByteSwap32(i32 %0) {
%2 = tail call i32 @bswap_32(i32 %0)
ret i32 %2
}
/* Type definitions */
struct Z {
  int dummy;
};
struct S {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ h3(struct Z *);
void g3(struct S *s) { h3((struct Z *)s); }


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

x86 assembly (clang, -O2):
<g3>:
jmp    1030 <h3@plt>

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

LLVM IR (-O2):
%struct.S = type { i32 }
%struct.Z = type { i32 }
define void @g3(%struct.S* %0) {
%2 = bitcast %struct.S* %0 to %struct.Z*
%3 = tail call i32 @h3(%struct.Z* %2)
ret void
}
double _speed() { return 1.25; }


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

x86 assembly (clang, -O2):
<_speed>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @_speed() {
ret double 1.250000e+00
}

LLVM IR (-O2):
define double @_speed() {
ret double 1.250000e+00
}
float power(int a, int exp) {
  float result = 1.0;
  while (exp > 0) {
    result = result * a;
    exp--;
  }
  return result;
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  0xeee(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1142 <power+0x42>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1117 <power+0x17>
movss  -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
test   %esi,%esi
jle    1134 <power+0x34>
cvtsi2ss %edi,%xmm1
lea    -0x1(%rsi),%eax
mov    %esi,%ecx
and    $0x7,%ecx
je     113d <power+0x3d>
xor    %edx,%edx
movss  0xee4(%rip),%xmm0
nopl   0x0(%rax)
mulss  %xmm1,%xmm0
add    $0x1,%edx
cmp    %edx,%ecx
jne    1120 <power+0x20>
sub    %edx,%esi
cmp    $0x7,%eax
jae    114a <power+0x4a>
jmp    1178 <power+0x78>
movss  0xec4(%rip),%xmm0
ret
movss  0xebb(%rip),%xmm0
cmp    $0x7,%eax
jb     1178 <power+0x78>
add    $0xffffffff,%esi
nopl   (%rax)
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
add    $0xfffffff8,%esi
cmp    $0xfffffffe,%esi
jb     1150 <power+0x50>
ret

LLVM IR (-O0):
define float @power(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i32 %0, i32* %3
store i32 %1, i32* %4
store float 1.000000e+00, float* %5
br label %6
6: ; preds = %9, %2
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = load float, float* %5
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
%13 = fmul float %10, %12
store float %13, float* %5
%14 = load i32, i32* %4
%15 = add nsw i32 %14, -1
store i32 %15, i32* %4
br label %6
16: ; preds = %6
%17 = load float, float* %5
ret float %17
}

LLVM IR (-O2):
define float @power(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %36
4: ; preds = %2
%5 = sitofp i32 %0 to float
%6 = add i32 %1, -1
%7 = and i32 %1, 7
%8 = icmp eq i32 %7, 0
br i1 %8, label %17, label %9
9: ; preds = %4, %9
%10 = phi float [ %13, %9 ], [ 1.000000e+00, %4 ]
%11 = phi i32 [ %14, %9 ], [ %1, %4 ]
%12 = phi i32 [ %15, %9 ], [ 0, %4 ]
%13 = fmul float %10, %5
%14 = add nsw i32 %11, -1
%15 = add i32 %12, 1
%16 = icmp eq i32 %15, %7
br i1 %16, label %17, label %9
17: ; preds = %9, %4
%18 = phi float [ 1.000000e+00, %4 ], [ %13, %9 ]
%19 = phi i32 [ %1, %4 ], [ %14, %9 ]
%20 = phi float [ undef, %4 ], [ %13, %9 ]
%21 = icmp ult i32 %6, 7
br i1 %21, label %36, label %22
22: ; preds = %17, %22
%23 = phi float [ %32, %22 ], [ %18, %17 ]
%24 = phi i32 [ %33, %22 ], [ %19, %17 ]
%25 = fmul float %23, %5
%26 = fmul float %25, %5
%27 = fmul float %26, %5
%28 = fmul float %27, %5
%29 = fmul float %28, %5
%30 = fmul float %29, %5
%31 = fmul float %30, %5
%32 = fmul float %31, %5
%33 = add nsw i32 %24, -8
%34 = add i32 %24, -9
%35 = icmp ult i32 %34, -2
br i1 %35, label %22, label %36
36: ; preds = %17, %22, %2
%37 = phi float [ 1.000000e+00, %2 ], [ %20, %17 ], [ %32, %22 ]
ret float %37
}
/* Variables and functions */
int /*<<< orphan*/ VIM_SIF_I2cReadByte(unsigned char, unsigned char *);
void SensorGetReg_SIV100B(unsigned char uAddr, unsigned short *uVal) {
  VIM_SIF_I2cReadByte((unsigned char)uAddr, (unsigned char *)uVal);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rsi
movzbl %al,%edi
call   1030 <VIM_SIF_I2cReadByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @SensorGetReg_SIV100B(i8 zeroext %0, i16* %1) {
%3 = alloca i8
%4 = alloca i16*
store i8 %0, i8* %3
store i16* %1, i16** %4
%5 = load i8, i8* %3
%6 = load i16*, i16** %4
%7 = bitcast i16* %6 to i8*
%8 = call i32 @VIM_SIF_I2cReadByte(i8 zeroext %5, i8* %7)
ret void
}

LLVM IR (-O2):
define void @SensorGetReg_SIV100B(i8 zeroext %0, i16* %1) {
%3 = bitcast i16* %1 to i8*
%4 = tail call i32 @VIM_SIF_I2cReadByte(i8 zeroext %0, i8* %3)
ret void
}