#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*/ generate_blockbalanced_holes(int);
int /*<<< orphan*/ generate_doublybalanced_holes(int, int);
int /*<<< orphan*/ generate_fullybalanced_holes_region(int);
int /*<<< orphan*/ read_pls_in_squarecolor(char *);
int /*<<< orphan*/ srandom(unsigned long);
int /*<<< orphan*/ test_validity_squarecolor();
int /*<<< orphan*/ write_pls(char *);
void pokesudoku(char *infile, int numhole, int shuffles, unsigned long seed,
                char *plsname, int model) {
  srandom(seed);
  read_pls_in_squarecolor(infile);
  test_validity_squarecolor();
  switch (model) {
  case 1:
    generate_blockbalanced_holes(numhole);
    break;
  case 2:
    generate_doublybalanced_holes(numhole, shuffles);
    break;
  case 3:
    generate_fullybalanced_holes_region(numhole);
  }
  write_pls(plsname);
}


x86 assembly (clang, -O0):
<pokesudoku>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <srandom@plt>
mov    -0x8(%rbp),%rdi
call   1060 <read_pls_in_squarecolor@plt>
xor    %eax,%eax
call   1080 <test_validity_squarecolor@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x1,%eax
je     11dd <pokesudoku+0x6d>
jmp    11bb <pokesudoku+0x4b>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
je     11ea <pokesudoku+0x7a>
jmp    11cc <pokesudoku+0x5c>
mov    -0x28(%rbp),%eax
sub    $0x3,%eax
je     11fa <pokesudoku+0x8a>
jmp    1202 <pokesudoku+0x92>
mov    -0xc(%rbp),%edi
call   1040 <generate_blockbalanced_holes@plt>
jmp    1202 <pokesudoku+0x92>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1090 <generate_doublybalanced_holes@plt>
jmp    1202 <pokesudoku+0x92>
mov    -0xc(%rbp),%edi
call   1070 <generate_fullybalanced_holes_region@plt>
mov    -0x20(%rbp),%rdi
call   1050 <write_pls@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pokesudoku>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r9d,%ebx
mov    %r8,%r14
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%rbp
mov    %rcx,%rdi
call   1030 <srandom@plt>
mov    %rbp,%rdi
call   1060 <read_pls_in_squarecolor@plt>
xor    %eax,%eax
call   1080 <test_validity_squarecolor@plt>
cmp    $0x3,%ebx
je     11b7 <pokesudoku+0x47>
cmp    $0x2,%ebx
je     11c1 <pokesudoku+0x51>
cmp    $0x1,%ebx
jne    11cc <pokesudoku+0x5c>
mov    %r12d,%edi
call   1040 <generate_blockbalanced_holes@plt>
jmp    11cc <pokesudoku+0x5c>
mov    %r12d,%edi
call   1070 <generate_fullybalanced_holes_region@plt>
jmp    11cc <pokesudoku+0x5c>
mov    %r12d,%edi
mov    %r15d,%esi
call   1090 <generate_doublybalanced_holes@plt>
mov    %r14,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <write_pls@plt>

LLVM IR (-O0):
define void @pokesudoku(i8* %0, i32 %1, i32 %2, i64 %3, i8* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%13 = load i64, i64* %10
%14 = call i32 @srandom(i64 %13)
%15 = load i8*, i8** %7
%16 = call i32 @read_pls_in_squarecolor(i8* %15)
%17 = call i32 (...) @test_validity_squarecolor()
%18 = load i32, i32* %12
switch i32 %18, label %29 [
i32 1, label %19
i32 2, label %22
i32 3, label %26
]
19: ; preds = %6
%20 = load i32, i32* %8
%21 = call i32 @generate_blockbalanced_holes(i32 %20)
br label %29
22: ; preds = %6
%23 = load i32, i32* %8
%24 = load i32, i32* %9
%25 = call i32 @generate_doublybalanced_holes(i32 %23, i32 %24)
br label %29
26: ; preds = %6
%27 = load i32, i32* %8
%28 = call i32 @generate_fullybalanced_holes_region(i32 %27)
br label %29
29: ; preds = %26, %6, %22, %19
%30 = load i8*, i8** %11
%31 = call i32 @write_pls(i8* %30)
ret void
}

LLVM IR (-O2):
define void @pokesudoku(i8* %0, i32 %1, i32 %2, i64 %3, i8* %4, i32 %5) {
%7 = tail call i32 @srandom(i64 %3)
%8 = tail call i32 @read_pls_in_squarecolor(i8* %0)
%9 = tail call i32 (...) @test_validity_squarecolor()
switch i32 %5, label %16 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
]
10: ; preds = %6
%11 = tail call i32 @generate_blockbalanced_holes(i32 %1)
br label %16
12: ; preds = %6
%13 = tail call i32 @generate_doublybalanced_holes(i32 %1, i32 %2)
br label %16
14: ; preds = %6
%15 = tail call i32 @generate_fullybalanced_holes_region(i32 %1)
br label %16
16: ; preds = %14, %6, %12, %10
%17 = tail call i32 @write_pls(i8* %4)
ret void
}