#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 errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *const,
                           char *const);
scalar_t__ isint(char *const, long *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char *const *argv) {
  long int i = 0;
  if (argc == 2) {
    if (isint(argv[1], &i))
      errno = i, printf("Error code %3d: %m\n", errno), exit(0);
    fprintf(stderr, "*** %s: invalid non numerical argument %s\n", argv[0],
            argv[1]);
    exit(1);
  }
  while ((errno = i++) <= 132)
    printf("Error code %3d: %m\n", errno);
  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)
movq   $0x0,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11dc <main+0x9c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <isint@plt>
cmp    $0x0,%rax
je     11ae <main+0x6e>
mov    -0x18(%rbp),%rax
mov    %eax,%ecx
mov    0x2e48(%rip),%rax
mov    %ecx,(%rax)
mov    0x2e3f(%rip),%rax
mov    (%rax),%esi
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xe47(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    11e1 <main+0xa1>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    0x2de1(%rip),%rcx
mov    %eax,(%rcx)
cmp    $0x84,%eax
jg     121e <main+0xde>
mov    0x2dcd(%rip),%rax
mov    (%rax),%esi
lea    0xdec(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <main+0xa1>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,0x8(%rsp)
cmp    $0x2,%edi
je     1194 <main+0x54>
mov    0x2e7a(%rip),%r15
movl   $0x0,(%r15)
xor    %ebx,%ebx
lea    0xe92(%rip),%r14
xchg   %ax,%ax
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
mov    %ebx,(%r15)
cmp    $0x85,%ebx
jl     1170 <main+0x30>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0x8(%rsp),%rsi
call   1050 <isint@plt>
test   %rax,%rax
jne    11d0 <main+0x90>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
mov    0x8(%rbx),%rcx
lea    0xe53(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x8(%rsp),%esi
mov    0x2dfd(%rip),%rax
mov    %esi,(%rax)
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [20 x i8] c"Error code %3d: %m\0A\00"
@stderr = global i32 0
@.str.1 = [43 x i8] c"*** %s: invalid non numerical argument %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 2
br i1 %8, label %9, label %31
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @isint(i8* %12, i64* %6)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %9
%16 = load i64, i64* %6
%17 = trunc i64 %16 to i32
store i32 %17, i32* @errno
%18 = load i32, i32* @errno
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = call i32 @exit(i32 0)
unreachable
21: ; preds = %9
%22 = load i32, i32* @stderr
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %25, i8* %28)
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %2
br label %32
32: ; preds = %37, %31
%33 = load i64, i64* %6
%34 = add nsw i64 %33, 1
store i64 %34, i64* %6
%35 = trunc i64 %33 to i32
store i32 %35, i32* @errno
%36 = icmp sle i32 %35, 132
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = load i32, i32* @errno
%39 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %38)
br label %32
40: ; preds = %32
ret i32 0
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [20 x i8] c"Error code %3d: %m\0A\00"
@stderr = global i32 0
@.str.1 = [43 x i8] c"*** %s: invalid non numerical argument %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%5 = icmp eq i32 %0, 2
br i1 %5, label %7, label %6
6: ; preds = %2
store i32 0, i32* @errno
br label %23
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = call i64 @isint(i8* %9, i64* %3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %7
%13 = load i64, i64* %3
%14 = trunc i64 %13 to i32
store i32 %14, i32* @errno
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @exit(i32 0)
unreachable
17: ; preds = %7
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %1
%20 = load i8*, i8** %8
%21 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %19, i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %6, %23
%24 = phi i32 [ %28, %23 ], [ 0, %6 ]
%25 = phi i64 [ %27, %23 ], [ 1, %6 ]
%26 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %24)
%27 = add nuw nsw i64 %25, 1
%28 = trunc i64 %25 to i32
store i32 %28, i32* @errno
%29 = icmp slt i32 %28, 133
br i1 %29, label %23, label %30
30: ; preds = %23
ret i32 0
}