#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 chess_board {
  int dummy;
};

/* Variables and functions */
int EXIT_SUCCESS;
int atoi(char *);
struct chess_board *initialize_board(int);
int /*<<< orphan*/ place_next_queen(struct chess_board *);
int /*<<< orphan*/ smash_board(struct chess_board *);
int main(int argc, char *argv[]) {
  struct chess_board *board;
  if (argc == 1) {
    board = initialize_board(4);
  } else {
    board = initialize_board(atoi(argv[1]));
  }
  place_next_queen(board);
  smash_board(board);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1173 <main+0x33>
mov    $0x4,%edi
call   1030 <initialize_board@plt>
mov    %rax,-0x18(%rbp)
jmp    118b <main+0x4b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1030 <initialize_board@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <place_next_queen@plt>
mov    -0x18(%rbp),%rdi
call   1050 <smash_board@plt>
mov    0x2e3c(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %edi,%eax
mov    $0x4,%edi
cmp    $0x1,%eax
je     1158 <main+0x18>
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1030 <initialize_board@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <place_next_queen@plt>
mov    %rbx,%rdi
call   1050 <smash_board@plt>
mov    0x2e69(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.chess_board = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.chess_board*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call %struct.chess_board* @initialize_board(i32 4)
store %struct.chess_board* %10, %struct.chess_board** %6
br label %17
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
%16 = call %struct.chess_board* @initialize_board(i32 %15)
store %struct.chess_board* %16, %struct.chess_board** %6
br label %17
17: ; preds = %11, %9
%18 = load %struct.chess_board*, %struct.chess_board** %6
%19 = call i32 @place_next_queen(%struct.chess_board* %18)
%20 = load %struct.chess_board*, %struct.chess_board** %6
%21 = call i32 @smash_board(%struct.chess_board* %20)
%22 = load i32, i32* @EXIT_SUCCESS
ret i32 %22
}

LLVM IR (-O2):
%struct.chess_board = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 4, %2 ]
%10 = tail call %struct.chess_board* @initialize_board(i32 %9)
%11 = tail call i32 @place_next_queen(%struct.chess_board* %10)
%12 = tail call i32 @smash_board(%struct.chess_board* %10)
%13 = load i32, i32* @EXIT_SUCCESS
ret i32 %13
}