#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char);
int /*<<< orphan*/ stderr;
int convert_time_to_seconds(char *time_string) {
  int hours = 0;
  int minutes = 0;
  int seconds = 0;
  int total_seconds = 0;
  char *pointer;
  pointer = time_string;
  if (*pointer != '[')
    return -1;
  pointer++;
  hours += (*pointer) - '0';
  pointer++;
  hours *= 10;
  hours += (*pointer) - '0';
  pointer++;
  if (*pointer != ':') {
    fprintf(stderr, "Something wrong with hours: %c\n", *pointer);
    return -1;
  }
  pointer++;
  minutes += (*pointer) - '0';
  pointer++;
  minutes *= 10;
  minutes += (*pointer) - '0';
  pointer++;
  if (*pointer != ':') {
    fprintf(stderr, "Something wrong with minutes: %c\n", *pointer);
    return -1;
  }
  pointer++;
  seconds += (*pointer) - '0';
  pointer++;
  seconds *= 10;
  seconds += (*pointer) - '0';
  pointer++;
  if (*pointer != ']') {
    fprintf(stderr, "Something wrong with minutes: %c\n", *pointer);
    return -1;
  }
  total_seconds = (hours * 60 * 60) + (minutes * 60) + seconds;
  return total_seconds;
}


x86 assembly (clang, -O0):
<convert_time_to_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5b,%eax
je     115c <convert_time_to_seconds+0x4c>
movl   $0xffffffff,-0x4(%rbp)
jmp    12fe <convert_time_to_seconds+0x1ee>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
imul   $0xa,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     11df <convert_time_to_seconds+0xcf>
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
lea    0xe35(%rip),%rsi
movsbl (%rax),%edx
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12fe <convert_time_to_seconds+0x1ee>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
imul   $0xa,-0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     1262 <convert_time_to_seconds+0x152>
mov    0x2d9f(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
lea    0xdd2(%rip),%rsi
movsbl (%rax),%edx
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12fe <convert_time_to_seconds+0x1ee>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
imul   $0xa,-0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5d,%eax
je     12e5 <convert_time_to_seconds+0x1d5>
mov    0x2d1c(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
lea    0xd4f(%rip),%rsi
movsbl (%rax),%edx
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12fe <convert_time_to_seconds+0x1ee>
imul   $0x3c,-0x14(%rbp),%eax
imul   $0x3c,%eax,%eax
imul   $0x3c,-0x18(%rbp),%ecx
add    %ecx,%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_time_to_seconds>:
push   %rbx
mov    $0xffffffff,%ebx
cmpb   $0x5b,(%rdi)
jne    11a0 <convert_time_to_seconds+0x90>
mov    0x3(%rdi),%al
cmp    $0x3a,%al
jne    1173 <convert_time_to_seconds+0x63>
mov    0x6(%rdi),%al
cmp    $0x3a,%al
jne    1188 <convert_time_to_seconds+0x78>
mov    0x9(%rdi),%al
cmp    $0x5d,%al
jne    1188 <convert_time_to_seconds+0x78>
movsbl 0x1(%rdi),%eax
lea    (%rax,%rax,4),%eax
movsbl 0x2(%rdi),%ecx
lea    (%rcx,%rax,2),%eax
movsbl 0x4(%rdi),%ecx
lea    (%rcx,%rcx,4),%ecx
movsbl 0x5(%rdi),%edx
lea    (%rdx,%rcx,2),%ecx
movsbl 0x8(%rdi),%edx
movsbl 0x7(%rdi),%esi
lea    (%rsi,%rsi,4),%esi
imul   $0xe10,%eax,%eax
imul   $0x3c,%ecx,%ecx
add    %eax,%ecx
add    %edx,%ecx
lea    (%rcx,%rsi,2),%ebx
add    $0xffe28130,%ebx
jmp    11a0 <convert_time_to_seconds+0x90>
mov    0x2e66(%rip),%rcx
mov    (%rcx),%edi
movsbl %al,%edx
lea    0xe7a(%rip),%rsi
jmp    119b <convert_time_to_seconds+0x8b>
mov    0x2e51(%rip),%rcx
mov    (%rcx),%edi
movsbl %al,%edx
lea    0xe85(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"Something wrong with hours: %c\0A\00"
@.str.1 = [34 x i8] c"Something wrong with minutes: %c\0A\00"
define i32 @convert_time_to_seconds(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 0, i32* %7
%9 = load i8*, i8** %3
store i8* %9, i8** %8
%10 = load i8*, i8** %8
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 91
br i1 %13, label %14, label %15
14: ; preds = %1
store i32 -1, i32* %2
br label %115
15: ; preds = %1
%16 = load i8*, i8** %8
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %8
%18 = load i8*, i8** %8
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = sub nsw i32 %20, 48
%22 = load i32, i32* %4
%23 = add nsw i32 %22, %21
store i32 %23, i32* %4
%24 = load i8*, i8** %8
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %8
%26 = load i32, i32* %4
%27 = mul nsw i32 %26, 10
store i32 %27, i32* %4
%28 = load i8*, i8** %8
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 48
%32 = load i32, i32* %4
%33 = add nsw i32 %32, %31
store i32 %33, i32* %4
%34 = load i8*, i8** %8
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %8
%36 = load i8*, i8** %8
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 58
br i1 %39, label %40, label %45
40: ; preds = %15
%41 = load i32, i32* @stderr
%42 = load i8*, i8** %8
%43 = load i8, i8* %42
%44 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8 signext %43)
store i32 -1, i32* %2
br label %115
45: ; preds = %15
%46 = load i8*, i8** %8
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %8
%48 = load i8*, i8** %8
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = sub nsw i32 %50, 48
%52 = load i32, i32* %5
%53 = add nsw i32 %52, %51
store i32 %53, i32* %5
%54 = load i8*, i8** %8
%55 = getelementptr inbounds i8, i8* %54, i32 1
store i8* %55, i8** %8
%56 = load i32, i32* %5
%57 = mul nsw i32 %56, 10
store i32 %57, i32* %5
%58 = load i8*, i8** %8
%59 = load i8, i8* %58
%60 = sext i8 %59 to i32
%61 = sub nsw i32 %60, 48
%62 = load i32, i32* %5
%63 = add nsw i32 %62, %61
store i32 %63, i32* %5
%64 = load i8*, i8** %8
%65 = getelementptr inbounds i8, i8* %64, i32 1
store i8* %65, i8** %8
%66 = load i8*, i8** %8
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp ne i32 %68, 58
br i1 %69, label %70, label %75
70: ; preds = %45
%71 = load i32, i32* @stderr
%72 = load i8*, i8** %8
%73 = load i8, i8* %72
%74 = call i32 @fprintf(i32 %71, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8 signext %73)
store i32 -1, i32* %2
br label %115
75: ; preds = %45
%76 = load i8*, i8** %8
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %8
%78 = load i8*, i8** %8
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = sub nsw i32 %80, 48
%82 = load i32, i32* %6
%83 = add nsw i32 %82, %81
store i32 %83, i32* %6
%84 = load i8*, i8** %8
%85 = getelementptr inbounds i8, i8* %84, i32 1
store i8* %85, i8** %8
%86 = load i32, i32* %6
%87 = mul nsw i32 %86, 10
store i32 %87, i32* %6
%88 = load i8*, i8** %8
%89 = load i8, i8* %88
%90 = sext i8 %89 to i32
%91 = sub nsw i32 %90, 48
%92 = load i32, i32* %6
%93 = add nsw i32 %92, %91
store i32 %93, i32* %6
%94 = load i8*, i8** %8
%95 = getelementptr inbounds i8, i8* %94, i32 1
store i8* %95, i8** %8
%96 = load i8*, i8** %8
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = icmp ne i32 %98, 93
br i1 %99, label %100, label %105
100: ; preds = %75
%101 = load i32, i32* @stderr
%102 = load i8*, i8** %8
%103 = load i8, i8* %102
%104 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8 signext %103)
store i32 -1, i32* %2
br label %115
105: ; preds = %75
%106 = load i32, i32* %4
%107 = mul nsw i32 %106, 60
%108 = mul nsw i32 %107, 60
%109 = load i32, i32* %5
%110 = mul nsw i32 %109, 60
%111 = add nsw i32 %108, %110
%112 = load i32, i32* %6
%113 = add nsw i32 %111, %112
store i32 %113, i32* %7
%114 = load i32, i32* %7
store i32 %114, i32* %2
br label %115
115: ; preds = %105, %100, %70, %40, %14
%116 = load i32, i32* %2
ret i32 %116
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Something wrong with hours: %c\0A\00"
@.str.1 = [34 x i8] c"Something wrong with minutes: %c\0A\00"
define i32 @convert_time_to_seconds(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 91
br i1 %3, label %4, label %55
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = mul nsw i32 %7, 10
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = add nsw i32 %9, %11
%13 = getelementptr inbounds i8, i8* %0, i64 3
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 58
br i1 %15, label %19, label %16
16: ; preds = %4
%17 = load i32, i32* @stderr
%18 = tail call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8 signext %14)
br label %55
19: ; preds = %4
%20 = getelementptr inbounds i8, i8* %0, i64 4
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = getelementptr inbounds i8, i8* %0, i64 5
%24 = mul nsw i32 %22, 10
%25 = load i8, i8* %23
%26 = sext i8 %25 to i32
%27 = add nsw i32 %24, %26
%28 = getelementptr inbounds i8, i8* %0, i64 6
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 58
br i1 %30, label %34, label %31
31: ; preds = %19
%32 = load i32, i32* @stderr
%33 = tail call i32 @fprintf(i32 %32, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8 signext %29)
br label %55
34: ; preds = %19
%35 = getelementptr inbounds i8, i8* %0, i64 9
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 93
br i1 %37, label %41, label %38
38: ; preds = %34
%39 = load i32, i32* @stderr
%40 = tail call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8 signext %36)
br label %55
41: ; preds = %34
%42 = getelementptr inbounds i8, i8* %0, i64 8
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = getelementptr inbounds i8, i8* %0, i64 7
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = mul nsw i32 %47, 10
%49 = mul nsw i32 %12, 3600
%50 = mul nsw i32 %27, 60
%51 = add nsw i32 %49, -1933008
%52 = add nsw i32 %51, %50
%53 = add nsw i32 %52, %44
%54 = add nsw i32 %53, %48
br label %55
55: ; preds = %1, %41, %38, %31, %16
%56 = phi i32 [ -1, %16 ], [ -1, %31 ], [ -1, %38 ], [ %54, %41 ], [ -1, %1 ]
ret i32 %56
}