#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__ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *, char *,
                           char *);
int /*<<< orphan*/ stderr;
char *strerror(scalar_t__);
char *xsh(int, char **);
int main(int argc, char **argv) {
  argv[1] = xsh(argc, argv);
  fprintf(stderr, "%s%s%s: %s\n", argv[0], errno ? ": " : "",
          errno ? strerror(errno) : "", argv[1] ? argv[1] : "<null>");
  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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <xsh@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%rdx
lea    0xe86(%rip),%rax
lea    0xe80(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    0x2e39(%rip),%rax
cmpq   $0x0,(%rax)
je     11c1 <main+0x91>
mov    0x2e28(%rip),%rax
mov    (%rax),%rdi
call   1050 <strerror@plt>
mov    %rax,-0x30(%rbp)
jmp    11d1 <main+0xa1>
lea    0xe43(%rip),%rax
mov    %rax,-0x30(%rbp)
jmp    11d1 <main+0xa1>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11f9 <main+0xc9>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1209 <main+0xd9>
lea    0xe0f(%rip),%rax
mov    %rax,-0x40(%rbp)
jmp    1209 <main+0xd9>
mov    -0x38(%rbp),%r8
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%edi
mov    -0x40(%rbp),%r9
lea    0xddd(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
call   1030 <xsh@plt>
mov    %rax,0x8(%rbx)
mov    0x2e99(%rip),%rcx
mov    (%rcx),%ebp
mov    (%rbx),%r14
mov    0x2e85(%rip),%rcx
mov    (%rcx),%rdi
test   %rdi,%rdi
je     1170 <main+0x40>
call   1050 <strerror@plt>
mov    %rax,%r8
mov    0x8(%rbx),%rax
lea    0xe9e(%rip),%rcx
jmp    117a <main+0x4a>
lea    0xe94(%rip),%rcx
mov    %rcx,%r8
test   %rax,%rax
lea    0xe8b(%rip),%r9
cmovne %rax,%r9
lea    0xe71(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"%s%s%s: %s\0A\00"
@errno = global i64 0
@.str.1 = [3 x i8] c": \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [7 x i8] c"<null>\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i8* @xsh(i32 %6, i8** %7)
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
store i8* %8, i8** %10
%11 = load i32, i32* @stderr
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 0
%14 = load i8*, i8** %13
%15 = load i64, i64* @errno
%16 = icmp ne i64 %15, 0
%17 = zext i1 %16 to i64
%18 = select i1 %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0)
%19 = load i64, i64* @errno
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %2
%22 = load i64, i64* @errno
%23 = call i8* @strerror(i64 %22)
br label %25
24: ; preds = %2
br label %25
25: ; preds = %24, %21
%26 = phi i8* [ %23, %21 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %24 ]
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %35
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
br label %36
35: ; preds = %25
br label %36
36: ; preds = %35, %31
%37 = phi i8* [ %34, %31 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %35 ]
%38 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %18, i8* %26, i8* %37)
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"%s%s%s: %s\0A\00"
@errno = global i64 0
@.str.1 = [3 x i8] c": \00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [7 x i8] c"<null>\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i8* @xsh(i32 %0, i8** %1)
%4 = getelementptr inbounds i8*, i8** %1, i64 1
store i8* %3, i8** %4
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = load i64, i64* @errno
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %2
%10 = tail call i8* @strerror(i64 %7)
%11 = load i8*, i8** %4
br label %12
12: ; preds = %2, %9
%13 = phi i8* [ %3, %2 ], [ %11, %9 ]
%14 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %2 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %9 ]
%15 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %2 ], [ %10, %9 ]
%16 = icmp eq i8* %13, null
%17 = select i1 %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %13
%18 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6, i8* %14, i8* %15, i8* %17)
ret i32 1
}