#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*/ printUsage(char *);
int sscanf(char *, char *, int *);
void checkInput(int argc, char *argv[]) {
  if (argc != 2) {
    printUsage(argv[0]);
  }
  int count;
  for (count = 1; count < 2; count++) {
    int value;
    if (sscanf(argv[count], "%d", &value) != 1) {
      printUsage(argv[0]);
    }
  }
  if (atoi(argv[1]) < 1 || atoi(argv[1]) > 50) {
    printUsage(argv[0]);
  }
}


x86 assembly (clang, -O0):
<checkInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1155 <checkInput+0x25>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <printUsage@plt>
movl   $0x1,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    11aa <checkInput+0x7a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe87(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
je     1197 <checkInput+0x67>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <printUsage@plt>
jmp    119c <checkInput+0x6c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115c <checkInput+0x2c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
cmp    $0x1,%eax
jl     11d6 <checkInput+0xa6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
cmp    $0x32,%eax
jle    11e2 <checkInput+0xb2>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <printUsage@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkInput>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1145 <checkInput+0x15>
mov    (%rbx),%rdi
call   1040 <printUsage@plt>
mov    0x8(%rbx),%rdi
lea    0xeb0(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1030 <sscanf@plt>
cmp    $0x1,%eax
je     1167 <checkInput+0x37>
mov    (%rbx),%rdi
call   1040 <printUsage@plt>
mov    0x8(%rbx),%rdi
call   1050 <atoi@plt>
add    $0xffffffcd,%eax
cmp    $0xffffffcd,%eax
ja     1180 <checkInput+0x50>
mov    (%rbx),%rdi
call   1040 <printUsage@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @checkInput(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @printUsage(i8* %12)
br label %14
14: ; preds = %9, %2
store i32 1, i32* %5
br label %15
15: ; preds = %32, %14
%16 = load i32, i32* %5
%17 = icmp slt i32 %16, 2
br i1 %17, label %18, label %35
18: ; preds = %15
%19 = load i8**, i8*** %4
%20 = load i32, i32* %5
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
%23 = load i8*, i8** %22
%24 = call i32 @sscanf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%25 = icmp ne i32 %24, 1
br i1 %25, label %26, label %31
26: ; preds = %18
%27 = load i8**, i8*** %4
%28 = getelementptr inbounds i8*, i8** %27, i64 0
%29 = load i8*, i8** %28
%30 = call i32 @printUsage(i8* %29)
br label %31
31: ; preds = %26, %18
br label %32
32: ; preds = %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %15
35: ; preds = %15
%36 = load i8**, i8*** %4
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i32 @atoi(i8* %38)
%40 = icmp slt i32 %39, 1
br i1 %40, label %47, label %41
41: ; preds = %35
%42 = load i8**, i8*** %4
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = call i32 @atoi(i8* %44)
%46 = icmp sgt i32 %45, 50
br i1 %46, label %47, label %52
47: ; preds = %41, %35
%48 = load i8**, i8*** %4
%49 = getelementptr inbounds i8*, i8** %48, i64 0
%50 = load i8*, i8** %49
%51 = call i32 @printUsage(i8* %50)
br label %52
52: ; preds = %47, %41
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @checkInput(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 @printUsage(i8* %6)
br label %8
8: ; preds = %5, %2
%9 = bitcast i32* %3 to i8*
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = icmp eq i32 %12, 1
br i1 %13, label %17, label %14
14: ; preds = %8
%15 = load i8*, i8** %1
%16 = call i32 @printUsage(i8* %15)
br label %17
17: ; preds = %14, %8
%18 = load i8*, i8** %10
%19 = call i32 @atoi(i8* %18)
%20 = add i32 %19, -51
%21 = icmp ult i32 %20, -50
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i8*, i8** %1
%24 = call i32 @printUsage(i8* %23)
br label %25
25: ; preds = %17, %22
ret void
}