#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 const *, ...);
char *strerror(int);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  int e;
  const char usage[] = "usage: strerror N\n";
  if (argc != 2) {
    goto usage;
  }
  e = strtol(argv[1], NULL, 10);
  if (e == 0)
    goto usage;
  printf("errno of %d: %s\n", e, strerror(e));
  return 0;
usage:
  printf(usage);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xeb3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xead(%rip),%ax
mov    %ax,-0x20(%rbp)
mov    0xea5(%rip),%al
mov    %al,-0x1e(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117f <main+0x4f>
jmp    11d5 <main+0xa5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11a7 <main+0x77>
jmp    11d5 <main+0xa5>
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x34(%rbp),%esi
mov    %rax,%rdx
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e7 <main+0xb7>
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movaps 0xec3(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0xa4e20,0xf(%rsp)
cmp    $0x2,%edi
jne    1182 <main+0x52>
mov    0x8(%rsi),%rdi
xor    %ebx,%ebx
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
test   %eax,%eax
je     1182 <main+0x52>
mov    %eax,%ebp
mov    %eax,%edi
call   1050 <strerror@plt>
lea    0xe9f(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1191 <main+0x61>
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.usage = [19 x i8] c"usage: strerror N\0A\00"
@.str = [17 x i8] c"errno of %d: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [19 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [19 x i8]* %7 to i8*
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %2
br label %25
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @strtol(i8* %15, i32* null, i32 10)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %20
19: ; preds = %12
br label %25
20: ; preds = %12
%21 = load i32, i32* %6
%22 = load i32, i32* %6
%23 = call i8* @strerror(i32 %22)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %21, i8* %23)
store i32 0, i32* %3
br label %28
25: ; preds = %19, %11
%26 = getelementptr inbounds [19 x i8], [19 x i8]* %7, i64 0, i64 0
%27 = call i32 (i8*, ...) @printf(i8* %26)
store i32 1, i32* %3
br label %28
28: ; preds = %25, %20
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
@__const.main.usage = [19 x i8] c"usage: strerror N\0A\00"
@.str = [17 x i8] c"errno of %d: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [19 x i8]
%4 = getelementptr inbounds [19 x i8], [19 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strtol(i8* nocapture %8, i32* null, i32 10)
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = tail call i8* @strerror(i32 %9)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %12)
br label %16
14: ; preds = %6, %2
%15 = call i32 (i8*, ...) @printf(i8* %4)
br label %16
16: ; preds = %14, %11
%17 = phi i32 [ 1, %14 ], [ 0, %11 ]
ret i32 %17
}