#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*/ sleep(unsigned int);
unsigned long strtoul(char *, char **, int);
int /*<<< orphan*/ usage(char *);
int sleep_main(int argc, char *argv[]) {
  unsigned long seconds;
  char *endptr;
  if (argc != 2) {
    usage(argv[0]);
  }
  seconds = strtoul(argv[1], &endptr, 10);
  if (endptr == argv[1]) {
    usage(argv[0]);
  }
  sleep((unsigned int)seconds);
  return 0;
}


x86 assembly (clang, -O0):
<sleep_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1155 <sleep_main+0x25>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    0x8(%rcx),%rax
jne    118d <sleep_main+0x5d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <usage@plt>
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep_main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1144 <sleep_main+0x14>
mov    (%rbx),%rdi
call   1030 <usage@plt>
mov    0x8(%rbx),%rdi
mov    %rsp,%rsi
mov    $0xa,%edx
call   1040 <strtoul@plt>
mov    %rax,%r14
mov    (%rsp),%rax
cmp    0x8(%rbx),%rax
jne    116a <sleep_main+0x3a>
mov    (%rbx),%rdi
call   1030 <usage@plt>
mov    %r14d,%edi
call   1050 <sleep@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @sleep_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i64
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i8**, i8*** %4
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @usage(i8* %12)
br label %14
14: ; preds = %9, %2
%15 = load i8**, i8*** %4
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i64 @strtoul(i8* %17, i8** %6, i32 10)
store i64 %18, i64* %5
%19 = load i8*, i8** %6
%20 = load i8**, i8*** %4
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = icmp eq i8* %19, %22
br i1 %23, label %24, label %29
24: ; preds = %14
%25 = load i8**, i8*** %4
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @usage(i8* %27)
br label %29
29: ; preds = %24, %14
%30 = load i64, i64* %5
%31 = trunc i64 %30 to i32
%32 = call i32 @sleep(i32 %31)
ret i32 0
}

LLVM IR (-O2):
define i32 @sleep_main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i32 @usage(i8* %7)
br label %9
9: ; preds = %6, %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strtoul(i8* %11, i8** %3, i32 10)
%13 = load i8*, i8** %3
%14 = load i8*, i8** %10
%15 = icmp eq i8* %13, %14
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i8*, i8** %1
%18 = tail call i32 @usage(i8* %17)
br label %19
19: ; preds = %16, %9
%20 = trunc i64 %12 to i32
%21 = tail call i32 @sleep(i32 %20)
ret i32 0
}