int main(int argc, char *argv[]) {
  int i;
  char *dev = "1";
  int fd;
  if (argc < 2) {
    printf(1, "Usage: mystat [-d DEV] [-f path] [FILE/DIR]+\n");
    exit(1);
  }
  int num = isnum(argv[1]);
  printf("input is %s, num=%d\n", argv[1], num);
  int str = isstr(argv[1]);
  printf("input is %s, str=%d\n", argv[1], str);
  int hasstr = cmd_has_str(argc, argv);
  printf("cmdline hasstr=%d\n", hasstr);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1198 <main+0x48>
mov    $0x1,%edi
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   1060 <isnum@plt>
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x28(%rbp),%edx
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x0,%al
call   1040 <isstr@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x2c(%rbp),%edx
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <cmd_has_str@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x1,%edi
jle    11c0 <main+0x70>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
xor    %eax,%eax
call   1060 <isnum@plt>
mov    0x8(%rbx),%rsi
lea    0xebb(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x8(%rbx),%rdi
xor    %eax,%eax
call   1040 <isstr@plt>
mov    0x8(%rbx),%rsi
lea    0xeb1(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <cmd_has_str@plt>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe39(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"1\00"
@.str.1 = [46 x i8] c"Usage: mystat [-d DEV] [-f path] [FILE/DIR]+\0A\00"
@.str.2 = [21 x i8] c"input is %s, num=%d\0A\00"
@.str.3 = [21 x i8] c"input is %s, str=%d\0A\00"
@.str.4 = [19 x i8] c"cmdline hasstr=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %7
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 2
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @isnum to i32 (i8*, ...)*)(i8* %19)
store i32 %20, i32* %9
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = load i32, i32* %9
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %23, i32 %24)
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @isstr to i32 (i8*, ...)*)(i8* %28)
store i32 %29, i32* %10
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = load i32, i32* %10
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %32, i32 %33)
%35 = load i32, i32* %4
%36 = load i8**, i8*** %5
%37 = call i32 (i32, i8**, ...) bitcast (i32 (...)* @cmd_has_str to i32 (i32, i8**, ...)*)(i32 %35, i8** %36)
store i32 %37, i32* %11
%38 = load i32, i32* %11
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [46 x i8] c"Usage: mystat [-d DEV] [-f path] [FILE/DIR]+\0A\00"
@.str.2 = [21 x i8] c"input is %s, num=%d\0A\00"
@.str.3 = [21 x i8] c"input is %s, str=%d\0A\00"
@.str.4 = [19 x i8] c"cmdline hasstr=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* inttoptr (i64 1 to i8*), i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
tail call void @exit(i32 1)
unreachable
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 (i8*, ...) bitcast (i32 (...)* @isnum to i32 (i8*, ...)*)(i8* %8)
%10 = load i8*, i8** %7
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %10, i32 %9)
%12 = load i8*, i8** %7
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @isstr to i32 (i8*, ...)*)(i8* %12)
%14 = load i8*, i8** %7
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* %14, i32 %13)
%16 = tail call i32 (i32, i8**, ...) bitcast (i32 (...)* @cmd_has_str to i32 (i32, i8**, ...)*)(i32 %0, i8** %1)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %16)
ret i32 0
}