#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 */
char *basename(char *);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ pascal_at(long, long);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
long strtol(char *, char **, int);
int main(int argc, char *argv[]) {
  long row, col;
  int i;
  long *ip[2];
  char *ep;
  if (argc != 3) {
    fprintf(stderr, "usage: %s ROW COLUMN\n", basename(argv[0]));
    exit(1);
  }
  ip[0] = &row;
  ip[1] = &col;
  for (i = 0; i < 2; ++i) {
    *ip[i] = strtol(argv[i + 1], &ep, 10);
    if (errno || *ep) {
      fprintf(stderr, "%s: row and column must be integers.\n",
              basename(argv[0]));
      exit(2);
    }
  }
  if ((row < 1) || (col < 1)) {
    fprintf(stderr, "%s: row and column must be greater than 0\n",
            basename(argv[0]));
    exit(2);
  } else if (col > row) {
    fprintf(stderr, "%s: column cannot be greater than row\n",
            basename(argv[0]));
    exit(2);
  }
  printf("%ld\n", pascal_at(row, col));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     11b4 <main+0x54>
mov    0x2e59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <basename@plt>
mov    -0x4c(%rbp),%edi
mov    %rax,%rdx
lea    0xe5b(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x2,-0x24(%rbp)
jge    126b <main+0x10b>
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x48(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    %rcx,(%rax)
mov    0x2dce(%rip),%rax
cmpq   $0x0,(%rax)
jne    1224 <main+0xc4>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1258 <main+0xf8>
mov    0x2db5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <basename@plt>
mov    -0x50(%rbp),%edi
mov    %rax,%rdx
lea    0xdcd(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>
jmp    125d <main+0xfd>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11cb <main+0x6b>
cmpq   $0x1,-0x18(%rbp)
jl     1281 <main+0x121>
cmpq   $0x1,-0x20(%rbp)
jge    12b5 <main+0x155>
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <basename@plt>
mov    -0x54(%rbp),%edi
mov    %rax,%rdx
lea    0xd96(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    12f7 <main+0x197>
mov    0x2d16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <basename@plt>
mov    -0x58(%rbp),%edi
mov    %rax,%rdx
lea    0xd7f(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>
jmp    12fc <main+0x19c>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <pascal_at@plt>
mov    %eax,%esi
lea    0xd7c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jne    1217 <main+0xb7>
mov    0x8(%r14),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    0x2e49(%rip),%r15
cmpq   $0x0,(%r15)
jne    11fd <main+0x9d>
mov    %rax,%rbx
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
jne    11fd <main+0x9d>
mov    0x10(%r14),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
cmpq   $0x0,(%r15)
jne    11fd <main+0x9d>
mov    0x8(%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    11fd <main+0x9d>
test   %rbx,%rbx
jle    1243 <main+0xe3>
test   %rax,%rax
jle    1243 <main+0xe3>
cmp    %rbx,%rax
ja     125d <main+0xfd>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <pascal_at@plt>
lea    0xea4(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2ddc(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rdi
call   1060 <basename@plt>
lea    0xe01(%rip),%rsi
jmp    1275 <main+0x115>
mov    0x2dc2(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rdi
call   1060 <basename@plt>
lea    0xdd1(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    0x2d96(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rdi
call   1060 <basename@plt>
lea    0xde1(%rip),%rsi
jmp    1275 <main+0x115>
mov    0x2d7c(%rip),%rax
mov    (%rax),%ebx
mov    (%r14),%rdi
call   1060 <basename@plt>
lea    0xdf2(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1050 <fprintf@plt>
mov    $0x2,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"usage: %s ROW COLUMN\0A\00"
@errno = global i64 0
@.str.1 = [38 x i8] c"%s: row and column must be integers.\0A\00"
@.str.2 = [43 x i8] c"%s: row and column must be greater than 0\0A\00"
@.str.3 = [39 x i8] c"%s: column cannot be greater than row\0A\00"
@.str.4 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
%9 = alloca [2 x i64*]
%10 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 3
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i8* @basename(i8* %17)
%19 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = getelementptr inbounds [2 x i64*], [2 x i64*]* %9, i64 0, i64 0
store i64* %6, i64** %22
%23 = getelementptr inbounds [2 x i64*], [2 x i64*]* %9, i64 0, i64 1
store i64* %7, i64** %23
store i32 0, i32* %8
br label %24
24: ; preds = %55, %21
%25 = load i32, i32* %8
%26 = icmp slt i32 %25, 2
br i1 %26, label %27, label %58
27: ; preds = %24
%28 = load i8**, i8*** %5
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %28, i64 %31
%33 = load i8*, i8** %32
%34 = call i64 @strtol(i8* %33, i8** %10, i32 10)
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [2 x i64*], [2 x i64*]* %9, i64 0, i64 %36
%38 = load i64*, i64** %37
store i64 %34, i64* %38
%39 = load i64, i64* @errno
%40 = icmp ne i64 %39, 0
br i1 %40, label %46, label %41
41: ; preds = %27
%42 = load i8*, i8** %10
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %54
46: ; preds = %41, %27
%47 = load i32, i32* @stderr
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 0
%50 = load i8*, i8** %49
%51 = call i8* @basename(i8* %50)
%52 = call i32 @fprintf(i32 %47, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %51)
%53 = call i32 @exit(i32 2)
unreachable
54: ; preds = %41
br label %55
55: ; preds = %54
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %24
58: ; preds = %24
%59 = load i64, i64* %6
%60 = icmp slt i64 %59, 1
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = load i64, i64* %7
%63 = icmp slt i64 %62, 1
br i1 %63, label %64, label %72
64: ; preds = %61, %58
%65 = load i32, i32* @stderr
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 0
%68 = load i8*, i8** %67
%69 = call i8* @basename(i8* %68)
%70 = call i32 @fprintf(i32 %65, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %69)
%71 = call i32 @exit(i32 2)
unreachable
72: ; preds = %61
%73 = load i64, i64* %7
%74 = load i64, i64* %6
%75 = icmp sgt i64 %73, %74
br i1 %75, label %76, label %84
76: ; preds = %72
%77 = load i32, i32* @stderr
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 0
%80 = load i8*, i8** %79
%81 = call i8* @basename(i8* %80)
%82 = call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %81)
%83 = call i32 @exit(i32 2)
unreachable
84: ; preds = %72
br label %85
85: ; preds = %84
%86 = load i64, i64* %6
%87 = load i64, i64* %7
%88 = call i32 @pascal_at(i64 %86, i64 %87)
%89 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %88)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"usage: %s ROW COLUMN\0A\00"
@errno = global i64 0
@.str.1 = [38 x i8] c"%s: row and column must be integers.\0A\00"
@.str.2 = [43 x i8] c"%s: row and column must be greater than 0\0A\00"
@.str.3 = [39 x i8] c"%s: column cannot be greater than row\0A\00"
@.str.4 = [5 x i8] c"%ld\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i32 %0, 3
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i8* @basename(i8* %8)
%10 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strtol(i8* %14, i8** %3, i32 10)
%16 = load i64, i64* @errno
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %32
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = call i64 @strtol(i8* %24, i8** %3, i32 10)
%26 = load i64, i64* @errno
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %22
%29 = load i8*, i8** %3
%30 = load i8, i8* %29
%31 = icmp eq i8 %30, 0
br i1 %31, label %38, label %32
32: ; preds = %28, %22, %18, %12
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %1
%35 = call i8* @basename(i8* %34)
%36 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = call i32 @exit(i32 2)
unreachable
38: ; preds = %28
%39 = icmp slt i64 %15, 1
%40 = icmp slt i64 %25, 1
%41 = select i1 %39, i1 true, i1 %40
br i1 %41, label %42, label %48
42: ; preds = %38
%43 = load i32, i32* @stderr
%44 = load i8*, i8** %1
%45 = call i8* @basename(i8* %44)
%46 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i8* %45)
%47 = call i32 @exit(i32 2)
unreachable
48: ; preds = %38
%49 = icmp ugt i64 %25, %15
br i1 %49, label %50, label %56
50: ; preds = %48
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %1
%53 = call i8* @basename(i8* %52)
%54 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %53)
%55 = call i32 @exit(i32 2)
unreachable
56: ; preds = %48
%57 = call i32 @pascal_at(i64 %15, i64 %25)
%58 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %57)
ret i32 0
}