int main(int argc, char **argv) {
  char *usb_device;
  int ret = 0;
  if (argc == 2) {
    usb_device = argv[1];
    ret = usb_reset(usb_device);
    return (ret);
  }
  if (argc == 3) {
    while (1) {
      usleep(10000L);
      printf(".\b");
    }
    return (ret);
  }
  hu_log(3, "hu_uti", __func__, "1");
  sleep(1);
  hu_log(3, "hu_uti", __func__, "2");
  sleep(1);
  hu_log(3, "hu_uti", __func__, "3");
  sleep(1);
  unsigned long this_ms = 0;
  unsigned long sleep_val = 1L;
  unsigned long last_ms = ms_get();
  for (sleep_val = 64L; sleep_val <= 10000L; sleep_val += 64L) {
    ms_sleep(sleep_val);
    this_ms = ms_get();
    hu_log(3, "hu_uti", __func__, "Done ms_sleep (%6.6ld)  ms: %16ld\n",
           sleep_val, this_ms - last_ms);
    last_ms = this_ms;
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    11bc <main+0x4c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <usb_reset@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1309 <main+0x199>
cmpl   $0x3,-0x8(%rbp)
jne    11ea <main+0x7a>
jmp    11cb <main+0x5b>
mov    $0x2710,%edi
mov    $0x0,%al
call   1090 <usleep@plt>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11cb <main+0x5b>
mov    $0x3,%edi
lea    0xe0d(%rip),%rsi
lea    0xe0d(%rip),%rdx
lea    0xe0b(%rip),%rcx
mov    $0x0,%al
call   1050 <hu_log@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   1080 <sleep@plt>
mov    $0x3,%edi
lea    0xde0(%rip),%rsi
lea    0xde0(%rip),%rdx
lea    0xde0(%rip),%rcx
mov    $0x0,%al
call   1050 <hu_log@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   1080 <sleep@plt>
mov    $0x3,%edi
lea    0xdb3(%rip),%rsi
lea    0xdb3(%rip),%rdx
lea    0xdb5(%rip),%rcx
mov    $0x0,%al
call   1050 <hu_log@plt>
mov    $0x1,%edi
mov    $0x0,%al
call   1080 <sleep@plt>
movq   $0x0,-0x28(%rbp)
movq   $0x1,-0x30(%rbp)
mov    $0x0,%al
call   1070 <ms_get@plt>
cltq
mov    %rax,-0x38(%rbp)
movq   $0x40,-0x30(%rbp)
cmpq   $0x2710,-0x30(%rbp)
ja     1302 <main+0x192>
mov    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1060 <ms_sleep@plt>
mov    $0x0,%al
call   1070 <ms_get@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%r8
mov    -0x28(%rbp),%r9
sub    -0x38(%rbp),%r9
mov    $0x3,%edi
lea    0xd2f(%rip),%rsi
lea    0xd2f(%rip),%rdx
lea    0xd33(%rip),%rcx
mov    $0x0,%al
call   1050 <hu_log@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
add    $0x40,%rax
mov    %rax,-0x30(%rbp)
jmp    1296 <main+0x126>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
je     11a8 <main+0x38>
cmp    $0x3,%edi
jne    11c1 <main+0x51>
lea    0xe74(%rip),%rbx
nopl   0x0(%rax)
mov    $0x2710,%edi
xor    %eax,%eax
call   1090 <usleep@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1190 <main+0x20>
mov    0x8(%rsi),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <usb_reset@plt>
lea    0xe3b(%rip),%r14
lea    0xe3b(%rip),%r15
lea    0xe39(%rip),%rcx
mov    $0x3,%edi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <hu_log@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1080 <sleep@plt>
lea    0xe16(%rip),%rcx
mov    $0x3,%edi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <hu_log@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1080 <sleep@plt>
lea    0xdf3(%rip),%rcx
mov    $0x3,%edi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <hu_log@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1080 <sleep@plt>
xor    %eax,%eax
call   1070 <ms_get@plt>
movslq %eax,%r13
lea    0xdc6(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x40,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <ms_sleep@plt>
xor    %eax,%eax
call   1070 <ms_get@plt>
movslq %eax,%rbp
mov    %rbp,%r9
sub    %r13,%r9
mov    $0x3,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <hu_log@plt>
mov    %rbp,%r13
cmp    $0x26d1,%rbx
jb     1260 <main+0xf0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c".\08\00"
@.str.1 = [7 x i8] c"hu_uti\00"
@__func__.main = [5 x i8] c"main\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [2 x i8] c"3\00"
@.str.5 = [35 x i8] c"Done ms_sleep (%6.6ld) ms: %16ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %20
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = call i32 (i8*, ...) bitcast (i32 (...)* @usb_reset to i32 (i8*, ...)*)(i8* %17)
store i32 %18, i32* %7
%19 = load i32, i32* %7
store i32 %19, i32* %3
br label %54
20: ; preds = %2
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 3
br i1 %22, label %23, label %27
23: ; preds = %20
br label %24
24: ; preds = %23, %24
%25 = call i32 (i64, ...) bitcast (i32 (...)* @usleep to i32 (i64, ...)*)(i64 10000)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %24
27: ; preds = %20
%28 = call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 1)
%30 = call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 1)
%32 = call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%33 = call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 1)
store i64 0, i64* %8
store i64 1, i64* %9
%34 = call i32 (...) @ms_get()
%35 = sext i32 %34 to i64
store i64 %35, i64* %10
store i64 64, i64* %9
br label %36
36: ; preds = %50, %27
%37 = load i64, i64* %9
%38 = icmp ule i64 %37, 10000
br i1 %38, label %39, label %53
39: ; preds = %36
%40 = load i64, i64* %9
%41 = call i32 (i64, ...) bitcast (i32 (...)* @ms_sleep to i32 (i64, ...)*)(i64 %40)
%42 = call i32 (...) @ms_get()
%43 = sext i32 %42 to i64
store i64 %43, i64* %8
%44 = load i64, i64* %9
%45 = load i64, i64* %8
%46 = load i64, i64* %10
%47 = sub i64 %45, %46
%48 = call i32 (i32, i8*, i8*, i8*, i64, i64, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, i64, i64, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i64 %44, i64 %47)
%49 = load i64, i64* %8
store i64 %49, i64* %10
br label %50
50: ; preds = %39
%51 = load i64, i64* %9
%52 = add i64 %51, 64
store i64 %52, i64* %9
br label %36
53: ; preds = %36
store i32 0, i32* %3
br label %54
54: ; preds = %53, %13
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
@.str = [3 x i8] c".\08\00"
@.str.1 = [7 x i8] c"hu_uti\00"
@__func__.main = [5 x i8] c"main\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"2\00"
@.str.4 = [2 x i8] c"3\00"
@.str.5 = [35 x i8] c"Done ms_sleep (%6.6ld) ms: %16ld\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %10 [
i32 2, label %3
i32 3, label %7
]
3: ; preds = %2
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @usb_reset to i32 (i8*, ...)*)(i8* %5)
br label %29
7: ; preds = %2, %7
%8 = tail call i32 (i64, ...) bitcast (i32 (...)* @usleep to i32 (i64, ...)*)(i64 10000)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %7
10: ; preds = %2
%11 = tail call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 1)
%13 = tail call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%14 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 1)
%15 = tail call i32 (i32, i8*, i8*, i8*, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%16 = tail call i32 (i32, ...) bitcast (i32 (...)* @sleep to i32 (i32, ...)*)(i32 1)
%17 = tail call i32 (...) @ms_get()
%18 = sext i32 %17 to i64
br label %19
19: ; preds = %10, %19
%20 = phi i64 [ %18, %10 ], [ %24, %19 ]
%21 = phi i64 [ 64, %10 ], [ %27, %19 ]
%22 = tail call i32 (i64, ...) bitcast (i32 (...)* @ms_sleep to i32 (i64, ...)*)(i64 %21)
%23 = tail call i32 (...) @ms_get()
%24 = sext i32 %23 to i64
%25 = sub nsw i64 %24, %20
%26 = tail call i32 (i32, i8*, i8*, i8*, i64, i64, ...) bitcast (i32 (...)* @hu_log to i32 (i32, i8*, i8*, i8*, i64, i64, ...)*)(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.main, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i64 %21, i64 %25)
%27 = add nuw nsw i64 %21, 64
%28 = icmp ult i64 %21, 9937
br i1 %28, label %19, label %29
29: ; preds = %19, %3
%30 = phi i32 [ %6, %3 ], [ 0, %19 ]
ret i32 %30
}