#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 */
scalar_t__ strcasecmp(char *, char *);
double strtod(char *, char **);
int get_usecs(unsigned *usecs, char *str) {
  double t;
  char *p;
  t = strtod(str, &p);
  if (p == str)
    return -1;
  if (*p) {
    if (strcasecmp(p, "s") == 0 || strcasecmp(p, "sec") == 0 ||
        strcasecmp(p, "secs") == 0)
      t *= 1000000;
    else if (strcasecmp(p, "ms") == 0 || strcasecmp(p, "msec") == 0 ||
             strcasecmp(p, "msecs") == 0)
      t *= 1000;
    else if (strcasecmp(p, "us") == 0 || strcasecmp(p, "usec") == 0 ||
             strcasecmp(p, "usecs") == 0)
      t *= 1;
    else
      return -1;
  }
  *usecs = t;
  return 0;
}


x86 assembly (clang, -O0):
<get_usecs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <strtod@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    115c <get_usecs+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    12c8 <get_usecs+0x1a8>
mov    -0x28(%rbp),%rax
cmpb   $0x0,(%rax)
je     12b3 <get_usecs+0x193>
mov    -0x28(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11b7 <get_usecs+0x97>
mov    -0x28(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     11b7 <get_usecs+0x97>
mov    -0x28(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    11ce <get_usecs+0xae>
movsd  0xe51(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12ae <get_usecs+0x18e>
mov    -0x28(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     121c <get_usecs+0xfc>
mov    -0x28(%rbp),%rdi
lea    0xe28(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     121c <get_usecs+0xfc>
mov    -0x28(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1233 <get_usecs+0x113>
movsd  0xde4(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12a9 <get_usecs+0x189>
mov    -0x28(%rbp),%rdi
lea    0xde8(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1281 <get_usecs+0x161>
mov    -0x28(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
je     1281 <get_usecs+0x161>
mov    -0x28(%rbp),%rdi
lea    0xdbc(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1298 <get_usecs+0x178>
movsd  0xd77(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12a4 <get_usecs+0x184>
movl   $0xffffffff,-0x4(%rbp)
jmp    12c8 <get_usecs+0x1a8>
jmp    12a9 <get_usecs+0x189>
jmp    12ae <get_usecs+0x18e>
jmp    12b3 <get_usecs+0x193>
cvttsd2si -0x20(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_usecs>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbp
mov    %rdi,%r14
lea    0x10(%rsp),%rsi
mov    %rbp,%rdi
call   1040 <strtod@plt>
mov    0x10(%rsp),%rbx
mov    $0xffffffff,%r15d
cmp    %rbp,%rbx
je     1245 <get_usecs+0x125>
cmpb   $0x0,(%rbx)
je     123a <get_usecs+0x11a>
movsd  %xmm0,0x8(%rsp)
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     122c <get_usecs+0x10c>
lea    0xe95(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     122c <get_usecs+0x10c>
lea    0xe82(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     122c <get_usecs+0x10c>
lea    0xe61(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1253 <get_usecs+0x133>
lea    0xe4c(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1253 <get_usecs+0x133>
lea    0xe3d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1253 <get_usecs+0x133>
lea    0xe2f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1263 <get_usecs+0x143>
lea    0xe1e(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1263 <get_usecs+0x143>
lea    0xe0f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
movsd  0x8(%rsp),%xmm0
jne    1245 <get_usecs+0x125>
jmp    123a <get_usecs+0x11a>
movsd  0x8(%rsp),%xmm0
mulsd  0xdce(%rip),%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,(%r14)
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
movsd  0x8(%rsp),%xmm0
mulsd  0xd9f(%rip),%xmm0
jmp    123a <get_usecs+0x11a>
movsd  0x8(%rsp),%xmm0
jmp    123a <get_usecs+0x11a>

LLVM IR (-O0):
@.str = [2 x i8] c"s\00"
@.str.1 = [4 x i8] c"sec\00"
@.str.2 = [5 x i8] c"secs\00"
@.str.3 = [3 x i8] c"ms\00"
@.str.4 = [5 x i8] c"msec\00"
@.str.5 = [6 x i8] c"msecs\00"
@.str.6 = [3 x i8] c"us\00"
@.str.7 = [5 x i8] c"usec\00"
@.str.8 = [6 x i8] c"usecs\00"
define i32 @get_usecs(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca double
%7 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %5
%9 = call double @strtod(i8* %8, i8** %7)
store double %9, double* %6
%10 = load i8*, i8** %7
%11 = load i8*, i8** %5
%12 = icmp eq i8* %10, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %71
14: ; preds = %2
%15 = load i8*, i8** %7
%16 = load i8, i8* %15
%17 = icmp ne i8 %16, 0
br i1 %17, label %18, label %67
18: ; preds = %14
%19 = load i8*, i8** %7
%20 = call i64 @strcasecmp(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %30, label %22
22: ; preds = %18
%23 = load i8*, i8** %7
%24 = call i64 @strcasecmp(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %30, label %26
26: ; preds = %22
%27 = load i8*, i8** %7
%28 = call i64 @strcasecmp(i8* %27, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %26, %22, %18
%31 = load double, double* %6
%32 = fmul double %31, 1.000000e+06
store double %32, double* %6
br label %66
33: ; preds = %26
%34 = load i8*, i8** %7
%35 = call i64 @strcasecmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %45, label %37
37: ; preds = %33
%38 = load i8*, i8** %7
%39 = call i64 @strcasecmp(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %37
%42 = load i8*, i8** %7
%43 = call i64 @strcasecmp(i8* %42, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %41, %37, %33
%46 = load double, double* %6
%47 = fmul double %46, 1.000000e+03
store double %47, double* %6
br label %65
48: ; preds = %41
%49 = load i8*, i8** %7
%50 = call i64 @strcasecmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %60, label %52
52: ; preds = %48
%53 = load i8*, i8** %7
%54 = call i64 @strcasecmp(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %60, label %56
56: ; preds = %52
%57 = load i8*, i8** %7
%58 = call i64 @strcasecmp(i8* %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %56, %52, %48
%61 = load double, double* %6
%62 = fmul double %61, 1.000000e+00
store double %62, double* %6
br label %64
63: ; preds = %56
store i32 -1, i32* %3
br label %71
64: ; preds = %60
br label %65
65: ; preds = %64, %45
br label %66
66: ; preds = %65, %30
br label %67
67: ; preds = %66, %14
%68 = load double, double* %6
%69 = fptoui double %68 to i32
%70 = load i32*, i32** %4
store i32 %69, i32* %70
store i32 0, i32* %3
br label %71
71: ; preds = %67, %63, %13
%72 = load i32, i32* %3
ret i32 %72
}

LLVM IR (-O2):
@.str = [2 x i8] c"s\00"
@.str.1 = [4 x i8] c"sec\00"
@.str.2 = [5 x i8] c"secs\00"
@.str.3 = [3 x i8] c"ms\00"
@.str.4 = [5 x i8] c"msec\00"
@.str.5 = [6 x i8] c"msecs\00"
@.str.6 = [3 x i8] c"us\00"
@.str.7 = [5 x i8] c"usec\00"
@.str.8 = [6 x i8] c"usecs\00"
define i32 @get_usecs(i32* nocapture writeonly %0, i8* %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call double @strtod(i8* %1, i8** %3)
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, %1
br i1 %7, label %45, label %8
8: ; preds = %2
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 0
br i1 %10, label %42, label %11
11: ; preds = %8
%12 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17, %14, %11
%21 = fmul double %5, 1.000000e+06
br label %42
22: ; preds = %17
%23 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28, %25, %22
%32 = fmul double %5, 1.000000e+03
br label %42
33: ; preds = %28
%34 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %42, label %36
36: ; preds = %33
%37 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%38 = icmp eq i64 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %36
%40 = tail call i64 @strcasecmp(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%41 = icmp eq i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %33, %36, %39, %20, %31, %8
%43 = phi double [ %21, %20 ], [ %32, %31 ], [ %5, %8 ], [ %5, %39 ], [ %5, %36 ], [ %5, %33 ]
%44 = fptoui double %43 to i32
store i32 %44, i32* %0
br label %45
45: ; preds = %39, %2, %42
%46 = phi i32 [ 0, %42 ], [ -1, %2 ], [ -1, %39 ]
ret i32 %46
}