#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*/ getDecNumber(char *, int *);
int /*<<< orphan*/ help15();
int /*<<< orphan*/ load(int);
int /*<<< orphan*/ printf(char *);
void doLoad(char *tokens[], int n) {
  int serno;
  if (n == 2) {
    if (!getDecNumber(tokens[1], &serno) || serno < 0 || serno > 1) {
      printf("illegal serial line number\n");
      return;
    }
    load(serno);
  } else {
    help15();
  }
}


x86 assembly (clang, -O0):
<doLoad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    11a5 <doLoad+0x65>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <getDecNumber@plt>
cmp    $0x0,%eax
je     1187 <doLoad+0x47>
cmpl   $0x0,-0x10(%rbp)
jl     1187 <doLoad+0x47>
cmpl   $0x1,-0x10(%rbp)
jle    1198 <doLoad+0x58>
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
jmp    11ac <doLoad+0x6c>
mov    -0x10(%rbp),%edi
call   1060 <load@plt>
jmp    11ac <doLoad+0x6c>
mov    $0x0,%al
call   1030 <help15@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doLoad>:
cmp    $0x2,%esi
jne    116c <doLoad+0x2c>
push   %rax
mov    0x8(%rdi),%rdi
lea    0x4(%rsp),%rsi
call   1050 <getDecNumber@plt>
test   %eax,%eax
je     1173 <doLoad+0x33>
mov    0x4(%rsp),%edi
test   %edi,%edi
js     1173 <doLoad+0x33>
cmp    $0x2,%edi
jge    1173 <doLoad+0x33>
call   1060 <load@plt>
pop    %rax
ret
xor    %eax,%eax
jmp    1030 <help15@plt>
lea    0xe86(%rip),%rdi
call   1040 <puts@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [28 x i8] c"illegal serial line number\0A\00"
define void @doLoad(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 2
br i1 %7, label %8, label %25
8: ; preds = %2
%9 = load i8**, i8*** %3
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @getDecNumber(i8* %11, i32* %5)
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %8
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %5
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %17, %14, %8
%21 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %27
22: ; preds = %17
%23 = load i32, i32* %5
%24 = call i32 @load(i32 %23)
br label %27
25: ; preds = %2
%26 = call i32 (...) @help15()
br label %27
27: ; preds = %20, %25, %22
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"illegal serial line number\00"
define void @doLoad(i8** nocapture %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp eq i32 %1, 2
br i1 %5, label %6, label %20
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %0, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @getDecNumber(i8* %8, i32* %3)
%10 = icmp eq i32 %9, 0
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 0
%13 = select i1 %10, i1 true, i1 %12
%14 = icmp sgt i32 %11, 1
%15 = select i1 %13, i1 true, i1 %14
br i1 %15, label %16, label %18
16: ; preds = %6
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %22
18: ; preds = %6
%19 = call i32 @load(i32 %11)
br label %22
20: ; preds = %2
%21 = tail call i32 (...) @help15()
br label %22
22: ; preds = %18, %20, %16
ret void
}