#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 *);
scalar_t__ isdigit(char);
int /*<<< orphan*/ printf(char *, ...);
int checkInput(int argc, char *argv[]) {
  int arg1, arg2;
  if (argc != 3) {
    printf("%s\n", "Incorrect number of arguments.");
    return 0;
  }
  if (isdigit(*argv[1])) {
    arg1 = atoi(argv[1]);
    if (arg1 != 5) {
      printf("Number of cards has to be %d\n", 5);
      return 0;
    }
  } else {
    printf("Enter %d for number of cards\n", 5);
    return 0;
  }
  if (isdigit(*argv[2])) {
    arg2 = atoi(argv[2]);
    if (arg2 < 1 || arg2 > 4 * 13 / 5) {
      printf("Number of hands has to be between %d and %d\n", 1, 4 * 13 / 5);
      return 0;
    }
  } else {
    printf("%s\n", "Number of hands has to be a positive integer");
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<checkInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     116a <checkInput+0x3a>
lea    0xeb0(%rip),%rdi
lea    0xead(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1270 <checkInput+0x140>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11c2 <checkInput+0x92>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
je     11bd <checkInput+0x8d>
lea    0xe7e(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1270 <checkInput+0x140>
jmp    11e1 <checkInput+0xb1>
lea    0xe78(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1270 <checkInput+0x140>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1248 <checkInput+0x118>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jl     121f <checkInput+0xef>
cmpl   $0xa,-0x18(%rbp)
jle    1243 <checkInput+0x113>
lea    0xe39(%rip),%rdi
mov    $0x1,%esi
mov    $0xa,%edx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1270 <checkInput+0x140>
jmp    1269 <checkInput+0x139>
lea    0xdb1(%rip),%rdi
lea    0xe36(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1270 <checkInput+0x140>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkInput>:
push   %rbx
cmp    $0x3,%edi
jne    11ab <checkInput+0x6b>
mov    %rsi,%rbx
mov    0x8(%rsi),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     11bb <checkInput+0x7b>
mov    0x8(%rbx),%rdi
call   1060 <atoi@plt>
cmp    $0x5,%eax
jne    11c4 <checkInput+0x84>
mov    0x10(%rbx),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     11dd <checkInput+0x9d>
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
add    $0xfffffff5,%eax
mov    $0x1,%ebx
cmp    $0xfffffff5,%eax
ja     11d9 <checkInput+0x99>
lea    0xec5(%rip),%rdi
xor    %ebx,%ebx
mov    $0x1,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11d9 <checkInput+0x99>
lea    0xe4e(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
jmp    11d9 <checkInput+0x99>
lea    0xe7b(%rip),%rdi
jmp    11cb <checkInput+0x8b>
lea    0xe54(%rip),%rdi
xor    %ebx,%ebx
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xea4(%rip),%rdi
jmp    11b2 <checkInput+0x72>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [31 x i8] c"Incorrect number of arguments.\00"
@.str.2 = [30 x i8] c"Number of cards has to be %d\0A\00"
@.str.3 = [30 x i8] c"Enter %d for number of cards\0A\00"
@.str.4 = [45 x i8] c"Number of hands has to be between %d and %d\0A\00"
@.str.5 = [45 x i8] c"Number of hands has to be a positive integer\00"
define i32 @checkInput(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 3
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %54
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = call i64 @isdigit(i8 signext %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %29
19: ; preds = %12
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = icmp ne i32 %24, 5
br i1 %25, label %26, label %28
26: ; preds = %19
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 5)
store i32 0, i32* %3
br label %54
28: ; preds = %19
br label %31
29: ; preds = %12
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 5)
store i32 0, i32* %3
br label %54
31: ; preds = %28
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = load i8, i8* %34
%36 = call i64 @isdigit(i8 signext %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %51
38: ; preds = %31
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %7
%43 = load i32, i32* %7
%44 = icmp slt i32 %43, 1
br i1 %44, label %48, label %45
45: ; preds = %38
%46 = load i32, i32* %7
%47 = icmp sgt i32 %46, 10
br i1 %47, label %48, label %50
48: ; preds = %45, %38
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 10)
store i32 0, i32* %3
br label %54
50: ; preds = %45
br label %53
51: ; preds = %31
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %54
53: ; preds = %50
store i32 1, i32* %3
br label %54
54: ; preds = %53, %51, %48, %29, %26, %10
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str.1 = [31 x i8] c"Incorrect number of arguments.\00"
@.str.2 = [30 x i8] c"Number of cards has to be %d\0A\00"
@.str.3 = [30 x i8] c"Enter %d for number of cards\0A\00"
@.str.4 = [45 x i8] c"Number of hands has to be between %d and %d\0A\00"
@.str.5 = [45 x i8] c"Number of hands has to be a positive integer\00"
define i32 @checkInput(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
br label %35
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = load i8, i8* %8
%10 = tail call i64 @isdigit(i8 signext %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %6
%13 = load i8*, i8** %7
%14 = tail call i32 @atoi(i8* %13)
%15 = icmp eq i32 %14, 5
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i32 5)
br label %35
18: ; preds = %6
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 5)
br label %35
20: ; preds = %12
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = load i8, i8* %22
%24 = tail call i64 @isdigit(i8 signext %23)
%25 = icmp eq i64 %24, 0
br i1 %25, label %33, label %26
26: ; preds = %20
%27 = load i8*, i8** %21
%28 = tail call i32 @atoi(i8* %27)
%29 = add i32 %28, -11
%30 = icmp ult i32 %29, -10
br i1 %30, label %31, label %35
31: ; preds = %26
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 10)
br label %35
33: ; preds = %20
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0))
br label %35
35: ; preds = %26, %33, %31, %18, %16, %4
%36 = phi i32 [ 0, %4 ], [ 0, %16 ], [ 0, %31 ], [ 0, %33 ], [ 0, %18 ], [ 1, %26 ]
ret i32 %36
}