xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int flock(int, int);
int lockf(int fd, int cmd, off_t ignored_len) { return flock(fd, cmd); }


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

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

LLVM IR (-O0):
define i32 @lockf(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 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = call i32 @flock(i32 %7, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @lockf(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @flock(i32 %0, i32 %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_mainloop_get_api() {
  printf("NOT IMPLEMENTED:"
         "pa_mainloop_get_api"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"NOT IMPLEMENTED:pa_mainloop_get_api\0A\00"
define i32 @pa_mainloop_get_api() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [36 x i8] c"NOT IMPLEMENTED:pa_mainloop_get_api\00"
define i32 @pa_mainloop_get_api() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
const char *rte_version(void) {
  static char version[32];
  if (version[0] != 0)
    return version;
  if (strlen("") == 0)
    snprintf(version, sizeof(version), "%s %d.%d.%d", "RTE", 2, 2, 0);
  else
    snprintf(version, sizeof(version), "%s %d.%d.%d%s%d", "RTE", 2, 2, 0, "",
             16 < 16 ? 16 : 16 - 16);
  return version;
}


x86 assembly (clang, -O0):
<rte_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsbl 0x2f21(%rip),%eax
cmp    $0x0,%eax
je     1138 <rte_version+0x28>
lea    0x2f11(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1176 <rte_version+0x66>
lea    0x2f01(%rip),%rdi
mov    $0x20,%esi
lea    0xeb5(%rip),%rdx
lea    0xeba(%rip),%rcx
mov    $0x2,%r9d
xor    %eax,%eax
mov    %r9d,%r8d
movl   $0x0,(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    0x2ece(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rte_version>:
push   %rax
cmpb   $0x0,0x2f28(%rip)
jne    114e <rte_version+0x3e>
movl   $0x0,(%rsp)
lea    0x2f18(%rip),%rdi
lea    0xed1(%rip),%rdx
lea    0xed6(%rip),%rcx
mov    $0x20,%esi
mov    $0x2,%r8d
mov    $0x2,%r9d
xor    %eax,%eax
call   1030 <snprintf@plt>
lea    0x2eeb(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@rte_version.version = internal global [32 x i8] zeroinitializer
@.str = [12 x i8] c"%s %d.%d.%d\00"
@.str.1 = [4 x i8] c"RTE\00"
define i8* @rte_version() {
%1 = alloca i8*
%2 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0)
%3 = sext i8 %2 to i32
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0), i8** %1
br label %8
6: ; preds = %0
%7 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0), i64 32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 2, i32 0)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0), i8** %1
br label %8
8: ; preds = %6, %5
%9 = load i8*, i8** %1
ret i8* %9
}

LLVM IR (-O2):
@rte_version.version = internal global [32 x i8] zeroinitializer
@.str = [12 x i8] c"%s %d.%d.%d\00"
@.str.1 = [4 x i8] c"RTE\00"
define i8* @rte_version() {
%1 = load i8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0)
%2 = icmp eq i8 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (i8*, i64, i8*, ...) @snprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0), i64 32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 2, i32 2, i32 0)
br label %5
5: ; preds = %0, %3
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @rte_version.version, i64 0, i64 0)
}
void inc_zcache_put_to_flush(void) {}


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

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

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

LLVM IR (-O2):
define void @inc_zcache_put_to_flush() {
ret void
}
void foo774() {}


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

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

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

LLVM IR (-O2):
define void @foo774() {
ret void
}
void iommu_detach_device(struct iommu_domain *domain, struct device *dev) {}


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

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

LLVM IR (-O0):
%struct.iommu_domain = type opaque
%struct.device = type opaque
define void @iommu_detach_device(%struct.iommu_domain* %0, %struct.device* %1) {
%3 = alloca %struct.iommu_domain*
%4 = alloca %struct.device*
store %struct.iommu_domain* %0, %struct.iommu_domain** %3
store %struct.device* %1, %struct.device** %4
ret void
}

LLVM IR (-O2):
%struct.iommu_domain = type opaque
%struct.device = type opaque
define void @iommu_detach_device(%struct.iommu_domain* nocapture %0, %struct.device* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage(void) {
  printf("usage: blogc-make [-h] [-v] [-D] [-V] [-f FILE] [RULE ...]\n");
}


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

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

LLVM IR (-O0):
@.str = [60 x i8] c"usage: blogc-make [-h] [-v] [-D] [-V] [-f FILE] [RULE ...]\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [59 x i8] c"usage: blogc-make [-h] [-v] [-D] [-V] [-f FILE] [RULE ...]\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
float fahrenheitFromCelsius(float cel) {
  float fahr = cel * 1.8 + 32.0;
  printf("%f Celsius is %f Fahrenheit\n", cel, fahr);
  return fahr;
}


x86 assembly (clang, -O0):
<fahrenheitFromCelsius>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xed2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xece(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fahrenheitFromCelsius>:
push   %rax
cvtss2sd %xmm0,%xmm1
mulsd  0xee3(%rip),%xmm1
addsd  0xee3(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x4(%rsp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@.str = [29 x i8] c"%f Celsius is %f Fahrenheit\0A\00"
define float @fahrenheitFromCelsius(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = call double @llvm.fmuladd.f64(double %5, double 1.800000e+00, double 3.200000e+01)
%7 = fptrunc double %6 to float
store float %7, float* %3
%8 = load float, float* %2
%9 = load float, float* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %8, float %9)
%11 = load float, float* %3
ret float %11
}

LLVM IR (-O2):
@.str = [29 x i8] c"%f Celsius is %f Fahrenheit\0A\00"
define float @fahrenheitFromCelsius(float %0) {
%2 = fpext float %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.800000e+00, double 3.200000e+01)
%4 = fptrunc double %3 to float
%5 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), float %0, float %4)
ret float %4
}
int ffi_test_2(int x, int y) { return x + y; }


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

x86 assembly (clang, -O2):
<ffi_test_2>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @ffi_test_2(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ uart_send_crlf();
int /*<<< orphan*/ uart_send_string(char *);
void send_ok(void) {
  uart_send_string("OK");
  uart_send_crlf();
}


x86 assembly (clang, -O0):
<send_ok>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <uart_send_string@plt>
mov    $0x0,%al
call   1030 <uart_send_crlf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_ok>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <uart_send_string@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <uart_send_crlf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"OK\00"
define void @send_ok() {
%1 = call i32 @uart_send_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @uart_send_crlf()
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"OK\00"
define void @send_ok() {
%1 = tail call i32 @uart_send_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @uart_send_crlf()
ret void
}
int test_imm_A6int16_mem(short *val) {
  return ((*val) & (-0xA6 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A6int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -166
%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_A6int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -166
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int main(void) {
  int s = -1;
  1 >> s;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
float sqrt(float);
int main(void) {
  float a = 16.0;
  float b = sqrt(a);
  printf("sqrt(a) = %f\n", b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <sqrt@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"sqrt(a) = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 1.600000e+01, float* %2
%4 = load float, float* %2
%5 = call float @sqrt(float %4)
store float %5, float* %3
%6 = load float, float* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"sqrt(a) = %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float 4.000000e+00)
ret i32 0
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *malloc_and_zero(size_t size) {
  void *buf = malloc(size);
  memset(buf, 0, size);
  return (buf);
}


x86 assembly (clang, -O0):
<malloc_and_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_and_zero>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @malloc_and_zero(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i64, i64* %2
%8 = call i32 @memset(i8* %6, i32 0, i64 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @malloc_and_zero(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = tail call i32 @memset(i8* %2, i32 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
bool isPrime(unsigned long long int i) {
  unsigned long long int n;
  for (n = 2; n <= i / 2; n++) {
    if (i % n == 0)
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x1,%rcx
cmp    %rcx,%rax
ja     115d <isPrime+0x5d>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
cmp    $0x0,%rdx
jne    1147 <isPrime+0x47>
movl   $0x0,-0x4(%rbp)
jmp    1164 <isPrime+0x64>
jmp    114c <isPrime+0x4c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1110 <isPrime+0x10>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
mov    $0x1,%r8d
cmp    $0x4,%rdi
jb     115d <isPrime+0x5d>
mov    %rdi,%rax
shr    %rax
mov    $0x1,%esi
sub    %rax,%rsi
mov    $0x2,%ecx
nop
mov    %rdi,%rax
or     %rcx,%rax
shr    $0x20,%rax
je     1140 <isPrime+0x40>
mov    %rdi,%rax
xor    %edx,%edx
div    %rcx
test   %rdx,%rdx
jne    114b <isPrime+0x4b>
jmp    1161 <isPrime+0x61>
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
test   %rdx,%rdx
je     1161 <isPrime+0x61>
lea    (%rsi,%rcx,1),%rax
add    $0x1,%rax
add    $0x1,%rcx
cmp    $0x2,%rax
jne    1120 <isPrime+0x20>
mov    %r8d,%eax
ret
xor    %r8d,%r8d
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @isPrime(i64 %0) {
%2 = icmp ult i64 %0, 4
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = lshr i64 %0, 1
br label %8
5: ; preds = %8
%6 = add nuw i64 %9, 1
%7 = icmp eq i64 %9, %4
br i1 %7, label %12, label %8
8: ; preds = %3, %5
%9 = phi i64 [ %6, %5 ], [ 2, %3 ]
%10 = urem i64 %0, %9
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %8, %5, %1
%13 = phi i32 [ 1, %1 ], [ 1, %5 ], [ 0, %8 ]
ret i32 %13
}
/* Type definitions */
typedef scalar_t__ uint_fast64_t;

/* Variables and functions */
bool SHAREMIND_MAP_KEY_LESS_uint_fast64_t(uint_fast64_t const k1,
                                          uint_fast64_t const k2) {
  return k1 < k2;
}


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

x86 assembly (clang, -O2):
<SHAREMIND_MAP_KEY_LESS_uint_fast64_t>:
xor    %eax,%eax
cmp    %rsi,%rdi
setl   %al
ret

LLVM IR (-O0):
define i32 @SHAREMIND_MAP_KEY_LESS_uint_fast64_t(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @SHAREMIND_MAP_KEY_LESS_uint_fast64_t(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
struct chunk {
  int dummy;
};

/* Variables and functions */
scalar_t__ allocate_object(int);
struct chunk *allocate_chunk() {
  struct chunk *chk;
  chk = (struct chunk *)allocate_object(18);
  return (chk);
}


x86 assembly (clang, -O0):
<allocate_chunk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x12,%edi
call   1030 <allocate_object@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocate_chunk>:
mov    $0x12,%edi
jmp    1030 <allocate_object@plt>

LLVM IR (-O0):
%struct.chunk = type { i32 }
define %struct.chunk* @allocate_chunk() {
%1 = alloca %struct.chunk*
%2 = call i64 @allocate_object(i32 18)
%3 = inttoptr i64 %2 to %struct.chunk*
store %struct.chunk* %3, %struct.chunk** %1
%4 = load %struct.chunk*, %struct.chunk** %1
ret %struct.chunk* %4
}

LLVM IR (-O2):
%struct.chunk = type { i32 }
define %struct.chunk* @allocate_chunk() {
%1 = tail call i64 @allocate_object(i32 18)
%2 = inttoptr i64 %1 to %struct.chunk*
ret %struct.chunk* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
void nocrash_feof() {
  FILE *f;
  f = fopen("this_file_doesnt_exist", "r");
  if (f) {
    feof(f);
    fclose(f);
  }
}


x86 assembly (clang, -O0):
<nocrash_feof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116c <nocrash_feof+0x3c>
mov    -0x8(%rbp),%rdi
call   1040 <feof@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nocrash_feof>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xed8(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     115d <nocrash_feof+0x2d>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <feof@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fclose@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @nocrash_feof() {
%1 = alloca i32*
%2 = call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = icmp ne i32* %3, null
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = load i32*, i32** %1
%7 = call i32 @feof(i32* %6)
%8 = load i32*, i32** %1
%9 = call i32 @fclose(i32* %8)
br label %10
10: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"this_file_doesnt_exist\00"
@.str.1 = [2 x i8] c"r\00"
define void @nocrash_feof() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @feof(i32* %1)
%5 = tail call i32 @fclose(i32* %1)
br label %6
6: ; preds = %3, %0
ret void
}
int fun(int a[], int m, int n) {
  int i;
  for (i = 0; i < n; i++)
    if (m == a[i])
      return i + 1;
  return 0;
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1156 <fun+0x56>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1143 <fun+0x43>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115d <fun+0x5d>
jmp    1148 <fun+0x48>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <fun+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
test   %edx,%edx
jle    111e <fun+0x1e>
mov    %edx,%ecx
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
cmp    %esi,(%rdi,%rax,4)
je     1121 <fun+0x21>
add    $0x1,%rax
cmp    %rax,%rcx
jne    1110 <fun+0x10>
xor    %eax,%eax
ret
add    $0x1,%eax
ret

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

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

/* Variables and functions */
void BOOT_SetResumeStackPointer(uint32_t stack_pointer) {
  void (*p_BOOT_SetResumeStackPointer)(uint32_t stack_pointer);
  p_BOOT_SetResumeStackPointer = (void (*)(uint32_t stack_pointer))0x03000ea9U;
  p_BOOT_SetResumeStackPointer(stack_pointer);
}


x86 assembly (clang, -O0):
<BOOT_SetResumeStackPointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x3000ea9,%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BOOT_SetResumeStackPointer>:
mov    $0x3000ea9,%eax
jmp    *%rax

LLVM IR (-O0):
define void @BOOT_SetResumeStackPointer(i32 %0) {
%2 = alloca i32
%3 = alloca void (i32)*
store i32 %0, i32* %2
store void (i32)* inttoptr (i64 50335401 to void (i32)*), void (i32)** %3
%4 = load void (i32)*, void (i32)** %3
%5 = load i32, i32* %2
ret void
}

LLVM IR (-O2):
define void @BOOT_SetResumeStackPointer(i32 %0) {
tail call void inttoptr (i64 50335401 to void (i32)*)(i32 %0)
ret void
}
unsigned xrop3_134_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  unsigned stk4;
  stk4 = D | S;
  stk3 = T & stk4;
  stk2 = S ^ stk3;
  stk1 = D ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_134_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
and    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_134_1_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
lea    (%rcx,%rdi,1),%eax
mov    %esi,%edx
shl    $0x8,%edx
or     %esi,%edx
or     $0xff,%ecx
and    %edx,%ecx
xor    %eax,%ecx
xor    $0xff,%ecx
not    %eax
and    %ecx,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_134_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = shl i32 %13, 8
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = or i32 %14, %16
store i32 %17, i32* %6
%18 = load i8, i8* %4
%19 = zext i8 %18 to i32
%20 = shl i32 %19, 8
%21 = load i8, i8* %4
%22 = zext i8 %21 to i32
%23 = or i32 %20, %22
store i32 %23, i32* %7
%24 = load i32, i32* %5
%25 = load i32, i32* %6
%26 = or i32 %24, %25
store i32 %26, i32* %11
%27 = load i32, i32* %7
%28 = load i32, i32* %11
%29 = and i32 %27, %28
store i32 %29, i32* %10
%30 = load i32, i32* %6
%31 = load i32, i32* %10
%32 = xor i32 %30, %31
store i32 %32, i32* %9
%33 = load i32, i32* %5
%34 = load i32, i32* %9
%35 = xor i32 %33, %34
store i32 %35, i32* %8
%36 = load i32, i32* %8
%37 = load i32, i32* %6
%38 = xor i32 %37, -1
%39 = and i32 %36, %38
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = and i32 %40, %41
%43 = or i32 %39, %42
ret i32 %43
}

LLVM IR (-O2):
define i32 @xrop3_134_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = or i32 %4, %3
%6 = zext i8 %1 to i32
%7 = mul nuw nsw i32 %6, 257
%8 = or i32 %4, 255
%9 = and i32 %7, %8
%10 = xor i32 %5, %9
%11 = xor i32 %10, 255
%12 = xor i32 %5, -1
%13 = and i32 %11, %12
%14 = or i32 %13, %3
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ isblank(int);
void uninitvar_isblank(void) {
  int i;
  (void)isblank(i);
}


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

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

LLVM IR (-O0):
define void @uninitvar_isblank() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @isblank(i32 %2)
ret void
}

LLVM IR (-O2):
define void @uninitvar_isblank() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int reverse(int num) {
  int rev = 0;
  while (num > 0) {
    rev = num % 10;
    printf("%d", rev);
    num = num / 10;
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    115e <reverse+0x4e>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1122 <reverse+0x12>
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1165 <reverse+0x45>
mov    %edi,%ebp
lea    0xecc(%rip),%r14
mov    $0xcccccccd,%r15d
nopw   0x0(%rax,%rax,1)
mov    %ebp,%ebx
imul   %r15,%rbx
shr    $0x23,%rbx
lea    (%rbx,%rbx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ebp,%esi
sub    %eax,%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x9,%ebp
mov    %ebx,%ebp
ja     1140 <reverse+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @reverse(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %2
%9 = srem i32 %8, 10
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 10
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @reverse(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ %0, %1 ]
%5 = urem i32 %4, 10
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = udiv i32 %4, 10
%8 = icmp ult i32 %4, 10
br i1 %8, label %9, label %3
9: ; preds = %3, %1
%10 = tail call i32 @putchar(i32 10)
ret i32 0
}
int is_big_endian(void) {
  long one = 1;
  return !(*((char *)(&one)));
}


x86 assembly (clang, -O0):
<is_big_endian>:
push   %rbp
mov    %rsp,%rbp
movq   $0x1,-0x8(%rbp)
cmpb   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @is_big_endian() {
%1 = alloca i64
store i64 1, i64* %1
%2 = bitcast i64* %1 to i8*
%3 = load i8, i8* %2
%4 = icmp ne i8 %3, 0
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_big_endian() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int xwait(void) {
  printf("wait() not implemented\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<xwait>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<xwait>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"wait() not implemented\0A\00"
define i32 @xwait() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [23 x i8] c"wait() not implemented\00"
define i32 @xwait() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
void X509_REQ_get_attr(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_REQ_get_attr() {
ret void
}
char *DbgPutString(char *p, char *s) {
  while (*p++ = *s++)
    ;
  return p - 1;
}


x86 assembly (clang, -O0):
<DbgPutString>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     113b <DbgPutString+0x3b>
jmp    110c <DbgPutString+0xc>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DbgPutString>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl (%rsi),%ecx
add    $0x1,%rsi
mov    %cl,0x1(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <DbgPutString+0x10>
ret

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

LLVM IR (-O2):
define i8* @DbgPutString(i8* writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %4
}
/* Type definitions */
typedef unsigned char uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
void read32(FILE *in, uint32_t *p) {
  unsigned char q[4];
  fread(q, 1, 4, in);
  *p = q[0] | q[1] << 8 | q[2] << 16 | q[3] << 24;
  return;
}


x86 assembly (clang, -O0):
<read32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
movzbl -0x14(%rbp),%eax
movzbl -0x13(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzbl -0x12(%rbp),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
movzbl -0x11(%rbp),%ecx
shl    $0x18,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read32>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %rdi,%rcx
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fread@plt>
mov    0xc(%rsp),%al
mov    %al,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @read32(i32* nocapture %0, i8* nocapture writeonly %1) {
%3 = alloca [4 x i8]
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = call i32 @fread(i8* %4, i32 1, i32 4, i32* %0)
%6 = load i8, i8* %4
store i8 %6, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int mod3() {
  printf("mod3\n");
  return 3;
}


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

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

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

LLVM IR (-O2):
@str = [5 x i8] c"mod3\00"
define i32 @mod3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
ret i32 3
}
/* Type definitions */
struct rusage {
  long ru_maxrss;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
long errno;
scalar_t__ getrusage(int /*<<< orphan*/, struct rusage *);
long memuse1(void) {
  struct rusage usage;
  long result;
  errno = 0;
  if (0 == getrusage(RUSAGE_SELF, &usage))
    result = usage.ru_maxrss;
  else
    result = -errno;
  return result;
}


x86 assembly (clang, -O0):
<memuse1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
movq   $0x0,(%rax)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <getrusage@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    1153 <memuse1+0x43>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1163 <memuse1+0x53>
xor    %eax,%eax
mov    0x2e84(%rip),%rcx
sub    (%rcx),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memuse1>:
push   %rbx
sub    $0x10,%rsp
mov    0x2ec4(%rip),%rbx
movq   $0x0,(%rbx)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <getrusage@plt>
test   %rax,%rax
jne    1142 <memuse1+0x32>
mov    0x8(%rsp),%rax
jmp    1147 <memuse1+0x37>
xor    %eax,%eax
sub    (%rbx),%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rusage = type { i64 }
@errno = global i64 0
@RUSAGE_SELF = global i32 0
define i64 @memuse1() {
%1 = alloca %struct.rusage
%2 = alloca i64
store i64 0, i64* @errno
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i64 @getrusage(i32 %3, %struct.rusage* %1)
%5 = icmp eq i64 0, %4
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i32 0, i32 0
%8 = load i64, i64* %7
store i64 %8, i64* %2
br label %12
9: ; preds = %0
%10 = load i64, i64* @errno
%11 = sub nsw i64 0, %10
store i64 %11, i64* %2
br label %12
12: ; preds = %9, %6
%13 = load i64, i64* %2
ret i64 %13
}

LLVM IR (-O2):
%struct.rusage = type { i64 }
@errno = global i64 0
@RUSAGE_SELF = global i32 0
define i64 @memuse1() {
%1 = alloca %struct.rusage
%2 = bitcast %struct.rusage* %1 to i8*
store i64 0, i64* @errno
%3 = load i32, i32* @RUSAGE_SELF
%4 = call i64 @getrusage(i32 %3, %struct.rusage* %1)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0
%7 = load i64, i64* %6
%8 = load i64, i64* @errno
%9 = sub nsw i64 0, %8
%10 = select i1 %5, i64 %7, i64 %9
ret i64 %10
}
double test_carg(_Complex double x) { return __builtin_carg(x); }


x86 assembly (clang, -O0):
<test_carg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1030 <carg@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define double @test_carg(double %0, double %1) {
%3 = alloca { double, double }
%4 = alloca { double, double }
%5 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
store double %0, double* %5
%6 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
store double %1, double* %6
%7 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds { double, double }, { double, double }* %3, i32 0, i32 1
%10 = load double, double* %9
%11 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
%12 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
store double %8, double* %11
store double %10, double* %12
%13 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 0
%14 = load double, double* %13
%15 = getelementptr inbounds { double, double }, { double, double }* %4, i32 0, i32 1
%16 = load double, double* %15
%17 = call double @carg(double %14, double %16)
ret double %17
}

LLVM IR (-O2):
define double @test_carg(double %0, double %1) {
%3 = tail call double @carg(double %0, double %1)
ret double %3
}
void select_pivot_first(int *arr, int lo, int hi) { return; }


x86 assembly (clang, -O0):
<select_pivot_first>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @select_pivot_first(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
ret void
}

LLVM IR (-O2):
define void @select_pivot_first(i32* nocapture %0, i32 %1, i32 %2) {
ret void
}
void gtk_widget_modify_base() {}


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

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

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

LLVM IR (-O2):
define void @gtk_widget_modify_base() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

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


x86 assembly (clang, -O0):
<ph_to_be64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <htobe64@plt>
mov    %eax,-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):
<ph_to_be64>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <htobe64@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @ph_to_be64(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 = call i32 @htobe64(i32 %5)
store i32 %6, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @memcpy(i8* %7, i32* %4, i32 4)
ret void
}

LLVM IR (-O2):
define void @ph_to_be64(i8* %0, i32 %1) {
%3 = alloca i32
%4 = tail call i32 @htobe64(i32 %1)
store i32 %4, i32* %3
%5 = call i32 @memcpy(i8* %0, i32* %3, i32 4)
ret void
}
void handler(int signo) {}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @handler(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __delay_blink();
int /*<<< orphan*/ status_off();
int /*<<< orphan*/ status_on();
void gpio_blink_red(void) {
  for (;;) {
    status_on();
    __delay_blink();
    status_off();
    __delay_blink();
  }
}


x86 assembly (clang, -O0):
<gpio_blink_red>:
push   %rbp
mov    %rsp,%rbp
jmp    1139 <gpio_blink_red+0x9>
mov    $0x0,%al
call   1030 <status_on@plt>
mov    $0x0,%al
call   1050 <__delay_blink@plt>
mov    $0x0,%al
call   1040 <status_off@plt>
mov    $0x0,%al
call   1050 <__delay_blink@plt>
jmp    1139 <gpio_blink_red+0x9>

x86 assembly (clang, -O2):
<gpio_blink_red>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <status_on@plt>
xor    %eax,%eax
call   1050 <__delay_blink@plt>
xor    %eax,%eax
call   1040 <status_off@plt>
xor    %eax,%eax
call   1050 <__delay_blink@plt>
jmp    1140 <gpio_blink_red+0x10>

LLVM IR (-O0):
define void @gpio_blink_red() {
br label %1
1: ; preds = %1, %0
%2 = call i32 (...) @status_on()
%3 = call i32 (...) @__delay_blink()
%4 = call i32 (...) @status_off()
%5 = call i32 (...) @__delay_blink()
br label %1
}

LLVM IR (-O2):
define void @gpio_blink_red() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 (...) @status_on()
%3 = tail call i32 (...) @__delay_blink()
%4 = tail call i32 (...) @status_off()
%5 = tail call i32 (...) @__delay_blink()
br label %1
}