xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ srandom(int);
int /*<<< orphan*/ time(int /*<<< orphan*/);
void utils_init_random() {
  time_t now = time(0);
  struct tm *tm_struct = localtime(&now);
  int seed = tm_struct->tm_sec;
  srandom(seed);
}


x86 assembly (clang, -O0):
<utils_init_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <srandom@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utils_init_random>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%edi
call   1040 <srandom@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define void @utils_init_random() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca i32
%4 = call i32 @time(i32 0)
store i32 %4, i32* %1
%5 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %5, %struct.tm** %2
%6 = load %struct.tm*, %struct.tm** %2
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%8 = load i32, i32* %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @srandom(i32 %9)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define void @utils_init_random() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32 0)
store i32 %3, i32* %1
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 @srandom(i32 %6)
ret void
}
int test_imm_6Fuint8_reg(unsigned char val) {
  return ((val) & (-0x6F << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_6Fuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -111
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int test_thousand(int THOUSAND_1000) { return THOUSAND_1000; }


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

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

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

LLVM IR (-O2):
define i32 @test_thousand(i32 returned %0) {
ret i32 %0
}
void EVP_aes_256_xts(void) {}


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

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

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

LLVM IR (-O2):
define void @EVP_aes_256_xts() {
ret void
}
char *fail() {
  return "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/"
         "test_printf.c"
         ":"
         "17"
         ": "
         "failure";
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_printf.c:17: failure\00"
define i8* @fail() {
ret i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [157 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_printf.c:17: failure\00"
define i8* @fail() {
ret i8* getelementptr inbounds ([157 x i8], [157 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ register_capa_function_list();
void capa_init() { register_capa_function_list(); }


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

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

LLVM IR (-O0):
define void @capa_init() {
%1 = call i32 (...) @register_capa_function_list()
ret void
}

LLVM IR (-O2):
define void @capa_init() {
%1 = tail call i32 (...) @register_capa_function_list()
ret void
}
void free_dmatrix2(double **m, const long nrow, const long ncol) {
  free(m[0]);
  free(m);
}


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

x86 assembly (clang, -O2):
<free_dmatrix2>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_dmatrix2(double** %0, i64 %1, i64 %2) {
%4 = alloca double**
%5 = alloca i64
%6 = alloca i64
store double** %0, double*** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load double**, double*** %4
%8 = getelementptr inbounds double*, double** %7, i64 0
%9 = load double*, double** %8
%10 = bitcast double* %9 to i8*
%11 = load double**, double*** %4
%12 = bitcast double** %11 to i8*
ret void
}

LLVM IR (-O2):
define void @free_dmatrix2(double** nocapture %0, i64 %1, i64 %2) {
%4 = bitcast double** %0 to i8**
%5 = load i8*, i8** %4
tail call void @free(i8* %5)
%6 = bitcast double** %0 to i8*
tail call void @free(i8* %6)
ret void
}
/* Variables and functions */
scalar_t__ posix_memalign(void **, int, size_t);
__attribute__((always_)) void *xmalloc(size_t size) {
  void *memptr;
  if (posix_memalign(&memptr, 64, size))
    return NULL;
  return memptr;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rdi
mov    $0x40,%esi
call   1030 <posix_memalign@plt>
cmp    $0x0,%rax
je     1145 <xmalloc+0x35>
movq   $0x0,-0x8(%rbp)
jmp    114d <xmalloc+0x3d>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
mov    %rdi,%rdx
mov    %rsp,%rdi
mov    $0x40,%esi
call   1030 <posix_memalign@plt>
test   %rax,%rax
jne    112c <xmalloc+0x1c>
mov    (%rsp),%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @xmalloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = call i64 @posix_memalign(i8** %4, i32 64, i64 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* null, i8** %2
br label %11
9: ; preds = %1
%10 = load i8*, i8** %4
store i8* %10, i8** %2
br label %11
11: ; preds = %9, %8
%12 = load i8*, i8** %2
ret i8* %12
}

LLVM IR (-O2):
define i8* @xmalloc(i64 %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @posix_memalign(i8** %2, i32 64, i64 %0)
%5 = icmp eq i64 %4, 0
%6 = load i8*, i8** %2
%7 = select i1 %5, i8* %6, i8* null
ret i8* %7
}
int sandbox_unsuspend(void) { return -1; }


x86 assembly (clang, -O0):
<sandbox_unsuspend>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @sandbox_unsuspend() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @sandbox_unsuspend() {
ret i32 -1
}
unsigned int test_8(unsigned int x) { return x ^ (1 << 8); }


x86 assembly (clang, -O0):
<test_8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0x100,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_8>:
mov    %edi,%eax
xor    $0x100,%eax
ret

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

LLVM IR (-O2):
define i32 @test_8(i32 %0) {
%2 = xor i32 %0, 256
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void OptickAPI_AttachTag_Float(uint64_t inEventDescription, float inValue) {}


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

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

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

LLVM IR (-O2):
define void @OptickAPI_AttachTag_Float(i32 %0, float %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clog_set_buffer_len(int *);
void CLOG_SET_BUFFER_LEN_(int *w) { clog_set_buffer_len(w); }


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

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

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

LLVM IR (-O2):
define void @CLOG_SET_BUFFER_LEN_(i32* %0) {
%2 = tail call i32 @clog_set_buffer_len(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ main_x();
main() { main_x(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @main_x()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @main_x()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_PRINTABLESTRING;

/* Variables and functions */
int /*<<< orphan*/ ASN1_PRINTABLESTRING_it;
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
ASN1_PRINTABLESTRING *d2i_ASN1_PRINTABLESTRING(ASN1_PRINTABLESTRING **a,
                                               const unsigned char **in,
                                               long len) {
  return (ASN1_PRINTABLESTRING *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                               &ASN1_PRINTABLESTRING_it);
}


x86 assembly (clang, -O0):
<d2i_ASN1_PRINTABLESTRING>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2ea9(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_ASN1_PRINTABLESTRING>:
mov    0x2ec9(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@ASN1_PRINTABLESTRING_it = global i32 0
define i32* @d2i_ASN1_PRINTABLESTRING(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @ASN1_PRINTABLESTRING_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@ASN1_PRINTABLESTRING_it = global i32 0
define i32* @d2i_ASN1_PRINTABLESTRING(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @ASN1_PRINTABLESTRING_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long int get_ms_stamp() {
  struct timeval timer_usec;
  long long int timestamp_usec;
  if (!gettimeofday(&timer_usec, NULL)) {
    timestamp_usec = ((long long int)timer_usec.tv_sec) * 1000000ll +
                     (long long int)timer_usec.tv_usec;
  } else {
    timestamp_usec = -1;
  }
  return timestamp_usec;
}


x86 assembly (clang, -O0):
<get_ms_stamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0x0,%eax
jne    1143 <get_ms_stamp+0x33>
imul   $0xf4240,-0x8(%rbp),%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    114b <get_ms_stamp+0x3b>
movq   $0xffffffffffffffff,-0x18(%rbp)
ff
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i64 @get_ms_stamp() {
%1 = alloca %struct.timeval
%2 = alloca i64
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp ne i32 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %0
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i64, i64* %6
%8 = mul nsw i64 %7, 1000000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%10 = load i64, i64* %9
%11 = add nsw i64 %8, %10
store i64 %11, i64* %2
br label %13
12: ; preds = %0
store i64 -1, i64* %2
br label %13
13: ; preds = %12, %5
%14 = load i64, i64* %2
ret i64 %14
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i64 @get_ms_stamp() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = icmp eq i32 %3, 0
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = mul nsw i64 %6, 1000000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%9 = load i64, i64* %8
%10 = add nsw i64 %7, %9
%11 = select i1 %4, i64 %10, i64 -1
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *realloc(void *, size_t);
void *reallocf(void *ptr, size_t size) {
  void *nptr;
  nptr = realloc(ptr, size);
  if (!nptr && ptr && size != 0)
    free(ptr);
  return (nptr);
}


x86 assembly (clang, -O0):
<reallocf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116b <reallocf+0x4b>
cmpq   $0x0,-0x8(%rbp)
je     116b <reallocf+0x4b>
cmpq   $0x0,-0x10(%rbp)
je     116b <reallocf+0x4b>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reallocf>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r15
call   1040 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     114a <reallocf+0x2a>
test   %r15,%r15
je     114a <reallocf+0x2a>
test   %r14,%r14
jne    114a <reallocf+0x2a>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define noalias i8* @reallocf(i8* %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i8* %0, null
%6 = and i1 %5, %4
%7 = icmp ne i64 %1, 0
%8 = and i1 %7, %6
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = tail call i32 @free(i8* %0)
br label %11
11: ; preds = %9, %2
ret i8* %3
}
/* Variables and functions */
int printf(char *, unsigned long, unsigned char, float, double);
int foo(unsigned long a, unsigned char b, float f, double d) {
  return printf("%lu, %u, %f, %f\n", a, b, f, d);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movss  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x9(%rbp),%al
movss  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xebc(%rip),%rdi
movzbl %al,%edx
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"%lu, %u, %f, %f\0A\00"
define i32 @foo(i64 %0, i8 zeroext %1, float %2, double %3) {
%5 = alloca i64
%6 = alloca i8
%7 = alloca float
%8 = alloca double
store i64 %0, i64* %5
store i8 %1, i8* %6
store float %2, float* %7
store double %3, double* %8
%9 = load i64, i64* %5
%10 = load i8, i8* %6
%11 = load float, float* %7
%12 = load double, double* %8
%13 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %9, i8 zeroext %10, float %11, double %12)
ret i32 %13
}

LLVM IR (-O2):
@.str = [17 x i8] c"%lu, %u, %f, %f\0A\00"
define i32 @foo(i64 %0, i8 zeroext %1, float %2, double %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %0, i8 zeroext %1, float %2, double %3)
ret i32 %5
}
void av_hash_final() {}


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

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

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

LLVM IR (-O2):
define void @av_hash_final() {
ret void
}
void end_subpacket(int *indent) { *indent -= 1; }


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

x86 assembly (clang, -O2):
<end_subpacket>:
addl   $0xffffffff,(%rdi)
ret

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

LLVM IR (-O2):
define void @end_subpacket(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add nsw i32 %2, -1
store i32 %3, i32* %0
ret void
}
double foo(int x) { return (double)(float)(x | (int)0xfe000000); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0xfe000000,%eax
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
or     $0xfe000000,%edi
cvtsi2ss %edi,%xmm0
cvtss2sd %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = or i32 %3, -33554432
%5 = sitofp i32 %4 to float
%6 = fpext float %5 to double
ret double %6
}

LLVM IR (-O2):
define double @foo(i32 %0) {
%2 = or i32 %0, -33554432
%3 = sitofp i32 %2 to float
%4 = fpext float %3 to double
ret double %4
}
void TrueTests(void) {}


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

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

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

LLVM IR (-O2):
define void @TrueTests() {
ret void
}
/* Variables and functions */
int serverIsRunning();
int server_is_running() { return serverIsRunning(); }


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

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

LLVM IR (-O0):
define i32 @server_is_running() {
%1 = call i32 (...) @serverIsRunning()
ret i32 %1
}

LLVM IR (-O2):
define i32 @server_is_running() {
%1 = tail call i32 (...) @serverIsRunning()
ret i32 %1
}
int *funcp(int *a) {
  a += 1;
  return a;
}


x86 assembly (clang, -O0):
<funcp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32* @funcp(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ test_vb_aspx_comment();
void all_vb_aspx_tests() { test_vb_aspx_comment(); }


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

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

LLVM IR (-O0):
define void @all_vb_aspx_tests() {
%1 = call i32 (...) @test_vb_aspx_comment()
ret void
}

LLVM IR (-O2):
define void @all_vb_aspx_tests() {
%1 = tail call i32 (...) @test_vb_aspx_comment()
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
int iscarry(uint32_t op1, uint32_t op2, uint8_t C) {
  if ((op2 == 0xFFFFFFFF) && (C == 1))
    return (1);
  return ((op1 > (0xFFFFFFFF - op2 - C)) ? 1 : 0);
}


x86 assembly (clang, -O0):
<iscarry>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    112d <iscarry+0x2d>
cmpl   $0x1,-0x10(%rbp)
jne    112d <iscarry+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    114a <iscarry+0x4a>
mov    -0x8(%rbp),%edx
mov    $0xffffffff,%esi
sub    -0xc(%rbp),%esi
sub    -0x10(%rbp),%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmova  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iscarry>:
mov    %edx,%eax
xor    $0x1,%eax
not    %esi
or     %esi,%eax
sete   %al
sub    %edx,%esi
cmp    %edi,%esi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @iscarry(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, -1
%5 = icmp eq i32 %2, 1
%6 = and i1 %4, %5
%7 = xor i32 %1, -1
%8 = sub i32 %7, %2
%9 = icmp ult i32 %8, %0
%10 = or i1 %6, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
void a() {
  printf("Inside %s() at %s:%u\n", __FUNCTION__,
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/Vestige0214/LLVM-Assignment1/refs/heads/"
         "master/test/c/06-external-call-multiple.c",
         4);
}


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xef4(%rip),%rsi
lea    0xeef(%rip),%rdx
mov    $0x4,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
lea    0xee9(%rip),%rdi
lea    0xef8(%rip),%rsi
lea    0xef3(%rip),%rdx
mov    $0x4,%ecx
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Inside %s() at %s:%u\0A\00"
@__FUNCTION__.a = [2 x i8] c"a\00"
@.str.1 = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Vestige0214/LLVM-Assignment1/refs/heads/master/test/c/06-external-call-multiple.c\00"
define void @a() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @__FUNCTION__.a, i64 0, i64 0), i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str.1, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Inside %s() at %s:%u\0A\00"
@__FUNCTION__.a = [2 x i8] c"a\00"
@.str.1 = [172 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Vestige0214/LLVM-Assignment1/refs/heads/master/test/c/06-external-call-multiple.c\00"
define void @a() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @__FUNCTION__.a, i64 0, i64 0), i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str.1, i64 0, i64 0), i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void error(char *msg) {
  fprintf(stderr, "Error: %s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *);
void usage(char *self) {
  printf("Usage: %s { address data [compare] | nescode }\n"
         "  e.g.:\n"
         "  %s 0xd1dd 0x014\n"
         "  %s GOSSIP ; %s ZEXPYGLA\n",
         self, self, self, self);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    %rcx,%rsi
mov    %rcx,%rdx
mov    %rcx,%r8
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [100 x i8] c"Usage: %s { address data [compare] | nescode }\0A e.g.:\0A %s 0xd1dd 0x014\0A %s GOSSIP ; %s ZEXPYGLA\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %4, i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [100 x i8] c"Usage: %s { address data [compare] | nescode }\0A e.g.:\0A %s 0xd1dd 0x014\0A %s GOSSIP ; %s ZEXPYGLA\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %0, i8* %0, i8* %0)
ret void
}
void Swap(int Array[], int i, int j) {
  if (!Array)
    return;
  int tmp = Array[i];
  Array[i] = Array[j];
  Array[j] = tmp;
}


x86 assembly (clang, -O0):
<Swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    111e <Swap+0x1e>
jmp    1150 <Swap+0x50>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Swap>:
test   %rdi,%rdi
je     1117 <Swap+0x17>
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

LLVM IR (-O0):
define void @Swap(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** %4
%9 = icmp ne i32* %8, null
br i1 %9, label %11, label %10
10: ; preds = %3
br label %31
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
store i32 %16, i32* %7
%17 = load i32*, i32** %4
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = load i32*, i32** %4
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %21, i32* %25
%26 = load i32, i32* %7
%27 = load i32*, i32** %4
%28 = load i32, i32* %6
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 %26, i32* %30
br label %31
31: ; preds = %11, %10
ret void
}

LLVM IR (-O2):
define void @Swap(i32* %0, i32 %1, i32 %2) {
%4 = icmp eq i32* %0, null
br i1 %4, label %12, label %5
5: ; preds = %3
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = load i32, i32* %7
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
store i32 %11, i32* %7
store i32 %8, i32* %10
br label %12
12: ; preds = %3, %5
ret void
}
void fsl_udc_clk_disable(void) {}


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

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

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

LLVM IR (-O2):
define void @fsl_udc_clk_disable() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct wl_proxy {
  int dummy;
};
struct wl_output {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_get_version(struct wl_proxy *);
uint32_t wl_output_get_version(struct wl_output *wl_output) {
  return wl_proxy_get_version((struct wl_proxy *)wl_output);
}


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

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

LLVM IR (-O0):
%struct.wl_output = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_output_get_version(%struct.wl_output* %0) {
%2 = alloca %struct.wl_output*
store %struct.wl_output* %0, %struct.wl_output** %2
%3 = load %struct.wl_output*, %struct.wl_output** %2
%4 = bitcast %struct.wl_output* %3 to %struct.wl_proxy*
%5 = call i32 @wl_proxy_get_version(%struct.wl_proxy* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.wl_output = type { i32 }
%struct.wl_proxy = type { i32 }
define i32 @wl_output_get_version(%struct.wl_output* %0) {
%2 = bitcast %struct.wl_output* %0 to %struct.wl_proxy*
%3 = tail call i32 @wl_proxy_get_version(%struct.wl_proxy* %2)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ c_data;

/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ sprintf(char *, char *, char, char *);
int /*<<< orphan*/ strlen(char *);
int ucast_send(char *, int /*<<< orphan*/);
int ucast_write_ctrlmsg(char *msg) {
  char c_data[5];
  memset(c_data, 0, sizeof(c_data));
  sprintf(c_data, "%c%s", '$', msg);
  return ucast_send(c_data, strlen(c_data));
}


x86 assembly (clang, -O0):
<ucast_write_ctrlmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0xd(%rbp),%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
lea    -0xd(%rbp),%rdi
mov    -0x8(%rbp),%rcx
lea    0xe95(%rip),%rsi
mov    $0x24,%edx
call   1060 <sprintf@plt>
lea    -0xd(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xd(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
call   1050 <ucast_send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ucast_write_ctrlmsg>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0x3(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1040 <memset@plt>
lea    0xe9e(%rip),%rsi
mov    %rbx,%rdi
mov    $0x24,%edx
mov    %r14,%rcx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1050 <ucast_send@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%c%s\00"
define i32 @ucast_write_ctrlmsg(i8* %0) {
%2 = alloca i8*
%3 = alloca [5 x i8]
store i8* %0, i8** %2
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 5)
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%7 = load i8*, i8** %2
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext 36, i8* %7)
%9 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%11 = call i32 @strlen(i8* %10)
%12 = call i32 @ucast_send(i8* %9, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
@.str = [5 x i8] c"%c%s\00"
define i32 @ucast_write_ctrlmsg(i8* %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 5)
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext 36, i8* %0)
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @ucast_send(i8* %3, i32 %6)
ret i32 %7
}
int ua2adr(int ua) { return ua * 0x400; }


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

x86 assembly (clang, -O2):
<ua2adr>:
mov    %edi,%eax
shl    $0xa,%eax
ret

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

LLVM IR (-O2):
define i32 @ua2adr(i32 %0) {
%2 = shl nsw i32 %0, 10
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ getHexString(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char str[7];
  getHexString(str);
  printf("str1 = %s\n", str);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x9(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <getHexString@plt>
lea    0xec7(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"str1 = %s\0A\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 @getHexString(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int /*<<< orphan*/ sleep(unsigned int);
void do_sleep(unsigned int time) {
  printf("sleeping %u\n", time);
  sleep(time);
}


x86 assembly (clang, -O0):
<do_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_sleep>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"sleeping %u\0A\00"
define void @do_sleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @sleep(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"sleeping %u\0A\00"
define void @do_sleep(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @sleep(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _BIOS_RET();
void _BIOS_PUNCH() { _BIOS_RET(); }


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

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

LLVM IR (-O0):
define void @_BIOS_PUNCH() {
%1 = call i32 (...) @_BIOS_RET()
ret void
}

LLVM IR (-O2):
define void @_BIOS_PUNCH() {
%1 = tail call i32 (...) @_BIOS_RET()
ret void
}
/* Variables and functions */
unsigned long WaitNextMsg256();
unsigned long waitnextmsg() { return WaitNextMsg256(); }


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

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

LLVM IR (-O0):
define i64 @waitnextmsg() {
%1 = call i64 (...) @WaitNextMsg256()
ret i64 %1
}

LLVM IR (-O2):
define i64 @waitnextmsg() {
%1 = tail call i64 (...) @WaitNextMsg256()
ret i64 %1
}
/* Variables and functions */
unsigned int f27(unsigned int);
unsigned int f28(unsigned int a) { return f27(f27(a)); }


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

x86 assembly (clang, -O2):
<f28>:
push   %rax
call   1030 <f27@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <f27@plt>

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

LLVM IR (-O2):
define i32 @f28(i32 %0) {
%2 = tail call i32 @f27(i32 %0)
%3 = tail call i32 @f27(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ memcmp(void const *, void const *, size_t);
bool cutils_cdar_DynamicArray_unsigned_char_compare(const void *p1,
                                                    const void *p2, size_t s) {
  return !memcmp(p1, p2, s);
}


x86 assembly (clang, -O0):
<cutils_cdar_DynamicArray_unsigned_char_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cutils_cdar_DynamicArray_unsigned_char_compare>:
push   %rax
call   1030 <bcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cutils_cdar_DynamicArray_unsigned_char_compare(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @memcmp(i8* %7, i8* %8, i64 %9)
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @cutils_cdar_DynamicArray_unsigned_char_compare(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @bcmp(i8* %0, i8* %1, i64 %2)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
void paravirt_activate_mm(struct mm_struct *prev, struct mm_struct *next) {}


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

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

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

LLVM IR (-O2):
%struct.mm_struct = type opaque
define void @paravirt_activate_mm(%struct.mm_struct* nocapture %0, %struct.mm_struct* nocapture %1) {
ret void
}
int main() {
  unsigned long arg1 = 0xF174123492FAC1FFL;
  unsigned long arg2 = 0xFC1935FB3D5EA761L;
  unsigned long mulLo = 0;
  unsigned long mulHi = 0;
  __asm__("mulq %%rbx;" : "=a"(mulLo), "=d"(mulHi) : "a"(arg1), "b"(arg2));
  return (mulLo == 0x671BEA1F4432DA9FL) && (mulHi == 0xEDC6092B8645DC41L);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
movl   $0x0,-0xc(%rbp)
movabs $0xf174123492fac1ff,%rax
12 74 f1
mov    %rax,-0x18(%rbp)
movabs $0xfc1935fb3d5ea761,%rax
35 19 fc
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rbx
mul    %rbx
mov    %rax,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
xor    %eax,%eax
movabs $0x671bea1f4432da9f,%rcx
ea 1b 67
cmp    %rcx,-0x28(%rbp)
mov    %al,-0x31(%rbp)
jne    1178 <main+0x78>
movabs $0xedc6092b8645dc41,%rax
09 c6 ed
cmp    %rax,-0x30(%rbp)
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movabs $0xf174123492fac1ff,%rax
12 74 f1
movabs $0xfc1935fb3d5ea761,%rbx
35 19 fc
mul    %rbx
movabs $0x671bea1f4432da9f,%rcx
ea 1b 67
xor    %rax,%rcx
movabs $0xedc6092b8645dc41,%rsi
09 c6 ed
xor    %rdx,%rsi
xor    %eax,%eax
or     %rcx,%rsi
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
store i64 -1048192796256976385, i64* %2
store i64 -281134148551268511, i64* %3
store i64 0, i64* %4
store i64 0, i64* %5
%6 = load i64, i64* %2
%7 = load i64, i64* %3
%8 = call { i64, i64 } asm "mulq %rbx;", "={ax},={dx},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i64 %6, i64 %7)
%9 = extractvalue { i64, i64 } %8, 0
%10 = extractvalue { i64, i64 } %8, 1
store i64 %9, i64* %4
store i64 %10, i64* %5
%11 = load i64, i64* %4
%12 = icmp eq i64 %11, 7429789430286834335
br i1 %12, label %13, label %16
13: ; preds = %0
%14 = load i64, i64* %5
%15 = icmp eq i64 %14, -1313352158790951871
br label %16
16: ; preds = %13, %0
%17 = phi i1 [ false, %0 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call { i64, i64 } asm "mulq %rbx;", "={ax},={dx},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i64 -1048192796256976385, i64 -281134148551268511)
%2 = extractvalue { i64, i64 } %1, 0
%3 = extractvalue { i64, i64 } %1, 1
%4 = icmp eq i64 %2, 7429789430286834335
%5 = icmp eq i64 %3, -1313352158790951871
%6 = select i1 %4, i1 %5, i1 false
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ strcpy(char *, char const *);
size_t strlen(char const *);
char *str_dupl(const char *text) {
  size_t length = strlen(text);
  char *new_text = malloc(length + 1);
  strcpy(new_text, text);
  return new_text;
}


x86 assembly (clang, -O0):
<str_dupl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_dupl>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @str_dupl(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 1
%9 = call i8* @malloc(i64 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %4
ret i8* %13
}

LLVM IR (-O2):
define i8* @str_dupl(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int waitpid(int, int *, int /*<<< orphan*/);
int my_zombie_killer(void) {
  int pid;
  int status;
  int n_zombie = 0;
  while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
    n_zombie++;
  return n_zombie;
}


x86 assembly (clang, -O0):
<my_zombie_killer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0x8(%rbp),%rsi
call   1030 <waitpid@plt>
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jle    1150 <my_zombie_killer+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    111f <my_zombie_killer+0xf>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_zombie_killer>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    $0xffffffff,%ebx
mov    0x2ec3(%rip),%r15
lea    0xc(%rsp),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15),%edx
mov    $0xffffffff,%edi
mov    %r14,%rsi
call   1030 <waitpid@plt>
add    $0x1,%ebx
test   %eax,%eax
jg     1130 <my_zombie_killer+0x20>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define i32 @my_zombie_killer() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %3
br label %4
4: ; preds = %8, %0
%5 = load i32, i32* @WNOHANG
%6 = call i32 @waitpid(i32 -1, i32* %2, i32 %5)
store i32 %6, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %4
11: ; preds = %4
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define i32 @my_zombie_killer() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 0, %0 ], [ %8, %3 ]
%5 = load i32, i32* @WNOHANG
%6 = call i32 @waitpid(i32 -1, i32* %1, i32 %5)
%7 = icmp sgt i32 %6, 0
%8 = add nuw nsw i32 %4, 1
br i1 %7, label %3, label %9
9: ; preds = %3
ret i32 %4
}