#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 atoi(char *);
int /*<<< orphan*/ exit(int);
unsigned long long get_new_powball(int *);
int /*<<< orphan*/ printf(char *, unsigned int, ...);
int /*<<< orphan*/ quick_sort(int *, int /*<<< orphan*/, int);
int main(int argc, char **argv) {
  int i, pow_ball[6] = {0}, j, sum = 0;
  int stat_sums[80] = {0};
  unsigned long long last_ball = 0;
  j = i = 0;
  if (argc < 2)
    exit(-1);
  while (j < atoi(argv[1])) {
    last_ball = get_new_powball(pow_ball);
    quick_sort(pow_ball, 0, 4);
    for (i = 0; i < 5; i++) {
      if (i != 4)
        sum += (pow_ball[i + 1] - pow_ball[i]);
    }
    stat_sums[sum]++;
    for (i = 0; i < 5; i++)
      printf("%2i ", pow_ball[i]);
    printf("  %2i    %2i\n", ((unsigned int)last_ball % 35) + 1, sum);
    sum = 0;
    j++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1040 <memset@plt>
movl   $0x0,-0x38(%rbp)
lea    -0x180(%rbp),%rdi
xor    %esi,%esi
mov    $0x140,%edx
call   1040 <memset@plt>
movq   $0x0,-0x188(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11d0 <main+0x70>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
jmp    11d5 <main+0x75>
mov    -0x34(%rbp),%eax
mov    %eax,-0x18c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,%ecx
mov    -0x18c(%rbp),%eax
cmp    %ecx,%eax
jge    12e8 <main+0x188>
lea    -0x30(%rbp),%rdi
call   1050 <get_new_powball@plt>
mov    %rax,-0x188(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <quick_sort@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1263 <main+0x103>
cmpl   $0x4,-0x14(%rbp)
je     1250 <main+0xf0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x14(%rbp),%rcx
sub    -0x30(%rbp,%rcx,4),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    1255 <main+0xf5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1222 <main+0xc2>
movslq -0x38(%rbp),%rax
mov    -0x180(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x180(%rbp,%rax,4)
movl   $0x0,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    12ad <main+0x14d>
movslq -0x14(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xd68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    127f <main+0x11f>
mov    -0x188(%rbp),%rax
mov    $0x23,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%esi
add    $0x1,%esi
mov    -0x38(%rbp),%edx
lea    0xd39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11d5 <main+0x75>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x168,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
movq   $0x0,0x10(%rsp)
lea    0x20(%rsp),%rdi
mov    $0x140,%edx
xor    %esi,%esi
call   1040 <memset@plt>
cmp    $0x2,%ebx
jl     12a3 <main+0x143>
mov    0x8(%r14),%rdi
call   1070 <atoi@plt>
test   %eax,%eax
jle    128f <main+0x12f>
mov    %rsp,%r15
lea    0xe45(%rip),%r13
xor    %r12d,%r12d
xchg   %ax,%ax
mov    %r15,%rdi
call   1050 <get_new_powball@plt>
mov    %rax,%rbx
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1060 <quick_sort@plt>
mov    (%rsp),%esi
mov    0x4(%rsp),%eax
mov    0x8(%rsp),%ecx
lea    (%rsi,%rax,1),%edx
add    %ecx,%eax
mov    0xc(%rsp),%edi
add    %edi,%eax
add    %ecx,%edx
add    0x10(%rsp),%eax
add    %edi,%edx
sub    %edx,%eax
movslq %eax,%rbp
addl   $0x1,0x20(%rsp,%rbp,4)
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
mov    $0xd41d41d5,%ecx
imul   %rcx,%rax
shr    $0x20,%rax
mov    %ebx,%ecx
sub    %eax,%ecx
shr    %ecx
add    %eax,%ecx
shr    $0x5,%ecx
imul   $0x23,%ecx,%eax
neg    %eax
lea    (%rbx,%rax,1),%esi
add    $0x1,%esi
lea    0xd95(%rip),%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%r12d
mov    0x8(%r14),%rdi
call   1070 <atoi@plt>
cmp    %eax,%r12d
jl     11c0 <main+0x60>
xor    %eax,%eax
add    $0x168,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xffffffff,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%2i \00"
@.str.1 = [14 x i8] c" %2i %2i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [6 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca [80 x i32]
%11 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = bitcast [6 x i32]* %7 to i8*
store i32 0, i32* %9
%13 = bitcast [80 x i32]* %10 to i8*
store i64 0, i64* %11
store i32 0, i32* %6
store i32 0, i32* %8
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 @exit(i32 -1)
unreachable
18: ; preds = %2
br label %19
19: ; preds = %72, %18
%20 = load i32, i32* %8
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
%25 = icmp slt i32 %20, %24
br i1 %25, label %26, label %81
26: ; preds = %19
%27 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%28 = call i64 @get_new_powball(i32* %27)
store i64 %28, i64* %11
%29 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 0
%30 = call i32 @quick_sort(i32* %29, i32 0, i32 4)
store i32 0, i32* %6
br label %31
31: ; preds = %51, %26
%32 = load i32, i32* %6
%33 = icmp slt i32 %32, 5
br i1 %33, label %34, label %54
34: ; preds = %31
%35 = load i32, i32* %6
%36 = icmp ne i32 %35, 4
br i1 %36, label %37, label %50
37: ; preds = %34
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = sub nsw i32 %42, %46
%48 = load i32, i32* %9
%49 = add nsw i32 %48, %47
store i32 %49, i32* %9
br label %50
50: ; preds = %37, %34
br label %51
51: ; preds = %50
%52 = load i32, i32* %6
%53 = add nsw i32 %52, 1
store i32 %53, i32* %6
br label %31
54: ; preds = %31
%55 = load i32, i32* %9
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [80 x i32], [80 x i32]* %10, i64 0, i64 %56
%58 = load i32, i32* %57
%59 = add nsw i32 %58, 1
store i32 %59, i32* %57
store i32 0, i32* %6
br label %60
60: ; preds = %69, %54
%61 = load i32, i32* %6
%62 = icmp slt i32 %61, 5
br i1 %62, label %63, label %72
63: ; preds = %60
%64 = load i32, i32* %6
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds [6 x i32], [6 x i32]* %7, i64 0, i64 %65
%67 = load i32, i32* %66
%68 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %63
%70 = load i32, i32* %6
%71 = add nsw i32 %70, 1
store i32 %71, i32* %6
br label %60
72: ; preds = %60
%73 = load i64, i64* %11
%74 = trunc i64 %73 to i32
%75 = urem i32 %74, 35
%76 = add i32 %75, 1
%77 = load i32, i32* %9
%78 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %76, i32 %77)
store i32 0, i32* %9
%79 = load i32, i32* %8
%80 = add nsw i32 %79, 1
store i32 %80, i32* %8
br label %19
81: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%2i \00"
@.str.1 = [14 x i8] c" %2i %2i\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [6 x i32]
%4 = alloca [80 x i32]
%5 = bitcast [6 x i32]* %3 to i8*
%6 = bitcast [80 x i32]* %4 to i8*
%7 = icmp slt i32 %0, 2
br i1 %7, label %23, label %8
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %63
13: ; preds = %8
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 1
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 2
%17 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 3
%18 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 4
%19 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 1
%20 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 2
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 3
%22 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 4
br label %25
23: ; preds = %2
%24 = tail call i32 @exit(i32 -1)
unreachable
25: ; preds = %25, %13
%26 = phi i32 [ 0, %13 ], [ %59, %25 ]
%27 = call i64 @get_new_powball(i32* %14)
%28 = call i32 @quick_sort(i32* %14, i32 0, i32 4)
%29 = load i32, i32* %15
%30 = load i32, i32* %14
%31 = load i32, i32* %16
%32 = add i32 %29, %31
%33 = add i32 %30, %29
%34 = load i32, i32* %17
%35 = add i32 %32, %34
%36 = add i32 %33, %31
%37 = load i32, i32* %18
%38 = add i32 %35, %37
%39 = add i32 %36, %34
%40 = sub i32 %38, %39
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [80 x i32], [80 x i32]* %4, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = add nsw i32 %43, 1
store i32 %44, i32* %42
%45 = load i32, i32* %14
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %45)
%47 = load i32, i32* %19
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %20
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %49)
%51 = load i32, i32* %21
%52 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %22
%54 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %53)
%55 = trunc i64 %27 to i32
%56 = urem i32 %55, 35
%57 = add nuw nsw i32 %56, 1
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %57, i32 %40)
%59 = add nuw nsw i32 %26, 1
%60 = load i8*, i8** %9
%61 = call i32 @atoi(i8* %60)
%62 = icmp slt i32 %59, %61
br i1 %62, label %25, label %63
63: ; preds = %25, %8
ret i32 0
}