main(argc, argv) int argc;
char *argv[];
{
  register seconds;
  register char c;
  seconds = 0;
  if (argc != 2) {
    std_err("Usage: sleep time\n");
    exit(1);
  }
  while (c = *(argv[1])++) {
    if (c < '0' || c > '9') {
      std_err("sleep: bad arg\n");
      exit(1);
    }
    seconds = 10 * seconds + (c - '0');
  }
  sleep(seconds);
  exit(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)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     116f <main+0x3f>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1050 <std_err@plt>
mov    $0x1,%edi
call   1030 <exit@plt>
jmp    1174 <main+0x44>
mov    -0x10(%rbp),%rcx
mov    0x8(%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,0x8(%rcx)
mov    (%rax),%al
mov    %al,-0x15(%rbp)
cmp    $0x0,%al
je     11db <main+0xab>
movsbl -0x15(%rbp),%eax
cmp    $0x30,%eax
jl     11ae <main+0x7e>
movsbl -0x15(%rbp),%eax
cmp    $0x39,%eax
jle    11c6 <main+0x96>
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <std_err@plt>
mov    $0x1,%edi
call   1030 <exit@plt>
imul   $0xa,-0x14(%rbp),%eax
movsbl -0x15(%rbp),%ecx
sub    $0x30,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    1174 <main+0x44>
mov    -0x14(%rbp),%edi
mov    $0x0,%al
call   1040 <sleep@plt>
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1182 <main+0x52>
mov    0x8(%rsi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,0x8(%rsi)
mov    (%rax),%cl
xor    %edi,%edi
test   %cl,%cl
je     1174 <main+0x44>
add    $0x2,%rax
xor    %edi,%edi
lea    -0x3a(%rcx),%edx
cmp    $0xf5,%dl
jbe    118b <main+0x5b>
movzbl %cl,%ecx
lea    (%rdi,%rdi,4),%edx
lea    (%rcx,%rdx,2),%edi
add    $0xffffffd0,%edi
mov    %rax,0x8(%rsi)
movzbl -0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1150 <main+0x20>
xor    %eax,%eax
call   1040 <sleep@plt>
xor    %edi,%edi
call   1030 <exit@plt>
lea    0xe77(%rip),%rdi
jmp    1192 <main+0x62>
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1050 <std_err@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Usage: sleep time\0A\00"
@.str.1 = [16 x i8] c"sleep: bad arg\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @std_err to i32 (i8*, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
unreachable
12: ; preds = %2
br label %13
13: ; preds = %30, %12
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %15
%18 = load i8, i8* %16
store i8 %18, i8* %7
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %37
20: ; preds = %13
%21 = load i8, i8* %7
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %22, 48
br i1 %23, label %28, label %24
24: ; preds = %20
%25 = load i8, i8* %7
%26 = sext i8 %25 to i32
%27 = icmp sgt i32 %26, 57
br i1 %27, label %28, label %30
28: ; preds = %24, %20
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @std_err to i32 (i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
unreachable
30: ; preds = %24
%31 = load i32, i32* %6
%32 = mul nsw i32 10, %31
%33 = load i8, i8* %7
%34 = sext i8 %33 to i32
%35 = sub nsw i32 %34, 48
%36 = add nsw i32 %32, %35
store i32 %36, i32* %6
br label %13
37: ; preds = %13
%38 = load i32, i32* %6
%39 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 %38)
unreachable
}

LLVM IR (-O2):
@.str = [19 x i8] c"Usage: sleep time\0A\00"
@.str.1 = [16 x i8] c"sleep: bad arg\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %7, i8** %5
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, 0
br i1 %9, label %28, label %12
10: ; preds = %2
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @std_err to i32 (i8*, ...)*)(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
tail call void @exit(i32 1)
unreachable
12: ; preds = %4, %20
%13 = phi i8* [ %25, %20 ], [ %7, %4 ]
%14 = phi i8 [ %26, %20 ], [ %8, %4 ]
%15 = phi i32 [ %24, %20 ], [ 0, %4 ]
%16 = add i8 %14, -58
%17 = icmp ult i8 %16, -10
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = tail call i32 (i8*, ...) bitcast (i32 (...)* @std_err to i32 (i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
tail call void @exit(i32 1)
unreachable
20: ; preds = %12
%21 = zext i8 %14 to i32
%22 = mul nsw i32 %15, 10
%23 = add i32 %22, -48
%24 = add i32 %23, %21
%25 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %25, i8** %5
%26 = load i8, i8* %13
%27 = icmp eq i8 %26, 0
br i1 %27, label %28, label %12
28: ; preds = %20, %4
%29 = phi i32 [ 0, %4 ], [ %24, %20 ]
%30 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 %29)
tail call void @exit(i32 0)
unreachable
}