#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 atoi(char *);
int /*<<< orphan*/ complete_arrangement(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int object_count;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s object_count\n", argv[0]);
    exit(1);
  }
  object_count = atoi(argv[1]);
  if (object_count < 3) {
    fprintf(stderr, "Error: object count of %d is less than 3.\n",
            object_count);
    exit(1);
  }
  if (object_count > 8) {
    fprintf(stderr, "Error: object count of %d exceeds %d.\n", object_count, 8);
    exit(1);
  }
  complete_arrangement(object_count);
  return 0;
}


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   $0x2,-0x8(%rbp)
je     1188 <main+0x48>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe89(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    11c6 <main+0x86>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
cmpl   $0x8,-0x14(%rbp)
jle    11f9 <main+0xb9>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
lea    0xe60(%rip),%rsi
mov    $0x8,%ecx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x14(%rbp),%edi
call   1030 <complete_arrangement@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1164 <main+0x24>
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
cmp    $0x2,%eax
jle    1188 <main+0x48>
cmp    $0x9,%eax
jae    11ab <main+0x6b>
mov    %eax,%edi
call   1030 <complete_arrangement@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xe89(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2e51(%rip),%rcx
mov    (%rcx),%edi
lea    0xe80(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2e2e(%rip),%rcx
mov    (%rcx),%edi
lea    0xe88(%rip),%rsi
mov    %eax,%edx
mov    $0x8,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: %s object_count\0A\00"
@.str.1 = [43 x i8] c"Error: object count of %d is less than 3.\0A\00"
@.str.2 = [39 x i8] c"Error: object count of %d exceeds %d.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 3
br i1 %22, label %23, label %28
23: ; preds = %16
%24 = load i32, i32* @stderr
%25 = load i32, i32* %6
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %16
%29 = load i32, i32* %6
%30 = icmp sgt i32 %29, 8
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* @stderr
%33 = load i32, i32* %6
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 8)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %28
%37 = load i32, i32* %6
%38 = call i32 @complete_arrangement(i32 %37)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Usage: %s object_count\0A\00"
@.str.1 = [43 x i8] c"Error: object count of %d is less than 3.\0A\00"
@.str.2 = [39 x i8] c"Error: object count of %d exceeds %d.\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = icmp slt i32 %12, 3
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%17 = tail call i32 @exit(i32 1)
unreachable
18: ; preds = %9
%19 = icmp ugt i32 %12, 8
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 8)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %18
%25 = tail call i32 @complete_arrangement(i32 %12)
ret i32 0
}