#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*/ printf(char *, int);
int rand();
void setup(int b[][8 + 2], char hint[]) {
  int x, y, c;
  for (x = 0; x < 8 + 2; x++)
    for (y = 0; y < 8 + 2; y++)
      b[x][y] = 0;
  for (c = 0; c < 4; c++) {
    while (b[x = (rand() % (8) + 1)][y = (rand() % (8) + 1)])
      ;
    b[x][y] = 1;
  }
  printf("%d atoms hidden.\n", 4);
  for (c = 0; c < 8 * 4; c++)
    hint[c] = ' ';
}


x86 assembly (clang, -O0):
<setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    118d <setup+0x6d>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    117a <setup+0x5a>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1148 <setup+0x28>
jmp    117f <setup+0x5f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1137 <setup+0x17>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jge    1225 <setup+0x105>
jmp    11a3 <setup+0x83>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %edx,%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <rand@plt>
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%rax
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %edx,%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     11fd <setup+0xdd>
jmp    11a3 <setup+0x83>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x28,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1194 <setup+0x74>
lea    0xdd4(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x20,-0x1c(%rbp)
jge    1261 <setup+0x141>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    123d <setup+0x11d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0x190,%edx
xor    %esi,%esi
call   1040 <memset@plt>
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
movslq %eax,%rbx
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
cltq
lea    (%rbx,%rbx,4),%rcx
lea    (%r15,%rcx,8),%rcx
cmpl   $0x0,0x4(%rcx,%rax,4)
jne    1150 <setup+0x20>
lea    (%rcx,%rax,4),%rax
add    $0x4,%rax
movl   $0x1,(%rax)
nop
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
movslq %eax,%rbx
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
cltq
lea    (%rbx,%rbx,4),%rcx
lea    (%r15,%rcx,8),%rcx
cmpl   $0x0,0x4(%rcx,%rax,4)
jne    11a0 <setup+0x70>
lea    (%rcx,%rax,4),%rax
add    $0x4,%rax
movl   $0x1,(%rax)
nop
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
movslq %eax,%rbx
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
cltq
lea    (%rbx,%rbx,4),%rcx
lea    (%r15,%rcx,8),%rcx
cmpl   $0x0,0x4(%rcx,%rax,4)
jne    11f0 <setup+0xc0>
lea    (%rcx,%rax,4),%rax
add    $0x4,%rax
movl   $0x1,(%rax)
nop
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
movslq %eax,%rbx
xor    %eax,%eax
call   1050 <rand@plt>
lea    0x7(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
cltq
lea    (%rbx,%rbx,4),%rcx
lea    (%r15,%rcx,8),%rcx
cmpl   $0x0,0x4(%rcx,%rax,4)
jne    1240 <setup+0x110>
lea    (%rcx,%rax,4),%rax
add    $0x4,%rax
movl   $0x1,(%rax)
lea    0xd7a(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
movaps 0xd59(%rip),%xmm0
movups %xmm0,(%r14)
movups %xmm0,0x10(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [18 x i8] c"%d atoms hidden.\0A\00"
define void @setup([10 x i32]* nocapture %0, i8* nocapture writeonly %1) {
%3 = bitcast [10 x i32]* %0 to i8*
br label %4
4: ; preds = %2, %4
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 8
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 8
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %8, i64 %12
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %4
store i32 1, i32* %13
br label %17
17: ; preds = %17, %16
%18 = tail call i32 (...) @rand()
%19 = srem i32 %18, 8
%20 = add nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = tail call i32 (...) @rand()
%23 = srem i32 %22, 8
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %21, i64 %25
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %17
29: ; preds = %17
store i32 1, i32* %26
br label %30
30: ; preds = %30, %29
%31 = tail call i32 (...) @rand()
%32 = srem i32 %31, 8
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = tail call i32 (...) @rand()
%36 = srem i32 %35, 8
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %34, i64 %38
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %30
42: ; preds = %30
store i32 1, i32* %39
br label %43
43: ; preds = %43, %42
%44 = tail call i32 (...) @rand()
%45 = srem i32 %44, 8
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = tail call i32 (...) @rand()
%49 = srem i32 %48, 8
%50 = add nsw i32 %49, 1
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [10 x i32], [10 x i32]* %0, i64 %47, i64 %51
%53 = load i32, i32* %52
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %43
55: ; preds = %43
store i32 1, i32* %52
%56 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}