#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 atoi(char *);
scalar_t__ regmatchInsensitive(char *, char *);
int /*<<< orphan*/ slog(int, char *, char *);
int /*<<< orphan*/ strlen(char *);
int getWaitTime(char *string) {
  int wt = 100000000;
  if (regmatchInsensitive(string, "^waittime=[0-9]+$")) {
    string += strlen("waittime=");
    wt = atoi(string);
  } else {
    slog(1, "... problems reading the wait time: the line %s is not correct\n",
         string);
    wt = -1;
  }
  return wt;
}


x86 assembly (clang, -O0):
<getWaitTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x5f5e100,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1060 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     119a <getWaitTime+0x5a>
lea    0xe9e(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
jmp    11b6 <getWaitTime+0x76>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xe72(%rip),%rsi
call   1040 <slog@plt>
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWaitTime>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
call   1060 <regmatchInsensitive@plt>
test   %rax,%rax
je     116f <getWaitTime+0x2f>
lea    0xeb6(%rip),%rdi
call   1030 <strlen@plt>
cltq
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <atoi@plt>
lea    0xea6(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
call   1040 <slog@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"^waittime=[0-9]+$\00"
@.str.1 = [10 x i8] c"waittime=\00"
@.str.2 = [64 x i8] c"... problems reading the wait time: the line %s is not correct\0A\00"
define i32 @getWaitTime(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 100000000, i32* %3
%4 = load i8*, i8** %2
%5 = call i64 @regmatchInsensitive(i8* %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i8, i8* %9, i64 %10
store i8* %11, i8** %2
%12 = load i8*, i8** %2
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %3
br label %17
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i32 @slog(i32 1, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0), i8* %15)
store i32 -1, i32* %3
br label %17
17: ; preds = %14, %7
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [18 x i8] c"^waittime=[0-9]+$\00"
@.str.1 = [10 x i8] c"waittime=\00"
@.str.2 = [64 x i8] c"... problems reading the wait time: the line %s is not correct\0A\00"
define i32 @getWaitTime(i8* %0) {
%2 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = tail call i32 @atoi(i8* %7)
br label %11
9: ; preds = %1
%10 = tail call i32 @slog(i32 1, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %11
11: ; preds = %9, %4
%12 = phi i32 [ %8, %4 ], [ -1, %9 ]
ret i32 %12
}