#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 */
typedef int uint8_t;
typedef int uint64_t;
typedef int /*<<< orphan*/ output0;
typedef int /*<<< orphan*/ input;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ bit_rotate(int *, int *);
int /*<<< orphan*/ bit_rotate_std(int *, int *);
int /*<<< orphan*/ do_test(int *, int *, int);
int /*<<< orphan*/ exit(int);
scalar_t__ memcmp(int *, int *, int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int main() {
  uint8_t input[8 * 64];
  uint64_t output0[64];
  uint64_t output1[64];
  memset(input, 0, sizeof(input));
  input[01] = 0xBE;
  input[32] = 0xAD;
  input[77] = 0xDE;
  bit_rotate(input, output0);
  bit_rotate((uint8_t *)output0, output1);
  assert(memcmp(input, output1, sizeof(input)) == 0);
  bit_rotate(input, output0);
  bit_rotate_std(input, output1);
  assert(memcmp(output0, output1, sizeof(output0)) == 0);
  printf("[.] warming up!\n");
  int i;
  for (i = 0; i < 10000; i++) {
    bit_rotate_std(input, output0);
    bit_rotate(input, output0);
  }
  int retry;
  for (retry = 0; retry < 10; retry += 1) {
    do_test(input, output0, 37);
  }
  if (retry == 10) {
    printf("FAILED!\n");
    exit(1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x810(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
movl   $0xbe,-0x80c(%rbp)
movl   $0xad,-0x790(%rbp)
movl   $0xde,-0x6dc(%rbp)
lea    -0x810(%rbp),%rdi
lea    -0x910(%rbp),%rsi
call   1060 <bit_rotate@plt>
lea    -0x910(%rbp),%rdi
lea    -0xa10(%rbp),%rsi
call   1060 <bit_rotate@plt>
lea    -0x810(%rbp),%rdi
lea    -0xa10(%rbp),%rsi
mov    $0x800,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x810(%rbp),%rdi
lea    -0x910(%rbp),%rsi
call   1060 <bit_rotate@plt>
lea    -0x810(%rbp),%rdi
lea    -0xa10(%rbp),%rsi
call   1030 <bit_rotate_std@plt>
lea    -0x910(%rbp),%rdi
lea    -0xa10(%rbp),%rsi
mov    $0x100,%edx
call   1070 <memcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    0xd98(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xa14(%rbp)
cmpl   $0x2710,-0xa14(%rbp)
jge    12c1 <main+0x141>
lea    -0x810(%rbp),%rdi
lea    -0x910(%rbp),%rsi
call   1030 <bit_rotate_std@plt>
lea    -0x810(%rbp),%rdi
lea    -0x910(%rbp),%rsi
call   1060 <bit_rotate@plt>
mov    -0xa14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa14(%rbp)
jmp    1277 <main+0xf7>
movl   $0x0,-0xa18(%rbp)
cmpl   $0xa,-0xa18(%rbp)
jge    1304 <main+0x184>
lea    -0x810(%rbp),%rdi
lea    -0x910(%rbp),%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    -0xa18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa18(%rbp)
jmp    12cb <main+0x14b>
cmpl   $0xa,-0xa18(%rbp)
jne    1327 <main+0x1a7>
lea    0xcf9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
xor    %eax,%eax
add    $0xa20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0xa08,%rsp
lea    0x200(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
movl   $0xbe,0x204(%rsp)
movl   $0xad,0x280(%rsp)
movl   $0xde,0x334(%rsp)
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <bit_rotate@plt>
lea    0x100(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
call   1060 <bit_rotate@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x800,%edx
call   1070 <memcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <bit_rotate@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <bit_rotate_std@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x100,%edx
call   1070 <memcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1080 <assert@plt>
lea    0xdc1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2710,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <bit_rotate_std@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <bit_rotate@plt>
add    $0xffffffff,%ebp
jne    1250 <main+0xd0>
lea    0x200(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x25,%edx
call   1090 <do_test@plt>
lea    0xcf3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"[.] warming up!\0A\00"
@.str.1 = [9 x i8] c"FAILED!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [512 x i32]
%3 = alloca [64 x i32]
%4 = alloca [64 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 0
%8 = call i32 @memset(i32* %7, i32 0, i32 2048)
%9 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 1
store i32 190, i32* %9
%10 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 32
store i32 173, i32* %10
%11 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 77
store i32 222, i32* %11
%12 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 0
%13 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%14 = call i32 @bit_rotate(i32* %12, i32* %13)
%15 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%16 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%17 = call i32 @bit_rotate(i32* %15, i32* %16)
%18 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 0
%19 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%20 = call i64 @memcmp(i32* %18, i32* %19, i32 2048)
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 0
%25 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%26 = call i32 @bit_rotate(i32* %24, i32* %25)
%27 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 0
%28 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%29 = call i32 @bit_rotate_std(i32* %27, i32* %28)
%30 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%31 = getelementptr inbounds [64 x i32], [64 x i32]* %4, i64 0, i64 0
%32 = call i64 @memcmp(i32* %30, i32* %31, i32 256)
%33 = icmp eq i64 %32, 0
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %37
37: ; preds = %47, %0
%38 = load i32, i32* %5
%39 = icmp slt i32 %38, 10000
br i1 %39, label %40, label %50
40: ; preds = %37
%41 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 0
%42 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%43 = call i32 @bit_rotate_std(i32* %41, i32* %42)
%44 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 0
%45 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%46 = call i32 @bit_rotate(i32* %44, i32* %45)
br label %47
47: ; preds = %40
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %37
50: ; preds = %37
store i32 0, i32* %6
br label %51
51: ; preds = %58, %50
%52 = load i32, i32* %6
%53 = icmp slt i32 %52, 10
br i1 %53, label %54, label %61
54: ; preds = %51
%55 = getelementptr inbounds [512 x i32], [512 x i32]* %2, i64 0, i64 0
%56 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%57 = call i32 @do_test(i32* %55, i32* %56, i32 37)
br label %58
58: ; preds = %54
%59 = load i32, i32* %6
%60 = add nsw i32 %59, 1
store i32 %60, i32* %6
br label %51
61: ; preds = %51
%62 = load i32, i32* %6
%63 = icmp eq i32 %62, 10
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %61
ret i32 0
}

LLVM IR (-O2):
@str = [16 x i8] c"[.] warming up!\00"
@str.2 = [8 x i8] c"FAILED!\00"
define i32 @main() {
%1 = alloca [512 x i32]
%2 = alloca [64 x i32]
%3 = alloca [64 x i32]
%4 = bitcast [512 x i32]* %1 to i8*
%5 = bitcast [64 x i32]* %2 to i8*
%6 = bitcast [64 x i32]* %3 to i8*
%7 = getelementptr inbounds [512 x i32], [512 x i32]* %1, i64 0, i64 0
%8 = call i32 @memset(i32* %7, i32 0, i32 2048)
%9 = getelementptr inbounds [512 x i32], [512 x i32]* %1, i64 0, i64 1
store i32 190, i32* %9
%10 = getelementptr inbounds [512 x i32], [512 x i32]* %1, i64 0, i64 32
store i32 173, i32* %10
%11 = getelementptr inbounds [512 x i32], [512 x i32]* %1, i64 0, i64 77
store i32 222, i32* %11
%12 = getelementptr inbounds [64 x i32], [64 x i32]* %2, i64 0, i64 0
%13 = call i32 @bit_rotate(i32* %7, i32* %12)
%14 = getelementptr inbounds [64 x i32], [64 x i32]* %3, i64 0, i64 0
%15 = call i32 @bit_rotate(i32* %12, i32* %14)
%16 = call i64 @memcmp(i32* %7, i32* %14, i32 2048)
%17 = icmp eq i64 %16, 0
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = call i32 @bit_rotate(i32* %7, i32* %12)
%21 = call i32 @bit_rotate_std(i32* %7, i32* %14)
%22 = call i64 @memcmp(i32* %12, i32* %14, i32 256)
%23 = icmp eq i64 %22, 0
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %27
27: ; preds = %0, %27
%28 = phi i32 [ 0, %0 ], [ %31, %27 ]
%29 = call i32 @bit_rotate_std(i32* %7, i32* %12)
%30 = call i32 @bit_rotate(i32* %7, i32* %12)
%31 = add nuw nsw i32 %28, 1
%32 = icmp eq i32 %31, 10000
br i1 %32, label %33, label %27
33: ; preds = %27
%34 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%35 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%36 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%37 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%38 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%39 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%40 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%41 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%42 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%43 = call i32 @do_test(i32* %7, i32* %12, i32 37)
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.2, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
}