#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 /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int isDigitArg(char *);
int /*<<< orphan*/ myATOI(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr,
            "%s Expected only 1 argument but instead received %d arguments \n",
            argv[0], argc - 1);
    exit(EXIT_FAILURE);
  } else {
    bool isDigit = isDigitArg(argv[1]);
    if (!isDigit) {
      printf("Argument requires only digits \n");
    } else if (isDigit) {
      myATOI(argv[1]);
    }
    printf("\n");
    exit(EXIT_SUCCESS);
  }
  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   $0x2,-0x8(%rbp)
je     11a0 <main+0x50>
mov    0x2e69(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
lea    0xe73(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e3f(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <isDigitArg@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11cb <main+0x7b>
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
jmp    11e7 <main+0x97>
cmpl   $0x0,-0x14(%rbp)
je     11e2 <main+0x92>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <myATOI@plt>
jmp    11e7 <main+0x97>
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jne    1184 <main+0x24>
mov    0x8(%rbx),%rdi
call   1080 <isDigitArg@plt>
test   %eax,%eax
jne    11af <main+0x4f>
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
jmp    11b8 <main+0x58>
mov    %edi,%ecx
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
add    $0xffffffff,%ecx
lea    0xe64(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e30(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    0x8(%rbx),%rdi
call   1060 <myATOI@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x2e07(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [64 x i8] c"%s Expected only 1 argument but instead received %d arguments \0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [32 x i8] c"Argument requires only digits \0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 1
%16 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %15)
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %2
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 @isDigitArg(i8* %22)
store i32 %23, i32* %6
%24 = load i32, i32* %6
%25 = icmp ne i32 %24, 0
br i1 %25, label %28, label %26
26: ; preds = %19
%27 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
br label %37
28: ; preds = %19
%29 = load i32, i32* %6
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @myATOI(i8* %34)
br label %36
36: ; preds = %31, %28
br label %37
37: ; preds = %36, %26
%38 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%39 = load i32, i32* @EXIT_SUCCESS
%40 = call i32 @exit(i32 %39)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [64 x i8] c"%s Expected only 1 argument but instead received %d arguments \0A\00"
@EXIT_FAILURE = global i32 0
@EXIT_SUCCESS = global i32 0
@str = [31 x i8] c"Argument requires only digits \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = add nsw i32 %0, -1
%8 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %6, i32 %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %2
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = tail call i32 @isDigitArg(i8* %13)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %21
18: ; preds = %11
%19 = load i8*, i8** %12
%20 = tail call i32 @myATOI(i8* %19)
br label %21
21: ; preds = %18, %16
%22 = tail call i32 @putchar(i32 10)
%23 = load i32, i32* @EXIT_SUCCESS
%24 = tail call i32 @exit(i32 %23)
unreachable
}