#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_balanced_holes(int);
int /*<<< orphan*/ generate_random_holes(int);
int /*<<< orphan*/ read_pls_in_squarecolor(char *);
int /*<<< orphan*/ srandom(unsigned long);
int /*<<< orphan*/ test_validity_squarecolor();
int /*<<< orphan*/ write_pls(char *);
void poke(char *infile, int numhole, unsigned long seed, char *plsname,
          int model) {
  srandom(seed);
  read_pls_in_squarecolor(infile);
  test_validity_squarecolor();
  switch (model) {
  case 0:
    generate_random_holes(numhole);
    break;
  case 1:
    generate_balanced_holes(numhole);
  }
  write_pls(plsname);
}


x86 assembly (clang, -O0):
<poke>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-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)
test   %eax,%eax
je     11b8 <poke+0x58>
jmp    11a7 <poke+0x47>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
je     11c5 <poke+0x65>
jmp    11cd <poke+0x6d>
mov    -0xc(%rbp),%edi
call   1070 <generate_random_holes@plt>
jmp    11cd <poke+0x6d>
mov    -0xc(%rbp),%edi
call   1040 <generate_balanced_holes@plt>
mov    -0x20(%rbp),%rdi
call   1050 <write_pls@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poke>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %rcx,%r14
mov    %esi,%r15d
mov    %rdi,%rbp
mov    %rdx,%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    $0x1,%ebx
je     119d <poke+0x3d>
test   %ebx,%ebx
jne    11a5 <poke+0x45>
mov    %r15d,%edi
call   1070 <generate_random_holes@plt>
jmp    11a5 <poke+0x45>
mov    %r15d,%edi
call   1040 <generate_balanced_holes@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <write_pls@plt>

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

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