xunge/DecIR huggingface dataset:
/* Variables and functions */
double beta(int, double, int);
double fabs(double);
double tdistribution(double t, int n) {
  t = fabs(t);
  return 1.0 - beta(n / 2.0, 0.5, n / (n + t * t));
}


x86 assembly (clang, -O0):
<tdistribution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xef4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xece(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
cvtsi2sdl -0xc(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
movsd  0xe92(%rip),%xmm0
call   1030 <beta@plt>
movaps %xmm0,%xmm1
movsd  0xe7a(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tdistribution>:
push   %rax
cvtsi2sd %edi,%xmm2
movsd  0xee3(%rip),%xmm1
movapd %xmm2,%xmm3
mulsd  %xmm1,%xmm3
cvttsd2si %xmm3,%edi
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%esi
movapd %xmm1,%xmm0
call   1030 <beta@plt>
movsd  0xebe(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @tdistribution(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = call double @llvm.fabs.f64(double %5)
store double %6, double* %3
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 2.000000e+00
%10 = fptosi double %9 to i32
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = load double, double* %3
%16 = load double, double* %3
%17 = call double @llvm.fmuladd.f64(double %15, double %16, double %14)
%18 = fdiv double %12, %17
%19 = fptosi double %18 to i32
%20 = call double @beta(i32 %10, double 5.000000e-01, i32 %19)
%21 = fsub double 1.000000e+00, %20
ret double %21
}

LLVM IR (-O2):
define double @tdistribution(double %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fmul double %3, 5.000000e-01
%5 = fptosi double %4 to i32
%6 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %3)
%7 = fdiv double %3, %6
%8 = fptosi double %7 to i32
%9 = tail call double @beta(i32 %5, double 5.000000e-01, i32 %8)
%10 = fsub double 1.000000e+00, %9
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ printError(char *);
char *strdup(char const *);
char *convertToHeapString(const char *string) {
  char *heapString = strdup(string);
  if (heapString == NULL) {
    printError("Could not convert to heap string.\n");
  }
  return heapString;
}


x86 assembly (clang, -O0):
<convertToHeapString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <convertToHeapString+0x30>
lea    0xeb5(%rip),%rdi
call   1030 <printError@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertToHeapString>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <convertToHeapString+0x1a>
lea    0xecb(%rip),%rdi
call   1030 <printError@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Could not convert to heap string.\0A\00"
define i8* @convertToHeapString(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @printError(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [35 x i8] c"Could not convert to heap string.\0A\00"
define noalias i8* @convertToHeapString(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @printError(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ is_prime(size_t);
size_t next_prime(size_t seed) {
  seed |= 1;
  while (!is_prime(seed))
    seed += 2;
  return (seed);
}


x86 assembly (clang, -O0):
<next_prime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
or     $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <is_prime@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1146 <next_prime+0x36>
jmp    1157 <next_prime+0x47>
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x8(%rbp)
jmp    1128 <next_prime+0x18>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_prime>:
push   %rbx
mov    %rdi,%rbx
or     $0x1,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <is_prime@plt>
add    $0x2,%rbx
test   %eax,%eax
je     1120 <next_prime+0x10>
add    $0xfffffffffffffffe,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @next_prime(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = or i64 %3, 1
store i64 %4, i64* %2
br label %5
5: ; preds = %10, %1
%6 = load i64, i64* %2
%7 = call i32 @is_prime(i64 %6)
%8 = icmp ne i32 %7, 0
%9 = xor i1 %8, true
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i64, i64* %2
%12 = add i64 %11, 2
store i64 %12, i64* %2
br label %5
13: ; preds = %5
%14 = load i64, i64* %2
ret i64 %14
}

LLVM IR (-O2):
define i64 @next_prime(i64 %0) {
%2 = or i64 %0, 1
br label %3
3: ; preds = %3, %1
%4 = phi i64 [ %2, %1 ], [ %7, %3 ]
%5 = tail call i32 @is_prime(i64 %4)
%6 = icmp eq i32 %5, 0
%7 = add i64 %4, 2
br i1 %6, label %3, label %8
8: ; preds = %3
ret i64 %4
}
/* Variables and functions */
int execve(char *, char **, char **);
extern int execv(char *path, char **argv) {
  extern char **environ;
  return execve(path, argv, environ);
}


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

x86 assembly (clang, -O2):
<execv>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%rdx
jmp    1030 <execve@plt>

LLVM IR (-O0):
@environ = external global i8**
define i32 @execv(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
store i8* %0, i8** %3
store i8** %1, i8*** %4
%5 = load i8*, i8** %3
%6 = load i8**, i8*** %4
%7 = load i8**, i8*** @environ
%8 = call i32 @execve(i8* %5, i8** %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
@environ = external global i8**
define i32 @execv(i8* %0, i8** %1) {
%3 = load i8**, i8*** @environ
%4 = tail call i32 @execve(i8* %0, i8** %1, i8** %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void array(int a[], int k) {
  int i;
  for (i = 0; i < k; i++) {
    printf("%c\n", a[i] + 96);
  }
}


x86 assembly (clang, -O0):
<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    115a <array+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
add    $0x60,%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <array+0x16>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"%c\0A\00"
define void @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 = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
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 = add nsw i32 %15, 96
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%c\0A\00"
define void @array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 96
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
/* Variables and functions */
scalar_t__ malloc(short);
short *as1d(short X) {
  short *A = (short *)malloc(X * sizeof(short *));
  return A;
}


x86 assembly (clang, -O0):
<as1d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswq -0x2(%rbp),%rax
shl    $0x3,%rax
movswl %ax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<as1d>:
shl    $0x3,%edi
movswl %di,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i16* @as1d(i16 signext %0) {
%2 = alloca i16
%3 = alloca i16*
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = sext i16 %4 to i64
%6 = mul i64 %5, 8
%7 = trunc i64 %6 to i16
%8 = call i64 @malloc(i16 signext %7)
%9 = inttoptr i64 %8 to i16*
store i16* %9, i16** %3
%10 = load i16*, i16** %3
ret i16* %10
}

LLVM IR (-O2):
define i16* @as1d(i16 signext %0) {
%2 = shl i16 %0, 3
%3 = tail call i64 @malloc(i16 signext %2)
%4 = inttoptr i64 %3 to i16*
ret i16* %4
}
short USBSTK5515_GPIO_init() { return 0; }


x86 assembly (clang, -O0):
<USBSTK5515_GPIO_init>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
cwtl
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @USBSTK5515_GPIO_init() {
ret i16 0
}

LLVM IR (-O2):
define signext i16 @USBSTK5515_GPIO_init() {
ret i16 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void helplog() {
  printf("Usage: myke [options] [target] ...\nOptions:\n  -b\t\t\tRename "
         "old-makefile as \"makefile.bak\"\n  -m\t\t\tStart making this "
         "makefile\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [124 x i8] c"Usage: myke [options] [target] ...\0AOptions:\0A -b\09\09\09Rename old-makefile as \22makefile.bak\22\0A -m\09\09\09Start making this makefile\0A\00"
define void @helplog() {
%1 = call i32 @printf(i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [123 x i8] c"Usage: myke [options] [target] ...\0AOptions:\0A -b\09\09\09Rename old-makefile as \22makefile.bak\22\0A -m\09\09\09Start making this makefile\00"
define void @helplog() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([123 x i8], [123 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ shutdown(int, int);
int CloseSocket(int sockfd) {
  shutdown(sockfd, 2);
  close(sockfd);
  return (0);
}


x86 assembly (clang, -O0):
<CloseSocket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <shutdown@plt>
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CloseSocket>:
push   %rbx
mov    %edi,%ebx
mov    $0x2,%esi
call   1030 <shutdown@plt>
mov    %ebx,%edi
call   1040 <close@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @CloseSocket(i32 %0) {
%2 = tail call i32 @shutdown(i32 %0, i32 2)
%3 = tail call i32 @close(i32 %0)
ret i32 0
}
/* Variables and functions */
double dist(int /*<<< orphan*/, int /*<<< orphan*/, double, double);
double zeroDist(double x, double y) { return dist(0, 0, x, y); }


x86 assembly (clang, -O0):
<zeroDist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
xor    %esi,%esi
mov    %esi,%edi
call   1030 <dist@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zeroDist>:
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <dist@plt>

LLVM IR (-O0):
define double @zeroDist(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @dist(i32 0, i32 0, double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @zeroDist(double %0, double %1) {
%3 = tail call double @dist(i32 0, i32 0, double %0, double %1)
ret double %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t f4(uint32_t x, uint32_t y, uint32_t z) { return (x & z) | (y & ~z); }


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%edx
xor    $0xffffffff,%edx
and    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
mov    %edi,%eax
xor    %esi,%eax
and    %edx,%eax
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @f4(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %6
%9 = and i32 %7, %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = xor i32 %11, -1
%13 = and i32 %10, %12
%14 = or i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @f4(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, %0
%5 = xor i32 %2, -1
%6 = and i32 %5, %1
%7 = or i32 %4, %6
ret i32 %7
}
void CONF_set_default_method(void) {}


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

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

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

LLVM IR (-O2):
define void @CONF_set_default_method() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  bool a = true;
  bool b = false;
  if (a != b) {
    puts("Booleans work!");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1145 <main+0x35>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"Booleans work!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = load i32, i32* %3
%6 = icmp ne i32 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@.str = [15 x i8] c"Booleans work!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void foo(int argc, char *argv[]) { printf("[1]: %s\n", argv[1]); }


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

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

LLVM IR (-O0):
@.str = [9 x i8] c"[1]: %s\0A\00"
define void @foo(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 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"[1]: %s\0A\00"
define void @foo(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
/* Type definitions */
struct kcn_token {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct kcn_token *);
void kcn_token_destroy(struct kcn_token *kt) { free(kt); }


x86 assembly (clang, -O0):
<kcn_token_destroy>:
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):
<kcn_token_destroy>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.kcn_token = type { i32 }
define void @kcn_token_destroy(%struct.kcn_token* %0) {
%2 = alloca %struct.kcn_token*
store %struct.kcn_token* %0, %struct.kcn_token** %2
%3 = load %struct.kcn_token*, %struct.kcn_token** %2
%4 = call i32 @free(%struct.kcn_token* %3)
ret void
}

LLVM IR (-O2):
%struct.kcn_token = type { i32 }
define void @kcn_token_destroy(%struct.kcn_token* nocapture %0) {
%2 = tail call i32 @free(%struct.kcn_token* %0)
ret void
}
/* Variables and functions */
void arg_shift_left(char **argv, int index) {
  int i;
  for (i = index; argv[i] != NULL; i++) {
    argv[i] = argv[i + 1];
  }
}


x86 assembly (clang, -O0):
<arg_shift_left>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     114f <arg_shift_left+0x4f>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1111 <arg_shift_left+0x11>
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_shift_left>:
movslq %esi,%rax
cmpq   $0x0,(%rdi,%rax,8)
je     1130 <arg_shift_left+0x30>
lea    (%rdi,%rax,8),%rax
add    $0x8,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rax),%rcx
mov    %rcx,-0x8(%rax)
add    $0x8,%rax
test   %rcx,%rcx
jne    1120 <arg_shift_left+0x20>
ret

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

LLVM IR (-O2):
define void @arg_shift_left(i8** nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
br i1 %6, label %15, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %10, %7 ], [ %3, %2 ]
%9 = phi i8** [ %11, %7 ], [ %4, %2 ]
%10 = add i64 %8, 1
%11 = getelementptr inbounds i8*, i8** %0, i64 %10
%12 = load i8*, i8** %11
store i8* %12, i8** %9
%13 = load i8*, i8** %11
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %7
15: ; preds = %7, %2
ret void
}
void write_phys(unsigned long addr, unsigned long value) {
  volatile unsigned long *ptr;
  ptr = (void *)addr;
  *ptr = value;
}


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

x86 assembly (clang, -O2):
<write_phys>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
define void @write_phys(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = inttoptr i64 %6 to i8*
%8 = bitcast i8* %7 to i64*
store i64* %8, i64** %5
%9 = load i64, i64* %4
%10 = load i64*, i64** %5
store volatile i64 %9, i64* %10
ret void
}

LLVM IR (-O2):
define void @write_phys(i64 %0, i64 %1) {
%3 = inttoptr i64 %0 to i64*
store volatile i64 %1, i64* %3
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void modify_name(char **file_name, int size, char *argv) {
  *file_name = (char *)malloc(sizeof(char) * size);
  if (!file_name) {
    printf("memmory allocation failed\n");
    return;
  }
  strcpy(*file_name, argv);
  strcat(*file_name, ".as\0");
}


x86 assembly (clang, -O0):
<modify_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x8(%rbp)
jne    1188 <modify_name+0x48>
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
jmp    11ab <modify_name+0x6b>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xe75(%rip),%rsi
call   1060 <strcat@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modify_name>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <malloc@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    (%rbx),%rdi
lea    0xea7(%rip),%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <strcat@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"memmory allocation failed\0A\00"
@.str.1 = [5 x i8] c".as\00\00"
define void @modify_name(i8** %0, i32 %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %5
%8 = sext i32 %7 to i64
%9 = mul i64 1, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
%13 = load i8**, i8*** %4
store i8* %12, i8** %13
%14 = load i8**, i8*** %4
%15 = icmp ne i8** %14, null
br i1 %15, label %18, label %16
16: ; preds = %3
%17 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
br label %26
18: ; preds = %3
%19 = load i8**, i8*** %4
%20 = load i8*, i8** %19
%21 = load i8*, i8** %6
%22 = call i32 @strcpy(i8* %20, i8* %21)
%23 = load i8**, i8*** %4
%24 = load i8*, i8** %23
%25 = call i32 @strcat(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %18, %16
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c".as\00\00"
define void @modify_name(i8** nocapture %0, i32 %1, i8* %2) {
%4 = tail call i64 @malloc(i32 %1)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %0
%6 = tail call i32 @strcpy(i8* %5, i8* %2)
%7 = load i8*, i8** %0
%8 = tail call i32 @strcat(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_cmpgt_epi16(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i test_mm_cmpgt_epi16(__m128i A, __m128i B) {
  return _mm_cmpgt_epi16(A, B);
}


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

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

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

LLVM IR (-O2):
define i32 @test_mm_cmpgt_epi16(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_cmpgt_epi16(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ list_compare(int *);
value_compare(int *a) {
  if (a)
    list_compare(a);
}


x86 assembly (clang, -O0):
<value_compare>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1130 <value_compare+0x20>
mov    -0x10(%rbp),%rdi
call   1030 <list_compare@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<value_compare>:
test   %rdi,%rdi
je     111f <value_compare+0xf>
push   %rax
call   1030 <list_compare@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @value_compare(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @list_compare(i32* %0)
br label %5
5: ; preds = %3, %1
ret i32 undef
}
int test_imm_DDuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xDD << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DDuint64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0xdd,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_DDuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 221
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void RTNetIPv4UDPChecksum(void) {}


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

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

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

LLVM IR (-O2):
define void @RTNetIPv4UDPChecksum() {
ret void
}
float byteSwapFloat(float a) {
  union {
    float whole;
    unsigned char bytes[4];
  } u, v;
  u.whole = a;
  v.bytes[0] = u.bytes[3];
  v.bytes[1] = u.bytes[2];
  v.bytes[2] = u.bytes[1];
  v.bytes[3] = u.bytes[0];
  return v.whole;
}


x86 assembly (clang, -O0):
<byteSwapFloat>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x5(%rbp),%al
mov    %al,-0x10(%rbp)
mov    -0x6(%rbp),%al
mov    %al,-0xf(%rbp)
mov    -0x7(%rbp),%al
mov    %al,-0xe(%rbp)
mov    -0x8(%rbp),%al
mov    %al,-0xd(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<byteSwapFloat>:
movd   %xmm0,%eax
bswap  %eax
movd   %eax,%xmm0
ret

LLVM IR (-O0):
%union.anon = type { float }
define float @byteSwapFloat(float %0) {
%2 = alloca float
%3 = alloca %union.anon
%4 = alloca %union.anon
store float %0, float* %2
%5 = load float, float* %2
%6 = bitcast %union.anon* %3 to float*
store float %5, float* %6
%7 = bitcast %union.anon* %3 to [4 x i8]*
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %7, i64 0, i64 3
%9 = load i8, i8* %8
%10 = bitcast %union.anon* %4 to [4 x i8]*
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %10, i64 0, i64 0
store i8 %9, i8* %11
%12 = bitcast %union.anon* %3 to [4 x i8]*
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
%14 = load i8, i8* %13
%15 = bitcast %union.anon* %4 to [4 x i8]*
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 1
store i8 %14, i8* %16
%17 = bitcast %union.anon* %3 to [4 x i8]*
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %17, i64 0, i64 1
%19 = load i8, i8* %18
%20 = bitcast %union.anon* %4 to [4 x i8]*
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %20, i64 0, i64 2
store i8 %19, i8* %21
%22 = bitcast %union.anon* %3 to [4 x i8]*
%23 = getelementptr inbounds [4 x i8], [4 x i8]* %22, i64 0, i64 0
%24 = load i8, i8* %23
%25 = bitcast %union.anon* %4 to [4 x i8]*
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %25, i64 0, i64 3
store i8 %24, i8* %26
%27 = bitcast %union.anon* %4 to float*
%28 = load float, float* %27
ret float %28
}

LLVM IR (-O2):
define float @byteSwapFloat(float %0) {
%2 = bitcast float %0 to i32
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = bitcast i32 %3 to float
ret float %4
}
double range(double x, double a, double b) { return (x - a) / (b - a); }


x86 assembly (clang, -O0):
<range>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<range>:
subsd  %xmm1,%xmm0
subsd  %xmm1,%xmm2
divsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @range(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
%10 = load double, double* %6
%11 = load double, double* %5
%12 = fsub double %10, %11
%13 = fdiv double %9, %12
ret double %13
}

LLVM IR (-O2):
define double @range(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = fsub double %2, %1
%6 = fdiv double %4, %5
ret double %6
}
/* Variables and functions */
int abs(int);
int manhattan_distance(int x1, int y1, int x2, int y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}


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

x86 assembly (clang, -O2):
<manhattan_distance>:
sub    %edx,%edi
mov    %edi,%edx
neg    %edx
cmovs  %edi,%edx
sub    %ecx,%esi
mov    %esi,%eax
neg    %eax
cmovs  %esi,%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @manhattan_distance(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
%9 = load i32, i32* %5
%10 = load i32, i32* %7
%11 = sub nsw i32 %9, %10
%12 = call i32 @abs(i32 %11)
%13 = load i32, i32* %6
%14 = load i32, i32* %8
%15 = sub nsw i32 %13, %14
%16 = call i32 @abs(i32 %15)
%17 = add nsw i32 %12, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @manhattan_distance(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %2
%6 = tail call i32 @llvm.abs.i32(i32 %5, i1 true)
%7 = sub nsw i32 %1, %3
%8 = tail call i32 @llvm.abs.i32(i32 %7, i1 true)
%9 = add nuw nsw i32 %8, %6
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ printf(char *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  srand(atoi(argv[1]));
  printf("%i", rand());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   1060 <rand@plt>
lea    0xea1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @atoi(i8* %8)
%10 = call i32 @srand(i32 %9)
%11 = call i32 (...) @rand()
%12 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i32 @srand(i32 %5)
%7 = tail call i32 (...) @rand()
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}
unsigned tx_padding_size(unsigned len) { return (~len + 1) & (8 - 1); }


x86 assembly (clang, -O0):
<tx_padding_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
and    $0x7,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tx_padding_size>:
mov    %edi,%eax
neg    %eax
and    $0x7,%eax
ret

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

LLVM IR (-O2):
define i32 @tx_padding_size(i32 %0) {
%2 = sub i32 0, %0
%3 = and i32 %2, 7
ret i32 %3
}
void initInfrared() {
  (*(unsigned int *)0x50008000) &= ~(1 << 8);
  (*(unsigned int *)0x50008010) |= 0x0100;
  ;
  (*(unsigned int *)0x50008004) &= ~0x0100;
  ;
  (*(unsigned int *)0x50008008) |= 0x0100;
  ;
  (*(unsigned int *)0xE000E104) |= 0x1000000;
}


x86 assembly (clang, -O0):
<initInfrared>:
push   %rbp
mov    %rsp,%rbp
mov    $0x50008000,%eax
mov    (%rax),%ecx
and    $0xfffffeff,%ecx
mov    $0x50008000,%eax
mov    %ecx,(%rax)
mov    $0x50008010,%eax
mov    (%rax),%ecx
or     $0x100,%ecx
mov    $0x50008010,%eax
mov    %ecx,(%rax)
mov    $0x50008004,%eax
mov    (%rax),%ecx
and    $0xfffffeff,%ecx
mov    $0x50008004,%eax
mov    %ecx,(%rax)
mov    $0x50008008,%eax
mov    (%rax),%ecx
or     $0x100,%ecx
mov    $0x50008008,%eax
mov    %ecx,(%rax)
mov    $0xe000e104,%eax
mov    (%rax),%ecx
or     $0x1000000,%ecx
mov    $0xe000e104,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<initInfrared>:
andb   $0xfe,0x50008001
fe
orb    $0x1,0x50008011
01
andb   $0xfe,0x50008005
fe
orb    $0x1,0x50008009
01
mov    $0xe000e104,%eax
orb    $0x1,0x3(%rax)
ret

LLVM IR (-O0):
define void @initInfrared() {
%1 = load i32, i32* inttoptr (i64 1342210048 to i32*)
%2 = and i32 %1, -257
store i32 %2, i32* inttoptr (i64 1342210048 to i32*)
%3 = load i32, i32* inttoptr (i64 1342210064 to i32*)
%4 = or i32 %3, 256
store i32 %4, i32* inttoptr (i64 1342210064 to i32*)
%5 = load i32, i32* inttoptr (i64 1342210052 to i32*)
%6 = and i32 %5, -257
store i32 %6, i32* inttoptr (i64 1342210052 to i32*)
%7 = load i32, i32* inttoptr (i64 1342210056 to i32*)
%8 = or i32 %7, 256
store i32 %8, i32* inttoptr (i64 1342210056 to i32*)
%9 = load i32, i32* inttoptr (i64 3758153988 to i32*)
%10 = or i32 %9, 16777216
store i32 %10, i32* inttoptr (i64 3758153988 to i32*)
ret void
}

LLVM IR (-O2):
define void @initInfrared() {
%1 = load i32, i32* inttoptr (i64 1342210048 to i32*)
%2 = and i32 %1, -257
store i32 %2, i32* inttoptr (i64 1342210048 to i32*)
%3 = load i32, i32* inttoptr (i64 1342210064 to i32*)
%4 = or i32 %3, 256
store i32 %4, i32* inttoptr (i64 1342210064 to i32*)
%5 = load i32, i32* inttoptr (i64 1342210052 to i32*)
%6 = and i32 %5, -257
store i32 %6, i32* inttoptr (i64 1342210052 to i32*)
%7 = load i32, i32* inttoptr (i64 1342210056 to i32*)
%8 = or i32 %7, 256
store i32 %8, i32* inttoptr (i64 1342210056 to i32*)
%9 = load i32, i32* inttoptr (i64 3758153988 to i32*)
%10 = or i32 %9, 16777216
store i32 %10, i32* inttoptr (i64 3758153988 to i32*)
ret void
}
/* Type definitions */
struct vec2i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec2i_bezier3(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 float);
__attribute__((always_)) struct vec2i *
psvec2i_bezier3(struct vec2i *result, struct vec2i *a, struct vec2i *b,
                struct vec2i *c, float p) {
  vec2i_bezier3((int32_t *)result, (int32_t *)a, (int32_t *)b, (int32_t *)c, p);
  return result;
}


x86 assembly (clang, -O0):
<psvec2i_bezier3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
movss  -0x24(%rbp),%xmm0
call   1030 <vec2i_bezier3@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec2i_bezier3>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec2i_bezier3@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec2i = type { i32 }
define %struct.vec2i* @psvec2i_bezier3(%struct.vec2i* %0, %struct.vec2i* %1, %struct.vec2i* %2, %struct.vec2i* %3, float %4) {
%6 = alloca %struct.vec2i*
%7 = alloca %struct.vec2i*
%8 = alloca %struct.vec2i*
%9 = alloca %struct.vec2i*
%10 = alloca float
store %struct.vec2i* %0, %struct.vec2i** %6
store %struct.vec2i* %1, %struct.vec2i** %7
store %struct.vec2i* %2, %struct.vec2i** %8
store %struct.vec2i* %3, %struct.vec2i** %9
store float %4, float* %10
%11 = load %struct.vec2i*, %struct.vec2i** %6
%12 = bitcast %struct.vec2i* %11 to i32*
%13 = load %struct.vec2i*, %struct.vec2i** %7
%14 = bitcast %struct.vec2i* %13 to i32*
%15 = load %struct.vec2i*, %struct.vec2i** %8
%16 = bitcast %struct.vec2i* %15 to i32*
%17 = load %struct.vec2i*, %struct.vec2i** %9
%18 = bitcast %struct.vec2i* %17 to i32*
%19 = load float, float* %10
%20 = call i32 @vec2i_bezier3(i32* %12, i32* %14, i32* %16, i32* %18, float %19)
%21 = load %struct.vec2i*, %struct.vec2i** %6
ret %struct.vec2i* %21
}

LLVM IR (-O2):
%struct.vec2i = type { i32 }
define %struct.vec2i* @psvec2i_bezier3(%struct.vec2i* returned %0, %struct.vec2i* %1, %struct.vec2i* %2, %struct.vec2i* %3, float %4) {
%6 = getelementptr %struct.vec2i, %struct.vec2i* %0, i64 0, i32 0
%7 = getelementptr %struct.vec2i, %struct.vec2i* %1, i64 0, i32 0
%8 = getelementptr %struct.vec2i, %struct.vec2i* %2, i64 0, i32 0
%9 = getelementptr %struct.vec2i, %struct.vec2i* %3, i64 0, i32 0
%10 = tail call i32 @vec2i_bezier3(i32* %6, i32* %7, i32* %8, i32* %9, float %4)
ret %struct.vec2i* %0
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
double time_diff(struct timespec *a, struct timespec *b) {
  return (double)(b->tv_sec - a->tv_sec) +
         (double)(b->tv_nsec - a->tv_nsec) / (1.0e9);
}


x86 assembly (clang, -O0):
<time_diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x8(%rbp),%rcx
sub    0x8(%rcx),%rax
cvtsi2sd %rax,%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%rax
cvtsi2sd %rax,%xmm1
movsd  0xec4(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_diff>:
mov    (%rsi),%rax
mov    0x8(%rsi),%rcx
sub    0x8(%rdi),%rcx
cvtsi2sd %rcx,%xmm1
sub    (%rdi),%rax
cvtsi2sd %rax,%xmm0
divsd  0xee0(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define double @time_diff(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load %struct.timespec*, %struct.timespec** %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 1
%7 = load i64, i64* %6
%8 = load %struct.timespec*, %struct.timespec** %3
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 1
%10 = load i64, i64* %9
%11 = sub nsw i64 %7, %10
%12 = sitofp i64 %11 to double
%13 = load %struct.timespec*, %struct.timespec** %4
%14 = getelementptr inbounds %struct.timespec, %struct.timespec* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = load %struct.timespec*, %struct.timespec** %3
%17 = getelementptr inbounds %struct.timespec, %struct.timespec* %16, i32 0, i32 0
%18 = load i64, i64* %17
%19 = sub nsw i64 %15, %18
%20 = sitofp i64 %19 to double
%21 = fdiv double %20, 1.000000e+09
%22 = fadd double %12, %21
ret double %22
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define double @time_diff(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sub nsw i64 %4, %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%12 = load i64, i64* %11
%13 = sub nsw i64 %10, %12
%14 = sitofp i64 %13 to double
%15 = fdiv double %14, 1.000000e+09
%16 = fadd double %15, %8
ret double %16
}
int ft_isascii(int c) {
  if (c >= 000 && c <= 0177)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<ft_isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1127 <ft_isascii+0x27>
cmpl   $0x7f,-0x8(%rbp)
jg     1127 <ft_isascii+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <ft_isascii+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isascii>:
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @ft_isascii(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
scalar_t__ strlen(char *);
extern int TakeAStringArrayAndReturnTotalLength(char **arr) {
  return (int)(strlen(arr[0]) + strlen(arr[1]));
}


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

x86 assembly (clang, -O2):
<TakeAStringArrayAndReturnTotalLength>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <strlen@plt>
mov    %rax,%r14
mov    0x8(%rbx),%rdi
call   1030 <strlen@plt>
add    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @TakeAStringArrayAndReturnTotalLength(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = load i8**, i8*** %2
%4 = getelementptr inbounds i8*, i8** %3, i64 0
%5 = load i8*, i8** %4
%6 = call i64 @strlen(i8* %5)
%7 = load i8**, i8*** %2
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i64 @strlen(i8* %9)
%11 = add nsw i64 %6, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @TakeAStringArrayAndReturnTotalLength(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%4 = getelementptr inbounds i8*, i8** %0, i64 1
%5 = load i8*, i8** %4
%6 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%7 = add nsw i64 %6, %3
%8 = trunc i64 %7 to i32
ret i32 %8
}
/* Variables and functions */
scalar_t__ malloc(unsigned int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, unsigned int);
void *SCNormalloc(unsigned int length, char *file, int line) {
  void *buffer = 0;
  buffer = (void *)malloc(length);
  if (buffer)
    memset(buffer, 0, length);
  return buffer;
}


x86 assembly (clang, -O0):
<SCNormalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     115f <SCNormalloc+0x3f>
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCNormalloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     113e <SCNormalloc+0x1e>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @SCNormalloc(i32 %0, i8* nocapture readnone %1, i32 %2) {
%4 = tail call i64 @malloc(i32 %0)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @memset(i8* %5, i32 0, i32 %0)
br label %9
9: ; preds = %7, %3
ret i8* %5
}