#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*/ printToFile(char const **, int *, int, int, char **);
int rand();
int readRules(char **);
int /*<<< orphan*/ reset(int *, int *, int *, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char const *argv[]) {
  int people = argc - 2;
  int randn;
  int list[people];
  int i;
  int success;
  reset(list, &success, &i, people);
  srand(time(NULL));
  success = 1;
  for (i = 0; i < people; i++) {
    randn = rand() % people;
    for (int j = 0; j < people; j++) {
      if (list[j] == randn) {
        reset(list, &success, &i, people);
      }
    }
    if (randn == i) {
      reset(list, &success, &i, people);
    } else {
      success = 1;
    }
    if (success == 1) {
      list[i] = randn;
    }
  }
  char rules[62][450];
  int numLines = readRules(rules);
  printToFile(argv, list, people, numLines, rules);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x6d40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x6d40(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%ecx
lea    -0x30(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   1070 <reset@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12a5 <main+0x145>
mov    $0x0,%al
call   1080 <rand@plt>
cltd
idivl  -0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1248 <main+0xe8>
mov    -0x6d40(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x18(%rbp),%eax
jne    1235 <main+0xd5>
mov    -0x6d40(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    -0x30(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   1070 <reset@plt>
jmp    123a <main+0xda>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11fb <main+0x9b>
mov    -0x18(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jne    1270 <main+0x110>
mov    -0x6d40(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    -0x30(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
call   1070 <reset@plt>
jmp    1277 <main+0x117>
movl   $0x1,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jne    1292 <main+0x132>
mov    -0x6d40(%rbp),%rax
mov    -0x18(%rbp),%edx
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1297 <main+0x137>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11da <main+0x7a>
lea    -0x6d30(%rbp),%rdi
call   1030 <readRules@plt>
mov    -0x6d40(%rbp),%rsi
mov    %eax,-0x6d34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x6d34(%rbp),%ecx
lea    -0x6d30(%rbp),%r8
call   1040 <printToFile@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x6d18,%rsp
mov    %rsi,-0x38(%rbp)
mov    %edi,%r14d
lea    -0x2(%r14),%r15d
mov    %rsp,%rbx
lea    0xf(,%r15,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    -0x2c(%rbp),%rsi
lea    -0x30(%rbp),%rdx
mov    %rbx,%rdi
mov    %r15d,%ecx
call   1070 <reset@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x1,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
cmp    $0x3,%r14d
jl     1265 <main+0x105>
lea    -0x30(%rbp),%r13
jmp    11f9 <main+0x99>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movl   $0x1,-0x2c(%rbp)
movslq %eax,%rcx
mov    %r14d,(%rbx,%rcx,4)
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmp    %r15d,%eax
jge    1265 <main+0x105>
xor    %eax,%eax
call   1080 <rand@plt>
cltd
idiv   %r15d
mov    %edx,%r14d
xor    %r12d,%r12d
jmp    1219 <main+0xb9>
nopl   0x0(%rax)
add    $0x1,%r12
cmp    %r12,%r15
je     1240 <main+0xe0>
cmp    %r14d,(%rbx,%r12,4)
jne    1210 <main+0xb0>
mov    %rbx,%rdi
lea    -0x2c(%rbp),%rsi
mov    %r13,%rdx
mov    %r15d,%ecx
call   1070 <reset@plt>
jmp    1210 <main+0xb0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    -0x30(%rbp),%eax
cmp    %eax,%r14d
jne    11e0 <main+0x80>
mov    %rbx,%rdi
lea    -0x2c(%rbp),%rsi
mov    %r13,%rdx
mov    %r15d,%ecx
call   1070 <reset@plt>
cmpl   $0x1,-0x2c(%rbp)
mov    -0x30(%rbp),%eax
je     11e7 <main+0x87>
jmp    11ee <main+0x8e>
lea    -0x6d40(%rbp),%r14
mov    %r14,%rdi
call   1030 <readRules@plt>
mov    -0x38(%rbp),%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %eax,%ecx
mov    %r14,%r8
call   1040 <printToFile@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [62 x [450 x i8]]
%6 = add nsw i32 %0, -2
%7 = zext i32 %6 to i64
%8 = alloca i32, i64 %7
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = call i32 @reset(i32* %8, i32* %4, i32* %3, i32 %6)
%12 = call i32 @time(i32* null)
%13 = call i32 @srand(i32 %12)
store i32 1, i32* %4
store i32 0, i32* %3
%14 = icmp sgt i32 %0, 2
br i1 %14, label %15, label %45
15: ; preds = %2, %41
%16 = call i32 (...) @rand()
%17 = srem i32 %16, %6
br label %21
18: ; preds = %28
%19 = load i32, i32* %3
%20 = icmp eq i32 %17, %19
br i1 %20, label %32, label %31
21: ; preds = %15, %28
%22 = phi i64 [ 0, %15 ], [ %29, %28 ]
%23 = getelementptr inbounds i32, i32* %8, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, %17
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = call i32 @reset(i32* %8, i32* %4, i32* %3, i32 %6)
br label %28
28: ; preds = %21, %26
%29 = add nuw nsw i64 %22, 1
%30 = icmp eq i64 %29, %7
br i1 %30, label %18, label %21
31: ; preds = %18
store i32 1, i32* %4
br label %37
32: ; preds = %18
%33 = call i32 @reset(i32* %8, i32* %4, i32* %3, i32 %6)
%34 = load i32, i32* %4
%35 = icmp eq i32 %34, 1
%36 = load i32, i32* %3
br i1 %35, label %37, label %41
37: ; preds = %32, %31
%38 = phi i32 [ %19, %31 ], [ %36, %32 ]
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %8, i64 %39
store i32 %17, i32* %40
br label %41
41: ; preds = %32, %37
%42 = phi i32 [ %38, %37 ], [ %36, %32 ]
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
%44 = icmp slt i32 %43, %6
br i1 %44, label %15, label %45
45: ; preds = %41, %2
%46 = getelementptr inbounds [62 x [450 x i8]], [62 x [450 x i8]]* %5, i64 0, i64 0, i64 0
%47 = bitcast [62 x [450 x i8]]* %5 to i8**
%48 = call i32 @readRules(i8** %47)
%49 = call i32 @printToFile(i8** %1, i32* %8, i32 %6, i32 %48, i8** %47)
ret i32 0
}