#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*/ err(int, char *, char *);
scalar_t__ errno;
int /*<<< orphan*/ errx(int, char *);
int /*<<< orphan*/ sleep(unsigned long);
unsigned long strtoul(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  if (argc < 2)
    errx(1, "Missing operand");
  unsigned long time = strtoul(argv[1], NULL, 10);
  if (errno)
    err(1, "strtoul: '%s'", argv[1]);
  sleep(time);
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    1171 <main+0x31>
mov    $0x1,%edi
lea    0xe94(%rip),%rsi
call   1030 <errx@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %rax,-0x18(%rbp)
mov    0x2e4e(%rip),%rax
cmpq   $0x0,(%rax)
je     11b5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    $0x1,%edi
lea    0xe60(%rip),%rsi
call   1040 <err@plt>
mov    -0x18(%rbp),%rdi
call   1060 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     115d <main+0x1d>
lea    0xead(%rip),%rsi
mov    $0x1,%edi
call   1030 <errx@plt>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %rax,%r14
mov    0x2e69(%rip),%rax
cmpq   $0x0,(%rax)
je     1192 <main+0x52>
mov    0x8(%rbx),%rdx
lea    0xe88(%rip),%rsi
mov    $0x1,%edi
call   1040 <err@plt>
mov    %r14,%rdi
call   1060 <sleep@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Missing operand\00"
@errno = global i64 0
@.str.1 = [14 x i8] c"strtoul: '%s'\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
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @errx(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @strtoul(i8* %14, i32* null, i32 10)
store i64 %15, i64* %6
%16 = load i64, i64* @errno
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %11
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %18, %11
%24 = load i64, i64* %6
%25 = call i32 @sleep(i64 %24)
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [16 x i8] c"Missing operand\00"
@errno = global i64 0
@.str.1 = [14 x i8] c"strtoul: '%s'\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strtoul(i8* nocapture %8, i32* null, i32 10)
%10 = load i64, i64* @errno
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %6
%13 = load i8*, i8** %7
%14 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %15
15: ; preds = %12, %6
%16 = tail call i32 @sleep(i64 %9)
ret i32 0
}