#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*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ gen_consts(int, int, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  int nail_bits, limb_bits, numb_bits;
  if (argc != 3) {
    fprintf(stderr, "Usage: gen-fac_ui limbbits nailbits\n");
    exit(1);
  }
  limb_bits = atoi(argv[1]);
  nail_bits = atoi(argv[2]);
  numb_bits = limb_bits - nail_bits;
  if (limb_bits < 0 || nail_bits < 0 || numb_bits < 0) {
    fprintf(stderr, "Invalid limb/nail bits %d,%d\n", limb_bits, nail_bits);
    exit(1);
  }
  gen_consts(numb_bits, nail_bits, limb_bits);
  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)
je     1181 <main+0x41>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     11c8 <main+0x88>
cmpl   $0x0,-0x14(%rbp)
jl     11c8 <main+0x88>
cmpl   $0x0,-0x1c(%rbp)
jge    11ef <main+0xaf>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe47(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <gen_consts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    117f <main+0x3f>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
test   %ebp,%ebp
js     11a0 <main+0x60>
test   %eax,%eax
js     11a0 <main+0x60>
mov    %ebp,%edi
sub    %eax,%edi
js     11a0 <main+0x60>
mov    %eax,%esi
mov    %ebp,%edx
call   1040 <gen_consts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
lea    0xe71(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2e39(%rip),%rcx
mov    (%rcx),%edi
lea    0xe75(%rip),%rsi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: gen-fac_ui limbbits nailbits\0A\00"
@.str.1 = [30 x i8] c"Invalid limb/nail bits %d,%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %7
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %6
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = sub nsw i32 %24, %25
store i32 %26, i32* %8
%27 = load i32, i32* %7
%28 = icmp slt i32 %27, 0
br i1 %28, label %35, label %29
29: ; preds = %15
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = load i32, i32* %8
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %41
35: ; preds = %32, %29, %15
%36 = load i32, i32* @stderr
%37 = load i32, i32* %7
%38 = load i32, i32* %6
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %32
%42 = load i32, i32* %8
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = call i32 @gen_consts(i32 %42, i32 %43, i32 %44)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: gen-fac_ui limbbits nailbits\0A\00"
@.str.1 = [30 x i8] c"Invalid limb/nail bits %d,%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%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 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = sub nsw i32 %11, %14
%16 = icmp slt i32 %11, 0
%17 = icmp slt i32 %14, 0
%18 = select i1 %16, i1 true, i1 %17
%19 = icmp slt i32 %15, 0
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %21, label %25
21: ; preds = %8
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %14)
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %8
%26 = tail call i32 @gen_consts(i32 %15, i32 %14, i32 %11)
ret i32 0
}