#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*/ uint32_t;
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int compute_sq(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ mt_minmax(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ print_sq(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int time(int /*<<< orphan*/ *);
int slam(uint32_t min, uint32_t max) {
  int16_t matrix[9] = {0};
  int32_t output[8] = {0};
  uint8_t res = 0;
  uint64_t start = time(NULL);
  uint64_t total = 0;
  uint64_t runtime = 0;
  uint64_t parkerct = 0;
  uint64_t invalidct = 0;
  while (1) {
  generate_another_matrix:
    matrix[0] = mt_minmax(min, max);
    matrix[1] = mt_minmax(min, max);
    matrix[2] = mt_minmax(min, max);
    matrix[3] = mt_minmax(min, max);
    matrix[4] = mt_minmax(min, max);
    matrix[5] = mt_minmax(min, max);
    matrix[6] = mt_minmax(min, max);
    matrix[7] = mt_minmax(min, max);
    matrix[8] = mt_minmax(min, max);
    res = compute_sq(output, matrix, 0);
    total++;
    if ((res & 0x02) && !(res & 0x04)) {
      printf("\nMONEY!\n");
      print_sq(matrix);
      return 0;
    }
    if (res & 0x04) {
      invalidct++;
    }
    if (res & 0x08) {
      if (1) {
        print_sq(matrix);
      }
      parkerct++;
    }
    if (total % 16777215 == 0) {
      runtime = time(NULL) - start;
      if (runtime != 0) {
        printf("RUNTIME=%lu (~%lu/s) PARKER=%lu (%f%%) TOTAL=%lu VALID=%lu "
               "INVALID=%lu (%f%%)\n",
               runtime, total / runtime, parkerct,
               ((double)parkerct / (double)total) * 100.0f, total,
               total - invalidct, invalidct,
               ((double)invalidct / (double)total) * 100.0f);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<slam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1050 <memset@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
movl   $0x0,-0x54(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
movl   $0x0,-0x68(%rbp)
jmp    11c2 <slam+0x62>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1070 <mt_minmax@plt>
mov    %eax,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    -0x30(%rbp),%rsi
xor    %edx,%edx
call   1040 <compute_sq@plt>
mov    %eax,-0x54(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x54(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1298 <slam+0x138>
mov    -0x54(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
jne    1298 <slam+0x138>
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1080 <print_sq@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret
mov    -0x54(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     12b0 <slam+0x150>
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
mov    -0x54(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
je     12d1 <slam+0x171>
lea    -0x30(%rbp),%rdi
call   1080 <print_sq@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
mov    -0x5c(%rbp),%eax
mov    $0xffffff,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1366 <slam+0x206>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
sub    -0x58(%rbp),%eax
mov    %eax,-0x60(%rbp)
cmpl   $0x0,-0x60(%rbp)
je     1361 <slam+0x201>
mov    -0x60(%rbp),%esi
mov    -0x5c(%rbp),%eax
cltd
idivl  -0x60(%rbp)
mov    %eax,%edx
mov    -0x64(%rbp),%ecx
cvtsi2sdl -0x64(%rbp),%xmm0
cvtsi2sdl -0x5c(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  0xcdd(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x5c(%rbp),%r8d
mov    -0x5c(%rbp),%r9d
sub    -0x68(%rbp),%r9d
mov    -0x68(%rbp),%eax
cvtsi2sdl -0x68(%rbp),%xmm1
cvtsi2sdl -0x5c(%rbp),%xmm2
divsd  %xmm2,%xmm1
movsd  0xcb4(%rip),%xmm2
mulsd  %xmm2,%xmm1
lea    0xcba(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x2,%al
call   1030 <printf@plt>
jmp    1366 <slam+0x206>
jmp    11bd <slam+0x5d>

x86 assembly (clang, -O2):
<slam>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
xorpd  %xmm0,%xmm0
movapd %xmm0,0x30(%rsp)
movapd %xmm0,0x20(%rsp)
movl   $0x0,0x40(%rsp)
movapd %xmm0,0x60(%rsp)
movapd %xmm0,0x50(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0x1c(%rsp)
movl   $0xffffffff,0xc(%rsp)
ff
mov    $0x1,%r12d
xor    %r13d,%r13d
jmp    11c9 <slam+0x69>
nopl   0x0(%rax,%rax,1)
addl   $0xffffffff,0xc(%rsp)
add    $0x1,%r12d
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x20(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x24(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x28(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x2c(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x30(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x34(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x38(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x3c(%rsp)
mov    %ebp,%edi
mov    %ebx,%esi
call   1070 <mt_minmax@plt>
mov    %eax,0x40(%rsp)
lea    0x50(%rsp),%rdi
lea    0x20(%rsp),%rsi
xor    %edx,%edx
call   1050 <compute_sq@plt>
mov    %eax,%ecx
and    $0x6,%ecx
cmp    $0x2,%ecx
je     1321 <slam+0x1c1>
mov    %r12d,%ecx
mov    %rcx,%rdx
shl    $0x8,%rdx
add    %rcx,%rdx
shr    $0x20,%rdx
mov    %r12d,%ecx
sub    %edx,%ecx
shr    %ecx
add    %edx,%ecx
shr    $0x17,%ecx
mov    %ecx,%r14d
shl    $0x18,%r14d
sub    %ecx,%r14d
add    0xc(%rsp),%r14d
mov    %eax,%r15d
shr    $0x2,%r15d
and    $0x1,%r15d
test   $0x8,%al
je     12af <slam+0x14f>
lea    0x20(%rsp),%rdi
call   1080 <print_sq@plt>
mov    0x10(%rsp),%rax
add    $0x1,%eax
mov    %rax,0x10(%rsp)
add    %r15d,%r13d
test   %r14d,%r14d
jne    11c0 <slam+0x60>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%esi
sub    0x1c(%rsp),%esi
je     11c0 <slam+0x60>
mov    %r12d,%eax
cltd
mov    0x10(%rsp),%rcx
cvtsi2sd %ecx,%xmm0
cvtsi2sd %r12d,%xmm2
idiv   %esi
divsd  %xmm2,%xmm0
movsd  0xd12(%rip),%xmm3
mulsd  %xmm3,%xmm0
mov    %r12d,%r9d
sub    %r13d,%r9d
cvtsi2sd %r13d,%xmm1
divsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
mov    %r13d,(%rsp)
lea    0xcf8(%rip),%rdi
mov    %eax,%edx
mov    %r12d,%r8d
mov    $0x2,%al
call   1040 <printf@plt>
jmp    11c0 <slam+0x60>
lea    0xd2f(%rip),%rdi
call   1030 <puts@plt>
lea    0x20(%rsp),%rdi
call   1080 <print_sq@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"\0AMONEY!\0A\00"
@.str.1 = [79 x i8] c"RUNTIME=%lu (~%lu/s) PARKER=%lu (%f%%) TOTAL=%lu VALID=%lu INVALID=%lu (%f%%)\0A\00"
define i32 @slam(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [9 x i32]
%6 = alloca [8 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%13 = bitcast [9 x i32]* %5 to i8*
%14 = bitcast [8 x i32]* %6 to i8*
store i32 0, i32* %7
%15 = call i32 @time(i32* null)
store i32 %15, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
br label %16
16: ; preds = %2, %121
br label %17
17: ; preds = %16
%18 = load i32, i32* %3
%19 = load i32, i32* %4
%20 = call i32 @mt_minmax(i32 %18, i32 %19)
%21 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 0
store i32 %20, i32* %21
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @mt_minmax(i32 %22, i32 %23)
%25 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 1
store i32 %24, i32* %25
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = call i32 @mt_minmax(i32 %26, i32 %27)
%29 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 2
store i32 %28, i32* %29
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = call i32 @mt_minmax(i32 %30, i32 %31)
%33 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 3
store i32 %32, i32* %33
%34 = load i32, i32* %3
%35 = load i32, i32* %4
%36 = call i32 @mt_minmax(i32 %34, i32 %35)
%37 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 4
store i32 %36, i32* %37
%38 = load i32, i32* %3
%39 = load i32, i32* %4
%40 = call i32 @mt_minmax(i32 %38, i32 %39)
%41 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 5
store i32 %40, i32* %41
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = call i32 @mt_minmax(i32 %42, i32 %43)
%45 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 6
store i32 %44, i32* %45
%46 = load i32, i32* %3
%47 = load i32, i32* %4
%48 = call i32 @mt_minmax(i32 %46, i32 %47)
%49 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 7
store i32 %48, i32* %49
%50 = load i32, i32* %3
%51 = load i32, i32* %4
%52 = call i32 @mt_minmax(i32 %50, i32 %51)
%53 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 8
store i32 %52, i32* %53
%54 = getelementptr inbounds [8 x i32], [8 x i32]* %6, i64 0, i64 0
%55 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 0
%56 = call i32 @compute_sq(i32* %54, i32* %55, i32 0)
store i32 %56, i32* %7
%57 = load i32, i32* %9
%58 = add nsw i32 %57, 1
store i32 %58, i32* %9
%59 = load i32, i32* %7
%60 = and i32 %59, 2
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %70
62: ; preds = %17
%63 = load i32, i32* %7
%64 = and i32 %63, 4
%65 = icmp ne i32 %64, 0
br i1 %65, label %70, label %66
66: ; preds = %62
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%68 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 0
%69 = call i32 @print_sq(i32* %68)
ret i32 0
70: ; preds = %62, %17
%71 = load i32, i32* %7
%72 = and i32 %71, 4
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %70
%75 = load i32, i32* %12
%76 = add nsw i32 %75, 1
store i32 %76, i32* %12
br label %77
77: ; preds = %74, %70
%78 = load i32, i32* %7
%79 = and i32 %78, 8
%80 = icmp ne i32 %79, 0
br i1 %80, label %81, label %86
81: ; preds = %77
%82 = getelementptr inbounds [9 x i32], [9 x i32]* %5, i64 0, i64 0
%83 = call i32 @print_sq(i32* %82)
%84 = load i32, i32* %11
%85 = add nsw i32 %84, 1
store i32 %85, i32* %11
br label %86
86: ; preds = %81, %77
%87 = load i32, i32* %9
%88 = srem i32 %87, 16777215
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %121
90: ; preds = %86
%91 = call i32 @time(i32* null)
%92 = load i32, i32* %8
%93 = sub nsw i32 %91, %92
store i32 %93, i32* %10
%94 = load i32, i32* %10
%95 = icmp ne i32 %94, 0
br i1 %95, label %96, label %120
96: ; preds = %90
%97 = load i32, i32* %10
%98 = load i32, i32* %9
%99 = load i32, i32* %10
%100 = sdiv i32 %98, %99
%101 = load i32, i32* %11
%102 = load i32, i32* %11
%103 = sitofp i32 %102 to double
%104 = load i32, i32* %9
%105 = sitofp i32 %104 to double
%106 = fdiv double %103, %105
%107 = fmul double %106, 1.000000e+02
%108 = load i32, i32* %9
%109 = load i32, i32* %9
%110 = load i32, i32* %12
%111 = sub nsw i32 %109, %110
%112 = load i32, i32* %12
%113 = load i32, i32* %12
%114 = sitofp i32 %113 to double
%115 = load i32, i32* %9
%116 = sitofp i32 %115 to double
%117 = fdiv double %114, %116
%118 = fmul double %117, 1.000000e+02
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i32 %97, i32 %100, i32 %101, double %107, i32 %108, i32 %111, i32 %112, double %118)
br label %120
120: ; preds = %96, %90
br label %121
121: ; preds = %120, %86
br label %16
}

LLVM IR (-O2):
@.str.1 = [79 x i8] c"RUNTIME=%lu (~%lu/s) PARKER=%lu (%f%%) TOTAL=%lu VALID=%lu INVALID=%lu (%f%%)\0A\00"
@str = [8 x i8] c"\0AMONEY!\00"
define i32 @slam(i32 %0, i32 %1) {
%3 = alloca [9 x i32]
%4 = alloca [8 x i32]
%5 = bitcast [9 x i32]* %3 to i8*
%6 = bitcast [8 x i32]* %4 to i8*
%7 = tail call i32 @time(i32* null)
%8 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 0
%9 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 1
%10 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 2
%11 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 3
%12 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 4
%13 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 5
%14 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 6
%15 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 7
%16 = getelementptr inbounds [9 x i32], [9 x i32]* %3, i64 0, i64 8
%17 = getelementptr inbounds [8 x i32], [8 x i32]* %4, i64 0, i64 0
br label %18
18: ; preds = %55, %2
%19 = phi i32 [ 0, %2 ], [ %32, %55 ]
%20 = phi i32 [ 0, %2 ], [ %48, %55 ]
%21 = phi i32 [ 0, %2 ], [ %41, %55 ]
%22 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %22, i32* %8
%23 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %23, i32* %9
%24 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %24, i32* %10
%25 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %25, i32* %11
%26 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %26, i32* %12
%27 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %27, i32* %13
%28 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %28, i32* %14
%29 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %29, i32* %15
%30 = call i32 @mt_minmax(i32 %0, i32 %1)
store i32 %30, i32* %16
%31 = call i32 @compute_sq(i32* %17, i32* %8, i32 0)
%32 = add nuw nsw i32 %19, 1
%33 = and i32 %31, 6
%34 = icmp eq i32 %33, 2
br i1 %34, label %35, label %38
35: ; preds = %18
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%37 = call i32 @print_sq(i32* %8)
ret i32 0
38: ; preds = %18
%39 = lshr i32 %31, 2
%40 = and i32 %39, 1
%41 = add nuw nsw i32 %40, %21
%42 = and i32 %31, 8
%43 = icmp eq i32 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %38
%45 = call i32 @print_sq(i32* %8)
%46 = add nsw i32 %20, 1
br label %47
47: ; preds = %44, %38
%48 = phi i32 [ %46, %44 ], [ %20, %38 ]
%49 = urem i32 %32, 16777215
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %55
51: ; preds = %47
%52 = call i32 @time(i32* null)
%53 = sub nsw i32 %52, %7
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %51, %56, %47
br label %18
56: ; preds = %51
%57 = sdiv i32 %32, %53
%58 = sitofp i32 %48 to double
%59 = sitofp i32 %32 to double
%60 = fdiv double %58, %59
%61 = fmul double %60, 1.000000e+02
%62 = sub nsw i32 %32, %41
%63 = sitofp i32 %41 to double
%64 = fdiv double %63, %59
%65 = fmul double %64, 1.000000e+02
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i32 %53, i32 %57, i32 %48, double %61, i32 %32, i32 %62, i32 %41, double %65)
br label %55
}