#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 */
struct sudoku {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ load_puzzle(int, int /*<<< orphan*/ *, struct sudoku *);
struct sudoku *new_sudoku();
int /*<<< orphan*/ print_puzzle(int, char *, struct sudoku *);
int /*<<< orphan*/ sudoku_free(struct sudoku *);
int /*<<< orphan*/ sudoku_solve(struct sudoku *, int /*<<< orphan*/ *);
int main(void) {
  FILE *fs;
  int id;
  struct sudoku *S;
  char label[100];
  fs = fopen("sudoku.txt", "r");
  if (fs == NULL)
    exit(EXIT_FAILURE);
  for (id = 1; id <= 50; ++id) {
    S = new_sudoku();
    load_puzzle(id, fs, S);
    print_puzzle(id, "loaded", S);
    sudoku_solve(S, NULL);
    print_puzzle(id, "after solve", S);
    sudoku_free(S);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
lea    0xe7b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b2 <main+0x42>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x32,-0x14(%rbp)
jg     1228 <main+0xb8>
mov    $0x0,%al
call   1090 <new_sudoku@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <load_puzzle@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    0xe21(%rip),%rsi
call   1050 <print_puzzle@plt>
mov    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1080 <sudoku_solve@plt>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    0xe08(%rip),%rsi
call   1050 <print_puzzle@plt>
mov    -0x20(%rbp),%rdi
call   1040 <sudoku_free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b9 <main+0x49>
mov    0x2da9(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
lea    0xe81(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1060 <fopen@plt>
test   %rax,%rax
jne    119e <main+0x2e>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    %rax,%r12
mov    $0x1,%ebp
lea    0xe60(%rip),%r14
lea    0xe60(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1090 <new_sudoku@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %r12,%rsi
mov    %rax,%rdx
call   1030 <load_puzzle@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <print_puzzle@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <sudoku_solve@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <print_puzzle@plt>
mov    %rbx,%rdi
call   1040 <sudoku_free@plt>
add    $0x1,%ebp
cmp    $0x33,%ebp
jne    11c0 <main+0x50>
mov    0x2dc6(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.sudoku = type { i32 }
@.str = [11 x i8] c"sudoku.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [7 x i8] c"loaded\00"
@.str.3 = [12 x i8] c"after solve\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca %struct.sudoku*
%5 = alloca [100 x i8]
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* @EXIT_FAILURE
%11 = call i32 @exit(i32 %10)
unreachable
12: ; preds = %0
store i32 1, i32* %3
br label %13
13: ; preds = %32, %12
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 50
br i1 %15, label %16, label %35
16: ; preds = %13
%17 = call %struct.sudoku* (...) @new_sudoku()
store %struct.sudoku* %17, %struct.sudoku** %4
%18 = load i32, i32* %3
%19 = load i32*, i32** %2
%20 = load %struct.sudoku*, %struct.sudoku** %4
%21 = call i32 @load_puzzle(i32 %18, i32* %19, %struct.sudoku* %20)
%22 = load i32, i32* %3
%23 = load %struct.sudoku*, %struct.sudoku** %4
%24 = call i32 @print_puzzle(i32 %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %struct.sudoku* %23)
%25 = load %struct.sudoku*, %struct.sudoku** %4
%26 = call i32 @sudoku_solve(%struct.sudoku* %25, i32* null)
%27 = load i32, i32* %3
%28 = load %struct.sudoku*, %struct.sudoku** %4
%29 = call i32 @print_puzzle(i32 %27, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %struct.sudoku* %28)
%30 = load %struct.sudoku*, %struct.sudoku** %4
%31 = call i32 @sudoku_free(%struct.sudoku* %30)
br label %32
32: ; preds = %16
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %13
35: ; preds = %13
%36 = load i32, i32* @EXIT_SUCCESS
%37 = call i32 @exit(i32 %36)
unreachable
}

LLVM IR (-O2):
%struct.sudoku = type { i32 }
@.str = [11 x i8] c"sudoku.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [7 x i8] c"loaded\00"
@.str.3 = [12 x i8] c"after solve\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
6: ; preds = %0, %6
%7 = phi i32 [ %14, %6 ], [ 1, %0 ]
%8 = tail call %struct.sudoku* (...) @new_sudoku()
%9 = tail call i32 @load_puzzle(i32 %7, i32* %1, %struct.sudoku* %8)
%10 = tail call i32 @print_puzzle(i32 %7, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), %struct.sudoku* %8)
%11 = tail call i32 @sudoku_solve(%struct.sudoku* %8, i32* null)
%12 = tail call i32 @print_puzzle(i32 %7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), %struct.sudoku* %8)
%13 = tail call i32 @sudoku_free(%struct.sudoku* %8)
%14 = add nuw nsw i32 %7, 1
%15 = icmp eq i32 %14, 51
br i1 %15, label %16, label %6
16: ; preds = %6
%17 = load i32, i32* @EXIT_SUCCESS
%18 = tail call i32 @exit(i32 %17)
unreachable
}