#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*/ exit(int);
int /*<<< orphan*/ find_code(int);
int /*<<< orphan*/ precompute_hd(int);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  if (argc < 3) {
    usage(argv[0]);
    exit(1);
  }
  int n, min_hd;
  if ((n = atoi(argv[1])) == 0 || (min_hd = atoi(argv[2])) == 0 || n > 16) {
    usage(argv[0]);
    exit(1);
  }
  precompute_hd(min_hd);
  find_code(n);
  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   $0x3,-0x8(%rbp)
jge    1186 <main+0x36>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     11c2 <main+0x72>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     11c2 <main+0x72>
cmpl   $0x10,-0x14(%rbp)
jle    11d8 <main+0x88>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x18(%rbp),%edi
call   1030 <precompute_hd@plt>
mov    -0x14(%rbp),%edi
call   1040 <find_code@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
jle    1193 <main+0x43>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
je     1193 <main+0x43>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
test   %eax,%eax
je     1193 <main+0x43>
cmp    $0x11,%ebp
jge    1193 <main+0x43>
mov    %eax,%edi
call   1030 <precompute_hd@plt>
mov    %ebp,%edi
call   1040 <find_code@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    (%rbx),%rdi
call   1050 <usage@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
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 slt i32 %8, 3
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @usage(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 = icmp eq i32 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %16
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %7
%27 = icmp eq i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %22
%29 = load i32, i32* %6
%30 = icmp sgt i32 %29, 16
br i1 %30, label %31, label %37
31: ; preds = %28, %22, %16
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 0
%34 = load i8*, i8** %33
%35 = call i32 @usage(i8* %34)
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %28
%38 = load i32, i32* %7
%39 = call i32 @precompute_hd(i32 %38)
%40 = load i32, i32* %6
%41 = call i32 @find_code(i32 %40)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8*, i8** %1, i64 2
%15 = load i8*, i8** %14
%16 = tail call i32 @atoi(i8* %15)
%17 = icmp eq i32 %16, 0
%18 = icmp sgt i32 %11, 16
%19 = select i1 %17, i1 true, i1 %18
br i1 %19, label %20, label %24
20: ; preds = %13, %8
%21 = load i8*, i8** %1
%22 = tail call i32 @usage(i8* %21)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %13
%25 = tail call i32 @precompute_hd(i32 %16)
%26 = tail call i32 @find_code(i32 %11)
ret i32 0
}