#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 EXIT_SUCCESS;
int /*<<< orphan*/ LC_ALL;
int /*<<< orphan*/ atoi(char *);
scalar_t__ isdigit(char const);
int /*<<< orphan*/ print_usage(char *);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int i;
  setlocale(LC_ALL, "");
  if (argc <= 1) {
    print_usage(argv[0]);
    return EXIT_SUCCESS;
  }
  for (i = 1; i < argc; ++i) {
    const char *tmp = argv[i];
    while (*tmp && isdigit(*tmp))
      ++tmp;
    if (!*tmp)
      printf("%s\n", strerror(atoi(argv[i])));
    else {
      printf("%s: error \"%s\" is not a number\n", argv[0], argv[i]);
      print_usage(argv[0]);
      break;
    }
  }
  return EXIT_SUCCESS;
}


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)
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1050 <setlocale@plt>
cmpl   $0x1,-0x8(%rbp)
jg     11b2 <main+0x52>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <print_usage@plt>
mov    0x2e38(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    12ad <main+0x14d>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12a1 <main+0x141>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x21(%rbp)
je     1200 <main+0xa0>
mov    -0x20(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1210 <main+0xb0>
jmp    1221 <main+0xc1>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11d5 <main+0x75>
mov    -0x20(%rbp),%rax
cmpb   $0x0,(%rax)
jne    125c <main+0xfc>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1080 <strerror@plt>
mov    %rax,%rsi
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    128e <main+0x12e>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <print_usage@plt>
jmp    12a1 <main+0x141>
jmp    1293 <main+0x133>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11b9 <main+0x59>
mov    0x2d38(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %edi,%ebp
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1050 <setlocale@plt>
cmp    $0x2,%ebp
jl     1210 <main+0xb0>
mov    %ebp,%r15d
mov    $0x1,%ebp
lea    0xe66(%rip),%r14
jmp    11cc <main+0x6c>
nopl   0x0(%rax)
cmpb   $0x0,-0x1(%rbx)
jne    11fa <main+0x9a>
mov    (%r12,%rbp,8),%rdi
call   1060 <atoi@plt>
mov    %eax,%edi
call   1080 <strerror@plt>
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %r15,%rbp
je     1219 <main+0xb9>
mov    (%r12,%rbp,8),%rbx
mov    (%rbx),%al
test   %al,%al
je     11a6 <main+0x46>
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     11a0 <main+0x40>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11e0 <main+0x80>
jmp    11a6 <main+0x46>
mov    (%r12),%rsi
mov    (%r12,%rbp,8),%rdx
lea    0xdfb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r12),%rdi
call   1070 <print_usage@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@EXIT_SUCCESS = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [32 x i8] c"%s: error \22%s\22 is not a number\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* @LC_ALL
%9 = call i32 @setlocale(i32 %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %4
%11 = icmp sle i32 %10, 1
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i32 @print_usage(i8* %15)
%17 = load i32, i32* @EXIT_SUCCESS
store i32 %17, i32* %3
br label %77
18: ; preds = %2
store i32 1, i32* %6
br label %19
19: ; preds = %72, %18
%20 = load i32, i32* %6
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %75
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
store i8* %28, i8** %7
br label %29
29: ; preds = %41, %23
%30 = load i8*, i8** %7
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %29
%35 = load i8*, i8** %7
%36 = load i8, i8* %35
%37 = call i64 @isdigit(i8 signext %36)
%38 = icmp ne i64 %37, 0
br label %39
39: ; preds = %34, %29
%40 = phi i1 [ false, %29 ], [ %38, %34 ]
br i1 %40, label %41, label %44
41: ; preds = %39
%42 = load i8*, i8** %7
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %7
br label %29
44: ; preds = %39
%45 = load i8*, i8** %7
%46 = load i8, i8* %45
%47 = icmp ne i8 %46, 0
br i1 %47, label %57, label %48
48: ; preds = %44
%49 = load i8**, i8*** %5
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 @atoi(i8* %53)
%55 = call i8* @strerror(i32 %54)
%56 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %55)
br label %71
57: ; preds = %44
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 0
%60 = load i8*, i8** %59
%61 = load i8**, i8*** %5
%62 = load i32, i32* %6
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %61, i64 %63
%65 = load i8*, i8** %64
%66 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %60, i8* %65)
%67 = load i8**, i8*** %5
%68 = getelementptr inbounds i8*, i8** %67, i64 0
%69 = load i8*, i8** %68
%70 = call i32 @print_usage(i8* %69)
br label %75
71: ; preds = %48
br label %72
72: ; preds = %71
%73 = load i32, i32* %6
%74 = add nsw i32 %73, 1
store i32 %74, i32* %6
br label %19
75: ; preds = %57, %19
%76 = load i32, i32* @EXIT_SUCCESS
store i32 %76, i32* %3
br label %77
77: ; preds = %75, %12
%78 = load i32, i32* %3
ret i32 %78
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [1 x i8] zeroinitializer
@EXIT_SUCCESS = global i32 0
@.str.1 = [4 x i8] c"%s\0A\00"
@.str.2 = [32 x i8] c"%s: error \22%s\22 is not a number\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @LC_ALL
%4 = tail call i32 @setlocale(i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%5 = icmp slt i32 %0, 2
br i1 %5, label %37, label %6
6: ; preds = %2
%7 = zext i32 %0 to i64
br label %8
8: ; preds = %6, %30
%9 = phi i64 [ 1, %6 ], [ %35, %30 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %30, label %14
14: ; preds = %8, %19
%15 = phi i8 [ %21, %19 ], [ %12, %8 ]
%16 = phi i8* [ %20, %19 ], [ %11, %8 ]
%17 = tail call i64 @isdigit(i8 signext %15)
%18 = icmp eq i64 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %14
%20 = getelementptr inbounds i8, i8* %16, i64 1
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %30, label %14
23: ; preds = %14
%24 = load i8, i8* %16
%25 = icmp eq i8 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %23
%27 = load i8*, i8** %1
%28 = load i8*, i8** %10
%29 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %27, i8* %28)
br label %37
30: ; preds = %19, %8, %23
%31 = load i8*, i8** %10
%32 = tail call i32 @atoi(i8* %31)
%33 = tail call i8* @strerror(i32 %32)
%34 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %33)
%35 = add nuw nsw i64 %9, 1
%36 = icmp eq i64 %35, %7
br i1 %36, label %40, label %8
37: ; preds = %2, %26
%38 = load i8*, i8** %1
%39 = tail call i32 @print_usage(i8* %38)
br label %40
40: ; preds = %30, %37
%41 = load i32, i32* @EXIT_SUCCESS
ret i32 %41
}