#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 /*<<< orphan*/ printf(char *, ...);
int recursive_iterate(int *);
scalar_t__ simple_iterate(int *);
int main(int argc, char *argv[]) {
  int board[81] = {4, 2, 0, 0, 7, 8, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 4,
                   0, 1, 3, 8, 9, 0, 0, 0, 0, 0, 3, 9, 0, 0, 4, 5, 0,
                   0, 7, 0, 0, 0, 0, 9, 0, 0, 0, 0, 7, 0, 0, 3, 1, 0,
                   0, 5, 9, 0, 0, 0, 0, 0, 3, 8, 6, 4, 0, 1, 0, 0, 0,
                   0, 0, 0, 0, 0, 4, 0, 7, 5, 0, 0, 9, 2};
  print_board(board);
  int iterate = 1;
  while (simple_iterate(board)) {
    printf("Iteration %d\n", iterate++);
  }
  print_board(board);
  printf("Starting recursive iterate...\n");
  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
lea    0xe89(%rip),%rsi
mov    $0x144,%edx
call   1050 <memcpy@plt>
lea    -0x160(%rbp),%rdi
call   1040 <print_board@plt>
movl   $0x1,-0x164(%rbp)
lea    -0x160(%rbp),%rdi
call   1070 <simple_iterate@plt>
cmp    $0x0,%rax
je     11d1 <main+0x81>
mov    -0x164(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
lea    0xf7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <main+0x47>
lea    -0x160(%rbp),%rdi
call   1040 <print_board@plt>
lea    0xf6e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x160(%rbp),%rdi
call   1060 <recursive_iterate@plt>
mov    %eax,-0x168(%rbp)
lea    -0x160(%rbp),%rdi
call   1040 <print_board@plt>
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x150,%rsp
lea    0xe8e(%rip),%rsi
mov    %rsp,%rbx
mov    $0x144,%edx
mov    %rbx,%rdi
call   1060 <memcpy@plt>
mov    %rbx,%rdi
call   1050 <print_board@plt>
mov    %rbx,%rdi
call   1080 <simple_iterate@plt>
test   %rax,%rax
je     11cc <main+0x6c>
mov    $0x1,%esi
lea    0xfa1(%rip),%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
lea    0x1(%rsi),%ebp
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1080 <simple_iterate@plt>
mov    %ebp,%esi
test   %rax,%rax
jne    11b0 <main+0x50>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <print_board@plt>
lea    0xf74(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1070 <recursive_iterate@plt>
mov    %rbx,%rdi
call   1050 <print_board@plt>
xor    %eax,%eax
add    $0x150,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.board = [81 x i32] [i32 4, i32 2, i32 0, i32 0, i32 7, i32 8, i32 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 4, i32 0, i32 1, i32 3, i32 8, i32 9, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 9, i32 0, i32 0, i32 4, i32 5, i32 0, i32 0, i32 7, i32 0, i32 0, i32 0, i32 0, i32 9, i32 0, i32 0, i32 0, i32 0, i32 7, i32 0, i32 0, i32 3, i32 1, i32 0, i32 0, i32 5, i32 9, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 8, i32 6, i32 4, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 4, i32 0, i32 7, i32 5, i32 0, i32 0, i32 9, i32 2]
@.str = [14 x i8] c"Iteration %d\0A\00"
@.str.1 = [31 x i8] c"Starting recursive iterate...\0A\00"
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [81 x i32]* %6 to i8*
%10 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 0
%11 = call i32 @print_board(i32* %10)
store i32 1, i32* %7
br label %12
12: ; preds = %16, %2
%13 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 0
%14 = call i64 @simple_iterate(i32* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %12
20: ; preds = %12
%21 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 0
%22 = call i32 @print_board(i32* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
%24 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 0
%25 = call i32 @recursive_iterate(i32* %24)
store i32 %25, i32* %8
%26 = getelementptr inbounds [81 x i32], [81 x i32]* %6, i64 0, i64 0
%27 = call i32 @print_board(i32* %26)
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@__const.main.board = [81 x i32] [i32 4, i32 2, i32 0, i32 0, i32 7, i32 8, i32 0, i32 3, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 4, i32 0, i32 1, i32 3, i32 8, i32 9, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 9, i32 0, i32 0, i32 4, i32 5, i32 0, i32 0, i32 7, i32 0, i32 0, i32 0, i32 0, i32 9, i32 0, i32 0, i32 0, i32 0, i32 7, i32 0, i32 0, i32 3, i32 1, i32 0, i32 0, i32 5, i32 9, i32 0, i32 0, i32 0, i32 0, i32 0, i32 3, i32 8, i32 6, i32 4, i32 0, i32 1, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 4, i32 0, i32 7, i32 5, i32 0, i32 0, i32 9, i32 2]
@.str = [14 x i8] c"Iteration %d\0A\00"
@str = [30 x i8] c"Starting recursive iterate...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [81 x i32]
%4 = bitcast [81 x i32]* %3 to i8*
%5 = getelementptr inbounds [81 x i32], [81 x i32]* %3, i64 0, i64 0
%6 = call i32 @print_board(i32* %5)
%7 = call i64 @simple_iterate(i32* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %2, %9
%10 = phi i32 [ %11, %9 ], [ 1, %2 ]
%11 = add nuw nsw i32 %10, 1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %10)
%13 = call i64 @simple_iterate(i32* %5)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %9
15: ; preds = %9, %2
%16 = call i32 @print_board(i32* %5)
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%18 = call i32 @recursive_iterate(i32* %5)
%19 = call i32 @print_board(i32* %5)
ret i32 0
}