#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*/ print_board(int *);
int rand();
int /*<<< orphan*/ randomize();
int recursive_iterate(int *);
int main(int argc, char *argv[]) {
  int board[81] = {0};
  randomize();
  for (int i = 1; i < 10; i++) {
    int val;
    do {
      val = (rand() % 9);
    } while (board[val] != 0);
    board[val] = i;
  }
  print_board(board);
  int result = recursive_iterate(board);
  print_board(board);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x160(%rbp),%rdi
xor    %esi,%esi
mov    $0x144,%edx
call   1040 <memset@plt>
mov    $0x0,%al
call   1060 <randomize@plt>
movl   $0x1,-0x164(%rbp)
cmpl   $0xa,-0x164(%rbp)
jge    11f1 <main+0xa1>
jmp    119f <main+0x4f>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    %edx,-0x168(%rbp)
movslq -0x168(%rbp),%rax
cmpl   $0x0,-0x160(%rbp,%rax,4)
jne    119f <main+0x4f>
mov    -0x164(%rbp),%ecx
movslq -0x168(%rbp),%rax
mov    %ecx,-0x160(%rbp,%rax,4)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    118d <main+0x3d>
lea    -0x160(%rbp),%rdi
call   1030 <print_board@plt>
lea    -0x160(%rbp),%rdi
call   1050 <recursive_iterate@plt>
mov    %eax,-0x16c(%rbp)
lea    -0x160(%rbp),%rdi
call   1030 <print_board@plt>
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x150,%rsp
mov    %rsp,%rdi
mov    $0x144,%edx
xor    %esi,%esi
call   1040 <memset@plt>
xor    %eax,%eax
call   1060 <randomize@plt>
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    1170 <main+0x20>
movl   $0x1,(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    11b0 <main+0x60>
movl   $0x2,(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    11f0 <main+0xa0>
movl   $0x3,(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    1230 <main+0xe0>
movl   $0x4,(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    1270 <main+0x120>
movl   $0x5,(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    12b0 <main+0x160>
movl   $0x6,(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    12f0 <main+0x1a0>
movl   $0x7,(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    1330 <main+0x1e0>
movl   $0x8,(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
sub    %ecx,%eax
cltq
cmpl   $0x0,(%rsp,%rax,4)
jne    1370 <main+0x220>
movl   $0x9,(%rsp,%rax,4)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <print_board@plt>
mov    %rbx,%rdi
call   1050 <recursive_iterate@plt>
mov    %rbx,%rdi
call   1030 <print_board@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [81 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [81 x i32]* %6 to i8*
%11 = call i32 (...) @randomize()
store i32 1, i32* %7
br label %12
12: ; preds = %30, %2
%13 = load i32, i32* %7
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %33
15: ; preds = %12
br label %16
16: ; preds = %19, %15
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 9
store i32 %18, i32* %8
br label %19
19: ; preds = %16
%20 = load i32, i32* %8
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 %21
%23 = load i32, i32* %22
%24 = icmp ne i32 %23, 0
br i1 %24, label %16, label %25
25: ; preds = %19
%26 = load i32, i32* %7
%27 = load i32, i32* %8
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 %28
store i32 %26, i32* %29
br label %30
30: ; preds = %25
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %12
33: ; preds = %12
%34 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 0
%35 = call i32 @print_board(i32* %34)
%36 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 0
%37 = call i32 @recursive_iterate(i32* %36)
store i32 %37, i32* %9
%38 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 0
%39 = call i32 @print_board(i32* %38)
%40 = load i32, i32* %3
ret i32 %40
}

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