#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 *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int check_wait_time(char *data) {
  int size, i_hour, i_min, i_sec;
  char hour[3], min[3], sec[3];
  size = strlen(data);
  if (size == 4 || size == 6) {
  } else {
    return -1;
  }
  strncpy(hour, data, 2);
  hour[2] = '\0';
  strncpy(min, (data + 2), 2);
  min[2] = '\0';
  i_hour = atoi(hour);
  i_min = atoi(min);
  i_sec = 0;
  if (size > 4) {
    strncpy(sec, (data + 4), 2);
    sec[2] = '\0';
    i_sec = atoi(sec);
  }
  if (i_hour < 0 || i_hour > 99) {
    return -1;
  }
  if (i_min < 0 || i_min > 59) {
    return -1;
  }
  if (i_sec < 0 || i_sec > 59) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_wait_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
je     115c <check_wait_time+0x2c>
cmpl   $0x6,-0x14(%rbp)
jne    1161 <check_wait_time+0x31>
jmp    116d <check_wait_time+0x3d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1253 <check_wait_time+0x123>
lea    -0x23(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x21(%rbp)
lea    -0x26(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x2,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x24(%rbp)
lea    -0x23(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    -0x26(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x4,-0x14(%rbp)
jle    11ec <check_wait_time+0xbc>
lea    -0x29(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x27(%rbp)
lea    -0x29(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x18(%rbp)
jl     1200 <check_wait_time+0xd0>
cmpl   $0x63,-0x18(%rbp)
jle    120c <check_wait_time+0xdc>
movl   $0xffffffff,-0x4(%rbp)
jmp    1253 <check_wait_time+0x123>
cmpl   $0x0,-0x1c(%rbp)
jl     1220 <check_wait_time+0xf0>
cmpl   $0x3b,-0x1c(%rbp)
jle    122c <check_wait_time+0xfc>
movl   $0xffffffff,-0x4(%rbp)
jmp    1253 <check_wait_time+0x123>
cmpl   $0x0,-0x20(%rbp)
jl     1240 <check_wait_time+0x110>
cmpl   $0x3b,-0x20(%rbp)
jle    124c <check_wait_time+0x11c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1253 <check_wait_time+0x123>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_wait_time>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ebp
and    $0xfffffffd,%eax
mov    $0xffffffff,%r14d
cmp    $0x4,%eax
jne    11e6 <check_wait_time+0xb6>
lea    0xd(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xf(%rsp)
lea    0x2(%rbx),%rsi
lea    0xa(%rsp),%r12
mov    %r12,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xc(%rsp)
mov    %r15,%rdi
call   1050 <atoi@plt>
mov    %eax,%r15d
mov    %r12,%rdi
call   1050 <atoi@plt>
mov    %eax,%r12d
xor    %eax,%eax
cmp    $0x5,%ebp
jb     11d0 <check_wait_time+0xa0>
add    $0x4,%rbx
lea    0x7(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x9(%rsp)
mov    %rbp,%rdi
call   1050 <atoi@plt>
cmp    $0x63,%r15d
ja     11e6 <check_wait_time+0xb6>
cmp    $0x3b,%r12d
ja     11e6 <check_wait_time+0xb6>
xor    %r14d,%r14d
cmp    $0x3c,%eax
adc    $0xffffffff,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_wait_time(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [3 x i8]
%9 = alloca [3 x i8]
%10 = alloca [3 x i8]
store i8* %0, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 @strlen(i8* %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 4
br i1 %14, label %18, label %15
15: ; preds = %1
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 6
br i1 %17, label %18, label %19
18: ; preds = %15, %1
br label %20
19: ; preds = %15
store i32 -1, i32* %2
br label %66
20: ; preds = %18
%21 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%22 = load i8*, i8** %3
%23 = call i32 @strncpy(i8* %21, i8* %22, i32 2)
%24 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 2
store i8 0, i8* %24
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 2
%28 = call i32 @strncpy(i8* %25, i8* %27, i32 2)
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 2
store i8 0, i8* %29
%30 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%31 = call i32 @atoi(i8* %30)
store i32 %31, i32* %5
%32 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%33 = call i32 @atoi(i8* %32)
store i32 %33, i32* %6
store i32 0, i32* %7
%34 = load i32, i32* %4
%35 = icmp sgt i32 %34, 4
br i1 %35, label %36, label %44
36: ; preds = %20
%37 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i64 4
%40 = call i32 @strncpy(i8* %37, i8* %39, i32 2)
%41 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 2
store i8 0, i8* %41
%42 = getelementptr inbounds [3 x i8], [3 x i8]* %10, i64 0, i64 0
%43 = call i32 @atoi(i8* %42)
store i32 %43, i32* %7
br label %44
44: ; preds = %36, %20
%45 = load i32, i32* %5
%46 = icmp slt i32 %45, 0
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = load i32, i32* %5
%49 = icmp sgt i32 %48, 99
br i1 %49, label %50, label %51
50: ; preds = %47, %44
store i32 -1, i32* %2
br label %66
51: ; preds = %47
%52 = load i32, i32* %6
%53 = icmp slt i32 %52, 0
br i1 %53, label %57, label %54
54: ; preds = %51
%55 = load i32, i32* %6
%56 = icmp sgt i32 %55, 59
br i1 %56, label %57, label %58
57: ; preds = %54, %51
store i32 -1, i32* %2
br label %66
58: ; preds = %54
%59 = load i32, i32* %7
%60 = icmp slt i32 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = load i32, i32* %7
%63 = icmp sgt i32 %62, 59
br i1 %63, label %64, label %65
64: ; preds = %61, %58
store i32 -1, i32* %2
br label %66
65: ; preds = %61
store i32 0, i32* %2
br label %66
66: ; preds = %65, %64, %57, %50, %19
%67 = load i32, i32* %2
ret i32 %67
}

LLVM IR (-O2):
define i32 @check_wait_time(i8* %0) {
%2 = alloca [3 x i8]
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%8 = tail call i32 @strlen(i8* %0)
%9 = and i32 %8, -3
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %33
11: ; preds = %1
%12 = call i32 @strncpy(i8* %5, i8* %0, i32 2)
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 2
store i8 0, i8* %13
%14 = getelementptr inbounds i8, i8* %0, i64 2
%15 = call i32 @strncpy(i8* %6, i8* %14, i32 2)
%16 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 0, i8* %16
%17 = call i32 @atoi(i8* %5)
%18 = call i32 @atoi(i8* %6)
%19 = icmp ugt i32 %8, 4
br i1 %19, label %20, label %25
20: ; preds = %11
%21 = getelementptr inbounds i8, i8* %0, i64 4
%22 = call i32 @strncpy(i8* %7, i8* %21, i32 2)
%23 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 0, i8* %23
%24 = call i32 @atoi(i8* %7)
br label %25
25: ; preds = %20, %11
%26 = phi i32 [ %24, %20 ], [ 0, %11 ]
%27 = icmp ugt i32 %17, 99
%28 = icmp ugt i32 %18, 59
%29 = select i1 %27, i1 true, i1 %28
br i1 %29, label %33, label %30
30: ; preds = %25
%31 = icmp ugt i32 %26, 59
%32 = sext i1 %31 to i32
br label %33
33: ; preds = %30, %25, %1
%34 = phi i32 [ -1, %1 ], [ -1, %25 ], [ %32, %30 ]
ret i32 %34
}