#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*/ printf(char *, ...);
int strtol(char const *, char **, int);
int main(int argc, char const **argv) {
  int sum = 0;
  char *c;
  for (int i = 1; i < argc; i++) {
    int j = strtol(argv[i], &c, 10);
    if (j == 0 && argv[i] == c) {
      printf("BŁĄD - nieporawny numer: %s %s\n", argv[i], c);
      return -1;
    }
    sum += j;
  }
  printf("suma: %d\n", sum);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ce <main+0xae>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    11b7 <main+0x97>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x20(%rbp),%rax
jne    11b7 <main+0x97>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11df <main+0xbf>
mov    -0x28(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1144 <main+0x24>
mov    -0x14(%rbp),%esi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
mov    $0x0,%ebp
cmp    $0x2,%edi
jl     1195 <main+0x75>
mov    %rsi,%r13
mov    %edi,%r12d
xor    %ebp,%ebp
mov    $0x1,%ebx
mov    %rsp,%r15
jmp    115b <main+0x3b>
nopw   0x0(%rax,%rax,1)
add    %eax,%ebp
add    $0x1,%rbx
cmp    %rbx,%r12
je     1195 <main+0x75>
mov    0x0(%r13,%rbx,8),%rdi
mov    %r15,%rsi
mov    $0xa,%edx
call   1040 <strtol@plt>
test   %eax,%eax
jne    1150 <main+0x30>
mov    0x0(%r13,%rbx,8),%rdx
cmp    (%rsp),%rdx
jne    1150 <main+0x30>
lea    0xe7d(%rip),%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%r14d
jmp    11a5 <main+0x85>
lea    0xe86(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [34 x i8] c"B\C5\81\C4\84D - nieporawny numer: %s %s\0A\00"
@.str.1 = [10 x i8] c"suma: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %25
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %21
%9 = phi i64 [ 1, %6 ], [ %23, %21 ]
%10 = phi i32 [ 0, %6 ], [ %22, %21 ]
%11 = getelementptr inbounds i8*, i8** %1, i64 %9
%12 = load i8*, i8** %11
%13 = call i32 @strtol(i8* %12, i8** %3, i32 10)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %8
%16 = load i8*, i8** %11
%17 = load i8*, i8** %3
%18 = icmp eq i8* %16, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %16)
br label %28
21: ; preds = %8, %15
%22 = add nsw i32 %13, %10
%23 = add nuw nsw i64 %9, 1
%24 = icmp eq i64 %23, %7
br i1 %24, label %25, label %8
25: ; preds = %21, %2
%26 = phi i32 [ 0, %2 ], [ %22, %21 ]
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %19, %25
%29 = phi i32 [ -1, %19 ], [ 0, %25 ]
ret i32 %29
}