#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 */
scalar_t__ atoi(char *);
scalar_t__ isDecimalNumber(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int i = 0;
  int sum = 0;
  for (i = 1; i < argc; i++) {
    if (isDecimalNumber(argv[i])) {
      sum += atoi(argv[i]);
    } else {
      printf("Please Enter Valid Inputs.\n");
      return 0;
    }
  }
  printf("sum = %d\n", sum);
  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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d2 <main+0xa2>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <isDecimalNumber@plt>
cmp    $0x0,%rax
je     11a5 <main+0x75>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atoi@plt>
mov    %rax,%rcx
movslq -0x18(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x18(%rbp)
jmp    11bf <main+0x8f>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ea <main+0xba>
jmp    11c4 <main+0x94>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x2b>
mov    -0x18(%rbp),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebp,%ebp
cmp    $0x2,%edi
jl     1182 <main+0x42>
mov    %rsi,%r14
mov    %edi,%r15d
xor    %ebp,%ebp
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1050 <isDecimalNumber@plt>
test   %rax,%rax
je     1194 <main+0x54>
mov    (%r14,%rbx,8),%rdi
call   1060 <atoi@plt>
add    %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1160 <main+0x20>
lea    0xe77(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11a0 <main+0x60>
lea    0xe6f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Please Enter Valid Inputs.\0A\00"
@.str.1 = [10 x i8] c"sum = %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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 1, i32* %6
br label %8
8: ; preds = %34, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %37
12: ; preds = %8
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @isDecimalNumber(i8* %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %31
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i64 @atoi(i8* %25)
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = add nsw i64 %28, %26
%30 = trunc i64 %29 to i32
store i32 %30, i32* %7
br label %33
31: ; preds = %12
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %40
33: ; preds = %20
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %8
37: ; preds = %8
%38 = load i32, i32* %7
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %38)
store i32 0, i32* %3
br label %40
40: ; preds = %37, %31
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@.str.1 = [10 x i8] c"sum = %d\0A\00"
@str = [27 x i8] c"Please Enter Valid Inputs.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %22
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %13
%7 = phi i64 [ 1, %4 ], [ %18, %13 ]
%8 = phi i32 [ 0, %4 ], [ %17, %13 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i64 @isDecimalNumber(i8* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %20, label %13
13: ; preds = %6
%14 = load i8*, i8** %9
%15 = tail call i64 @atoi(i8* %14)
%16 = trunc i64 %15 to i32
%17 = add i32 %8, %16
%18 = add nuw nsw i64 %7, 1
%19 = icmp eq i64 %18, %5
br i1 %19, label %22, label %6
20: ; preds = %6
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %25
22: ; preds = %13, %2
%23 = phi i32 [ 0, %2 ], [ %17, %13 ]
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %22, %20
ret i32 0
}