#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 */
typedef int const uint32_t;

/* Variables and functions */
int EXIT_SUCCESS;
scalar_t__ atoi(char *);
int /*<<< orphan*/ initialize_board(int const);
int /*<<< orphan*/ place_next_queen(int const);
int /*<<< orphan*/ print_counts();
int /*<<< orphan*/ smash_board();
int main(int argc, char *argv[]) {
  static const uint32_t default_n = 4;
  const uint32_t n_queens = (argc != 1) ? (uint32_t)atoi(argv[1]) : default_n;
  initialize_board(n_queens);
  const uint32_t row_boundary = (n_queens >> 1) + (n_queens & 1);
  place_next_queen(row_boundary);
  print_counts();
  smash_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)
je     1185 <main+0x35>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1192 <main+0x42>
mov    $0x4,%eax
mov    %eax,-0x1c(%rbp)
jmp    1192 <main+0x42>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <initialize_board@plt>
mov    -0x14(%rbp),%eax
sar    $0x1,%eax
mov    -0x14(%rbp),%ecx
and    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <place_next_queen@plt>
mov    $0x0,%al
call   1030 <print_counts@plt>
mov    $0x0,%al
call   1060 <smash_board@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%ebx
cmp    $0x1,%edi
je     1167 <main+0x17>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %rax,%rbx
mov    %ebx,%edi
call   1040 <initialize_board@plt>
mov    %ebx,%eax
sar    %eax
and    $0x1,%ebx
add    %eax,%ebx
mov    %ebx,%edi
call   1050 <place_next_queen@plt>
xor    %eax,%eax
call   1030 <print_counts@plt>
xor    %eax,%eax
call   1060 <smash_board@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@main.default_n = internal constant i32 4
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 1
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @atoi(i8* %13)
%15 = trunc i64 %14 to i32
br label %17
16: ; preds = %2
br label %17
17: ; preds = %16, %10
%18 = phi i32 [ %15, %10 ], [ 4, %16 ]
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = call i32 @initialize_board(i32 %19)
%21 = load i32, i32* %6
%22 = ashr i32 %21, 1
%23 = load i32, i32* %6
%24 = and i32 %23, 1
%25 = add nsw i32 %22, %24
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = call i32 @place_next_queen(i32 %26)
%28 = call i32 (...) @print_counts()
%29 = call i32 (...) @smash_board()
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @atoi(i8* %6)
%8 = trunc i64 %7 to i32
br label %9
9: ; preds = %2, %4
%10 = phi i32 [ %8, %4 ], [ 4, %2 ]
%11 = tail call i32 @initialize_board(i32 %10)
%12 = ashr i32 %10, 1
%13 = and i32 %10, 1
%14 = add nsw i32 %12, %13
%15 = tail call i32 @place_next_queen(i32 %14)
%16 = tail call i32 (...) @print_counts()
%17 = tail call i32 (...) @smash_board()
%18 = load i32, i32* @EXIT_SUCCESS
ret i32 %18
}