xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
scalar_t__ round(double);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int l;
  scanf("%d", &l);
  printf("%d\n", (int)round((double)l / 3.785));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec9(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeab(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <round@plt>
mov    %eax,%esi
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
cvtsi2sdl 0x4(%rsp),%xmm0
divsd  0xeb0(%rip),%xmm0
call   1050 <round@plt>
lea    0xeaf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 3.785000e+00
%6 = call i64 @round(double %5)
%7 = trunc i64 %6 to i32
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, 3.785000e+00
%7 = call i64 @round(double %6)
%8 = trunc i64 %7 to i32
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char const *);
void DefaultPath(char *path, const char *basepath) {
  char temp[128];
  if (path[0] == '/')
    return;
  strcpy(temp, path);
  strcpy(path, basepath);
  strcat(path, temp);
}


x86 assembly (clang, -O0):
<DefaultPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1148 <DefaultPath+0x28>
jmp    1175 <DefaultPath+0x55>
lea    -0x90(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <strcat@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DefaultPath>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
cmpb   $0x2f,(%rdi)
je     115b <DefaultPath+0x3b>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @DefaultPath(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [128 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 47
br i1 %10, label %11, label %12
11: ; preds = %2
br label %22
12: ; preds = %2
%13 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
%17 = load i8*, i8** %4
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = load i8*, i8** %3
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%21 = call i32 @strcat(i8* %19, i8* %20)
br label %22
22: ; preds = %12, %11
ret void
}

LLVM IR (-O2):
define void @DefaultPath(i8* %0, i8* %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 47
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = call i32 @strcpy(i8* %4, i8* %0)
%9 = call i32 @strcpy(i8* %0, i8* %1)
%10 = call i32 @strcat(i8* %0, i8* %4)
br label %11
11: ; preds = %2, %7
ret void
}
void ScaleRowDown2Box_Odd_C() {}


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

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

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

LLVM IR (-O2):
define void @ScaleRowDown2Box_Odd_C() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void prString(void *s) { printf("|%s|", (char *)s); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"|%s|\00"
define void @prString(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void divide(struct DynArr *stack) {}


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

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

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

LLVM IR (-O2):
%struct.DynArr = type opaque
define void @divide(%struct.DynArr* nocapture %0) {
ret void
}
int get_byte(adr)
char *adr;
{
  if (adr < 0xF000)
    error("Disk Parameter Header nicht im Common");
  return *adr;
}


x86 assembly (clang, -O0):
<get_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xf000,%eax
cmp    %rax,-0x8(%rbp)
jae    1139 <get_byte+0x29>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <error@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_byte>:
push   %rbx
mov    %rdi,%rbx
cmp    $0xefff,%rdi
ja     112b <get_byte+0x1b>
lea    0xedc(%rip),%rdi
xor    %eax,%eax
call   1030 <error@plt>
movsbl (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Disk Parameter Header nicht im Common\00"
define i32 @get_byte(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ult i8* %3, inttoptr (i64 61440 to i8*)
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@.str = [38 x i8] c"Disk Parameter Header nicht im Common\00"
define i32 @get_byte(i8* %0) {
%2 = icmp ult i8* %0, inttoptr (i64 61440 to i8*)
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
%6 = load i8, i8* %0
%7 = sext i8 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ uint64_t;
struct timeval {
  unsigned long long tv_sec;
  scalar_t__ tv_usec;
  int /*<<< orphan*/ member_0;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
uint64_t get_updated_time(uint64_t prev) {
  struct timeval tv = {0};
  uint64_t new;
  (void)gettimeofday(&tv, NULL);
  new = tv.tv_sec * 1000000ULL + tv.tv_usec;
  if (new == prev) {
    ++new;
  }
  return new;
}


x86 assembly (clang, -O0):
<get_updated_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x20(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x8(%rbp),%rax
jne    1173 <get_updated_time+0x53>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_updated_time>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,(%rsp),%rcx
add    0x8(%rsp),%rcx
xor    %eax,%eax
cmp    %rbx,%rcx
sete   %al
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
%struct.timeval = type { i64, i64, i32 }
define i64 @get_updated_time(i64 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%6 = load i64, i64* %5
%7 = mul i64 %6, 1000000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add i64 %7, %9
%11 = icmp eq i64 %10, %0
%12 = zext i1 %11 to i64
%13 = add nsw i64 %10, %12
ret i64 %13
}
char *aum_Name(void) { return "AUM16"; }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"AUM16\00"
define i8* @aum_Name() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"AUM16\00"
define i8* @aum_Name() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ uart_send_string(char *);
void send_prompt(void) { uart_send_string("> "); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"> \00"
define void @send_prompt() {
%1 = tail call i32 @uart_send_string(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
void sci_adc_get_vol_ratio(unsigned int channel_id, int scale,
                           unsigned int *div_numerators,
                           unsigned int *div_denominators) {}


x86 assembly (clang, -O0):
<sci_adc_get_vol_ratio>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @sci_adc_get_vol_ratio(i32 %0, i32 %1, i32* %2, i32* %3) {
%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* %3, i32** %8
ret void
}

LLVM IR (-O2):
define void @sci_adc_get_vol_ratio(i32 %0, i32 %1, i32* nocapture %2, i32* nocapture %3) {
ret void
}
int operador(char c) {
  switch (c) {
  case '+':
  case '-':
  case '*':
  case '/':
  case '^':
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<operador>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffd6,%eax
sub    $0x2,%eax
jb     1155 <operador+0x55>
jmp    1122 <operador+0x22>
mov    -0xc(%rbp),%eax
sub    $0x2d,%eax
je     1155 <operador+0x55>
jmp    1133 <operador+0x33>
mov    -0xc(%rbp),%eax
sub    $0x2f,%eax
je     1155 <operador+0x55>
jmp    1144 <operador+0x44>
mov    -0xc(%rbp),%eax
sub    $0x5e,%eax
jne    1161 <operador+0x61>
jmp    1155 <operador+0x55>
movl   $0x1,-0x4(%rbp)
jmp    1168 <operador+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<operador>:
add    $0xffffffd6,%edi
cmp    $0x34,%edi
ja     111e <operador+0x1e>
mov    $0x1,%eax
movabs $0x1000000000002b,%rcx
bt     %rdi,%rcx
jae    111e <operador+0x1e>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @operador(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %7 [
i32 43, label %6
i32 45, label %6
i32 42, label %6
i32 47, label %6
i32 94, label %6
]
6: ; preds = %1, %1, %1, %1, %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @operador(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %3 [
i32 43, label %4
i32 45, label %4
i32 42, label %4
i32 47, label %4
i32 94, label %4
]
3: ; preds = %1
br label %4
4: ; preds = %1, %1, %1, %1, %1, %3
%5 = phi i32 [ 0, %3 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %5
}
void cfree(p) void *p;
{ free(p); }


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

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

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

LLVM IR (-O2):
define void @cfree(i8* nocapture %0) {
tail call void @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, char, size_t);
void *xmalloc(size_t);
void *xcalloc(size_t n_elem, size_t sz) {
  void *ptr = xmalloc(n_elem * sz);
  memset(ptr, '\0', n_elem * sz);
  return ptr;
}


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

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

LLVM IR (-O0):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = mul i64 %6, %7
%9 = call i8* @xmalloc(i64 %8)
store i8* %9, i8** %5
%10 = load i8*, i8** %5
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = mul i64 %11, %12
%14 = call i32 @memset(i8* %10, i8 signext 0, i64 %13)
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @xmalloc(i64 %3)
%5 = tail call i32 @memset(i8* %4, i8 signext 0, i64 %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ _sys_int_disable();
void wlibc_int_disable(void) { _sys_int_disable(); }


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

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

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

LLVM IR (-O2):
define void @wlibc_int_disable() {
%1 = tail call i32 (...) @_sys_int_disable()
ret void
}
/* Type definitions */
typedef int int64_t;

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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
movl   $0x4,-0x44(%rbp)
movl   $0x2,-0x48(%rbp)
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rdx
mov    -0x48(%rbp),%ecx
mov    $0x1,%esi
call   1050 <stdlib_strided_dvarianceyc@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xf05(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdx
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0x2,%ecx
call   1040 <stdlib_strided_dvarianceyc@plt>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

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

LLVM IR (-O2):
@__const.main.x = [8 x double] [double 1.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00, double 5.000000e+00, double 6.000000e+00, double 7.000000e+00, double 8.000000e+00]
@.str = [22 x i8] c"sample variance: %lf\0A\00"
define i32 @main() {
%1 = alloca [8 x double]
%2 = bitcast [8 x double]* %1 to i8*
%3 = getelementptr inbounds [8 x double], [8 x double]* %1, i64 0, i64 0
%4 = call double @stdlib_strided_dvarianceyc(i32 4, i32 1, double* %3, i32 2)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %4)
ret i32 0
}
void long_wait(int v) {
  int w;
  while (v--)
    for (w = -800000; w < 800000; w++) {
      w++;
      w--;
    }
}


x86 assembly (clang, -O0):
<long_wait>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1154 <long_wait+0x54>
movl   $0xfff3cb00,-0x8(%rbp)
cmpl   $0xc3500,-0x8(%rbp)
jge    114f <long_wait+0x4f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <long_wait+0x22>
jmp    1107 <long_wait+0x7>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @long_wait(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const);
void print_array(const int str[], int size) {
  int i;
  for (i = 0; i < size; i++) {
    printf("%d ", str[i]);
  }
}


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

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <print_array+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_array+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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


x86 assembly (clang, -O0):
<soc_id_is_sc9832av0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <sci_get_chip_id@plt>
and    $0xfffff000,%eax
cmp    $0x96301000,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<soc_id_is_sc9832av0>:
push   %rax
xor    %eax,%eax
call   1030 <sci_get_chip_id@plt>
and    $0xfffff000,%eax
xor    %ecx,%ecx
cmp    $0x96301000,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @soc_id_is_sc9832av0() {
%1 = call i32 (...) @sci_get_chip_id()
%2 = and i32 %1, -4096
%3 = icmp eq i32 %2, -1775235072
%4 = zext i1 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @soc_id_is_sc9832av0() {
%1 = tail call i32 (...) @sci_get_chip_id()
%2 = and i32 %1, -4096
%3 = icmp eq i32 %2, -1775235072
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t USBControllerVersion(uint32_t ui32Base) {
  return ((*((volatile unsigned long *)(ui32Base + 0x00000FC0))) & 0x0000000F);
}


x86 assembly (clang, -O0):
<USBControllerVersion>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0xfc0(%rax),%rax
and    $0xf,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<USBControllerVersion>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    0xfc0(%rax),%rax
and    $0xf,%eax
ret

LLVM IR (-O0):
define i64 @USBControllerVersion(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add i64 %3, 4032
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 15
ret i64 %7
}

LLVM IR (-O2):
define i64 @USBControllerVersion(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add i64 %3, 4032
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 15
ret i64 %7
}
/* Type definitions */
struct strlist {
  int dummy;
};
struct string {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ string_get(struct string *);
struct strlist *string_split_sz(int /*<<< orphan*/, char const *, int);
struct strlist *string_split(struct string *str, const char *delimiters,
                             int include_empty) {
  return string_split_sz(string_get(str), delimiters, include_empty);
}


x86 assembly (clang, -O0):
<string_split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <string_get@plt>
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <string_split_sz@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_split>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rsi,%rbx
call   1040 <string_get@plt>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <string_split_sz@plt>

LLVM IR (-O0):
%struct.strlist = type { i32 }
%struct.string = type { i32 }
define %struct.strlist* @string_split(%struct.string* %0, i8* %1, i32 %2) {
%4 = alloca %struct.string*
%5 = alloca i8*
%6 = alloca i32
store %struct.string* %0, %struct.string** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.string*, %struct.string** %4
%8 = call i32 @string_get(%struct.string* %7)
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call %struct.strlist* @string_split_sz(i32 %8, i8* %9, i32 %10)
ret %struct.strlist* %11
}

LLVM IR (-O2):
%struct.strlist = type { i32 }
%struct.string = type { i32 }
define %struct.strlist* @string_split(%struct.string* %0, i8* %1, i32 %2) {
%4 = tail call i32 @string_get(%struct.string* %0)
%5 = tail call %struct.strlist* @string_split_sz(i32 %4, i8* %1, i32 %2)
ret %struct.strlist* %5
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ munmap(void *, int);
void close_device(int fd, void *virtual_address) {
  munmap(virtual_address, 0x10000);
  close(fd);
}


x86 assembly (clang, -O0):
<close_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x10000,%esi
call   1040 <munmap@plt>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_device>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
mov    $0x10000,%esi
call   1040 <munmap@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @close_device(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @munmap(i8* %5, i32 65536)
%7 = load i32, i32* %3
%8 = call i32 @close(i32 %7)
ret void
}

LLVM IR (-O2):
define void @close_device(i32 %0, i8* %1) {
%3 = tail call i32 @munmap(i8* %1, i32 65536)
%4 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ addr;

/* Variables and functions */
scalar_t__ getsockname(int, struct sockaddr *, unsigned int *);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ sys_die(char *);
extern int net_port(int fd) {
  struct sockaddr_in addr;
  unsigned int size = sizeof(addr);
  if (getsockname(fd, (struct sockaddr *)&addr, &size) < 0)
    sys_die("sys: cannot lookup the socket details\n");
  return ntohs(addr.sin_port);
}


x86 assembly (clang, -O0):
<net_port>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x4,-0xc(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <getsockname@plt>
cmp    $0x0,%rax
jge    1168 <net_port+0x38>
lea    0xe9d(%rip),%rdi
call   1030 <sys_die@plt>
mov    -0x8(%rbp),%edi
call   1040 <ntohs@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_port>:
push   %rax
movl   $0x4,0x4(%rsp)
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1050 <getsockname@plt>
test   %rax,%rax
jns    1157 <net_port+0x27>
lea    0xeae(%rip),%rdi
call   1030 <sys_die@plt>
mov    (%rsp),%edi
call   1040 <ntohs@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [39 x i8] c"sys: cannot lookup the socket details\0A\00"
define i32 @net_port(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
store i32 %0, i32* %2
store i32 4, i32* %4
%5 = load i32, i32* %2
%6 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%7 = call i64 @getsockname(i32 %5, %struct.sockaddr* %6, i32* %4)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @sys_die(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @ntohs(i32 %13)
ret i32 %14
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [39 x i8] c"sys: cannot lookup the socket details\0A\00"
define i32 @net_port(i32 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = bitcast %struct.sockaddr_in* %2 to i8*
%5 = bitcast i32* %3 to i8*
store i32 4, i32* %3
%6 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%7 = call i64 @getsockname(i32 %0, %struct.sockaddr* %6, i32* %3)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @sys_die(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%13 = load i32, i32* %12
%14 = call i32 @ntohs(i32 %13)
ret i32 %14
}
/* Variables and functions */
int factorial(int);
int c(int i, int j) {
  int p;
  if (i >= j) {
    p = factorial(i) / (factorial(j) * factorial(i - j));
  } else {
    p = 0;
  }
  return p;
}


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1161 <c+0x51>
mov    -0x4(%rbp),%edi
call   1030 <factorial@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <factorial@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <factorial@plt>
mov    -0x14(%rbp),%ecx
mov    %eax,%edx
mov    -0x10(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1168 <c+0x58>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
mov    %edi,%ebx
sub    %esi,%ebx
jl     1141 <c+0x31>
mov    %esi,%ebp
call   1030 <factorial@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1030 <factorial@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <factorial@plt>
mov    %eax,%ecx
imul   %ebp,%ecx
mov    %r14d,%eax
cltd
idiv   %ecx
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @c(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = tail call i32 @factorial(i32 %0)
%6 = tail call i32 @factorial(i32 %1)
%7 = sub nsw i32 %0, %1
%8 = tail call i32 @factorial(i32 %7)
%9 = mul nsw i32 %8, %6
%10 = sdiv i32 %5, %9
br label %11
11: ; preds = %2, %4
%12 = phi i32 [ %10, %4 ], [ 0, %2 ]
ret i32 %12
}
int main(void) {
  int a = 4;
  int b = 0;
  if (a > 10 || !b)
    a = 8;
  else
    a = 1;
  return a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jg     112d <main+0x2d>
cmpl   $0x0,-0xc(%rbp)
jne    1139 <main+0x39>
movl   $0x8,-0x8(%rbp)
jmp    1140 <main+0x40>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 8
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
void getCard(char cards[]) {
  puts("Enter the card name: ");
  scanf("%2s", cards);
}


x86 assembly (clang, -O0):
<getCard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%rsi
lea    0xed3(%rip),%rdi
call   1040 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCard>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Enter the card name: \00"
@.str.1 = [4 x i8] c"%2s\00"
define void @getCard(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"Enter the card name: \00"
@.str.1 = [4 x i8] c"%2s\00"
define void @getCard(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
void leakingmemory(int bytes) {
  char *oof = (char *)malloc(bytes);
  int i;
  printf("Leaking %d bytes of memory\n", bytes);
  for (i = 0; i < bytes; i++) {
    oof[i] = 1;
  }
}


x86 assembly (clang, -O0):
<leakingmemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1173 <leakingmemory+0x53>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <leakingmemory+0x2d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leakingmemory>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
call   1050 <malloc@plt>
mov    %rax,%r14
lea    0xebb(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
test   %ebx,%ebx
jle    115f <leakingmemory+0x2f>
mov    %ebx,%edx
mov    %r14,%rdi
mov    $0x1,%esi
call   1040 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [28 x i8] c"Leaking %d bytes of memory\0A\00"
define void @leakingmemory(i32 %0) {
%2 = tail call i64 @malloc(i32 %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = icmp sgt i32 %0, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = inttoptr i64 %2 to i8*
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ems1Erlse();
int /*<<< orphan*/ ems1Mpop();
void emsRlse(void) {
  ;
  ems1Erlse();
  ems1Mpop();
  return;
}


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

x86 assembly (clang, -O2):
<emsRlse>:
push   %rax
xor    %eax,%eax
call   1040 <ems1Erlse@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ems1Mpop@plt>

LLVM IR (-O0):
define void @emsRlse() {
%1 = call i32 (...) @ems1Erlse()
%2 = call i32 (...) @ems1Mpop()
ret void
}

LLVM IR (-O2):
define void @emsRlse() {
%1 = tail call i32 (...) @ems1Erlse()
%2 = tail call i32 (...) @ems1Mpop()
ret void
}
/* Variables and functions */
int getRuleFor(char);
int validate(int actualOccurances, char roman) {
  int allowedContiguousOccurrences = getRuleFor(roman);
  if (allowedContiguousOccurrences == 0) {
    return 0;
  }
  if (actualOccurances > allowedContiguousOccurrences) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<validate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%edi
call   1030 <getRuleFor@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1143 <validate+0x33>
movl   $0x0,-0x4(%rbp)
jmp    1162 <validate+0x52>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    115b <validate+0x4b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <validate+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate>:
push   %rbx
mov    %edi,%ebx
mov    %esi,%edi
call   1030 <getRuleFor@plt>
test   %eax,%eax
setne  %cl
cmp    %ebx,%eax
setl   %al
and    %cl,%al
movzbl %al,%eax
neg    %eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @validate(i32 %0, i8 signext %1) {
%3 = tail call i32 @getRuleFor(i8 signext %1)
%4 = icmp ne i32 %3, 0
%5 = icmp slt i32 %3, %0
%6 = and i1 %4, %5
%7 = sext i1 %6 to i32
ret i32 %7
}
int Add2(int a0, int a1) {
  int sum = a0 + a1;
  return sum;
}


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

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

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

LLVM IR (-O2):
define i32 @Add2(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalpha(int);
void t_isalpha_0x4e() {
  Assert_real((isalpha(78)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              395, ("isalpha should be 1 for N"));
}


x86 assembly (clang, -O0):
<t_isalpha_0x4e>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4e,%edi
call   1030 <isalpha@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x18b,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0x4e>:
push   %rax
mov    $0x4e,%edi
call   1030 <isalpha@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x18b,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for N\00"
define void @t_isalpha_0x4e() {
%1 = call i32 @isalpha(i32 78)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 395, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for N\00"
define void @t_isalpha_0x4e() {
%1 = tail call i32 @isalpha(i32 78)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 395, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void func2(int a, int b, int c, int *e, int *f, int *g) {
  *e = 3 * a;
  *f = 2 * b;
  *g = c;
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
imul   $0x3,-0x4(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
lea    (%rdi,%rdi,2),%eax
mov    %eax,(%rcx)
add    %esi,%esi
mov    %esi,(%r8)
mov    %edx,(%r9)
ret

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

LLVM IR (-O2):
define void @func2(i32 %0, i32 %1, i32 %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5) {
%7 = mul nsw i32 %0, 3
store i32 %7, i32* %3
%8 = shl nsw i32 %1, 1
store i32 %8, i32* %4
store i32 %2, i32* %5
ret void
}
unsigned short int unsignedshortint_ignoring_signedlongint(unsigned short int x,
                                                           signed long int y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedshortint_ignoring_signedlongint>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i16 @unsignedshortint_ignoring_signedlongint(i16 zeroext %0, i64 %1) {
%3 = alloca i16
%4 = alloca i64
store i16 %0, i16* %3
store i64 %1, i64* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define zeroext i16 @unsignedshortint_ignoring_signedlongint(i16 returned zeroext %0, i64 %1) {
ret i16 %0
}
double squash(x)
double x;
{ return (1.0 / (1.0 + exp(-x))); }


x86 assembly (clang, -O0):
<squash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  0xeba(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xeae(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<squash>:
push   %rax
xorpd  0xee7(%rip),%xmm0
call   1030 <exp@plt>
movsd  0xeea(%rip),%xmm1
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @squash(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fneg double %3
%5 = call double @exp(double %4)
%6 = fadd double 1.000000e+00, %5
%7 = fdiv double 1.000000e+00, %6
ret double %7
}

LLVM IR (-O2):
define double @squash(double %0) {
%2 = fneg double %0
%3 = tail call double @exp(double %2)
%4 = fadd double %3, 1.000000e+00
%5 = fdiv double 1.000000e+00, %4
ret double %5
}