#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ bigint_mul256(unsigned char *, unsigned char *,
                                 unsigned char *);
unsigned long long cpucycles();
int /*<<< orphan*/ print_bench(char *, unsigned long long *, int);
void speed_bigint_mul256() {
  unsigned long long t[10];
  int i;
  unsigned char r[64];
  for (i = 0; i < 10; i++) {
    t[i] = cpucycles();
    bigint_mul256(r, r, r);
  }
  print_bench("bigint_mul256", t, 10);
}


x86 assembly (clang, -O0):
<speed_bigint_mul256>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x54(%rbp)
cmpl   $0xa,-0x54(%rbp)
jge    1187 <speed_bigint_mul256+0x57>
mov    $0x0,%al
call   1040 <cpucycles@plt>
mov    %rax,%rcx
movslq -0x54(%rbp),%rax
mov    %rcx,-0x50(%rbp,%rax,8)
lea    -0xa0(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0xa0(%rbp),%rdx
call   1050 <bigint_mul256@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1142 <speed_bigint_mul256+0x12>
lea    -0x50(%rbp),%rsi
lea    0xe6e(%rip),%rdi
mov    $0xa,%edx
call   1030 <print_bench@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<speed_bigint_mul256>:
push   %rbx
sub    $0x90,%rsp
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,(%rsp)
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x8(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x18(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x20(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x28(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x30(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x38(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x40(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
xor    %eax,%eax
call   1040 <cpucycles@plt>
mov    %rax,0x48(%rsp)
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
call   1050 <bigint_mul256@plt>
lea    0xdb9(%rip),%rdi
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <print_bench@plt>
add    $0x90,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"bigint_mul256\00"
define void @speed_bigint_mul256() {
%1 = alloca [10 x i64]
%2 = alloca [64 x i8]
%3 = bitcast [10 x i64]* %1 to i8*
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%5 = call i64 (...) @cpucycles()
%6 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 0
store i64 %5, i64* %6
%7 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%8 = call i64 (...) @cpucycles()
%9 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 1
store i64 %8, i64* %9
%10 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%11 = call i64 (...) @cpucycles()
%12 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 2
store i64 %11, i64* %12
%13 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%14 = call i64 (...) @cpucycles()
%15 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 3
store i64 %14, i64* %15
%16 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%17 = call i64 (...) @cpucycles()
%18 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 4
store i64 %17, i64* %18
%19 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%20 = call i64 (...) @cpucycles()
%21 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 5
store i64 %20, i64* %21
%22 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%23 = call i64 (...) @cpucycles()
%24 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 6
store i64 %23, i64* %24
%25 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%26 = call i64 (...) @cpucycles()
%27 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 7
store i64 %26, i64* %27
%28 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%29 = call i64 (...) @cpucycles()
%30 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 8
store i64 %29, i64* %30
%31 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%32 = call i64 (...) @cpucycles()
%33 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 9
store i64 %32, i64* %33
%34 = call i32 @bigint_mul256(i8* %4, i8* %4, i8* %4)
%35 = call i32 @print_bench(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64* %6, i32 10)
ret void
}