#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 */
unsigned long strtoul(char const *, char **, int);
int get_time_arg_msec(const char *arg, unsigned long *value) {
  unsigned long t;
  char *suffix;
  t = strtoul(arg, &suffix, 10);
  if (*suffix == 'm') {
    suffix++;
  } else if (*suffix == 's') {
    t *= 1000;
    suffix++;
  }
  if (*suffix != 0) {
    return 1;
  }
  *value = t;
  return 0;
}


x86 assembly (clang, -O0):
<get_time_arg_msec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6d,%eax
jne    1157 <get_time_arg_msec+0x47>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1184 <get_time_arg_msec+0x74>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    117f <get_time_arg_msec+0x6f>
imul   $0x3e8,-0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1184 <get_time_arg_msec+0x74>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11a0 <get_time_arg_msec+0x90>
movl   $0x1,-0x4(%rbp)
jmp    11b2 <get_time_arg_msec+0xa2>
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time_arg_msec>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    0x8(%rsp),%rcx
mov    (%rcx),%dl
cmp    $0x6d,%dl
je     113f <get_time_arg_msec+0x2f>
cmp    $0x73,%dl
jne    1142 <get_time_arg_msec+0x32>
imul   $0x3e8,%rax,%rax
mov    0x1(%rcx),%dl
mov    $0x1,%ecx
test   %dl,%dl
jne    1150 <get_time_arg_msec+0x40>
mov    %rax,(%rbx)
xor    %ecx,%ecx
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_time_arg_msec(i8* %0, i64* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i8*
store i8* %0, i8** %4
store i64* %1, i64** %5
%8 = load i8*, i8** %4
%9 = call i64 @strtoul(i8* %8, i8** %7, i32 10)
store i64 %9, i64* %6
%10 = load i8*, i8** %7
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 109
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i8*, i8** %7
%16 = getelementptr inbounds i8, i8* %15, i32 1
store i8* %16, i8** %7
br label %28
17: ; preds = %2
%18 = load i8*, i8** %7
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 115
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = load i64, i64* %6
%24 = mul i64 %23, 1000
store i64 %24, i64* %6
%25 = load i8*, i8** %7
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %7
br label %27
27: ; preds = %22, %17
br label %28
28: ; preds = %27, %14
%29 = load i8*, i8** %7
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %28
store i32 1, i32* %3
br label %37
34: ; preds = %28
%35 = load i64, i64* %6
%36 = load i64*, i64** %5
store i64 %35, i64* %36
store i32 0, i32* %3
br label %37
37: ; preds = %34, %33
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
define i32 @get_time_arg_msec(i8* %0, i64* nocapture writeonly %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i64 @strtoul(i8* %0, i8** %3, i32 10)
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
switch i8 %7, label %14 [
i8 109, label %10
i8 115, label %8
]
8: ; preds = %2
%9 = mul i64 %5, 1000
br label %10
10: ; preds = %2, %8
%11 = phi i64 [ %9, %8 ], [ %5, %2 ]
%12 = getelementptr inbounds i8, i8* %6, i64 1
%13 = load i8, i8* %12
br label %14
14: ; preds = %10, %2
%15 = phi i8 [ %13, %10 ], [ %7, %2 ]
%16 = phi i64 [ %11, %10 ], [ %5, %2 ]
%17 = icmp eq i8 %15, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i64 %16, i64* %1
br label %19
19: ; preds = %14, %18
%20 = phi i32 [ 0, %18 ], [ 1, %14 ]
ret i32 %20
}