#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 getint(char const **);
int getsigned(char const **);
int getoff(const char **p) {
  int off = 3600 * getsigned(p);
  if (**p == ':') {
    ++*p;
    off += 60 * getint(p);
    if (**p == ':') {
      ++*p;
      off += getint(p);
    }
  }
  return off;
}


x86 assembly (clang, -O0):
<getoff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getsigned@plt>
imul   $0xe10,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    11a6 <getoff+0x86>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <getint@plt>
imul   $0x3c,%eax,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    11a1 <getoff+0x81>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <getint@plt>
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <getoff+0x86>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getoff>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <getsigned@plt>
imul   $0xe10,%eax,%ebp
mov    (%rbx),%rax
cmpb   $0x3a,(%rax)
jne    1166 <getoff+0x46>
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
call   1030 <getint@plt>
imul   $0x3c,%eax,%eax
add    %eax,%ebp
mov    (%rbx),%rax
cmpb   $0x3a,(%rax)
jne    1166 <getoff+0x46>
add    $0x1,%rax
mov    %rax,(%rbx)
mov    %rbx,%rdi
call   1030 <getint@plt>
add    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @getoff(i8** %0) {
%2 = tail call i32 @getsigned(i8** %0)
%3 = mul nsw i32 %2, 3600
%4 = load i8*, i8** %0
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 58
br i1 %6, label %7, label %19
7: ; preds = %1
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8* %8, i8** %0
%9 = tail call i32 @getint(i8** %0)
%10 = mul nsw i32 %9, 60
%11 = add nsw i32 %10, %3
%12 = load i8*, i8** %0
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 58
br i1 %14, label %15, label %19
15: ; preds = %7
%16 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %16, i8** %0
%17 = tail call i32 @getint(i8** %0)
%18 = add nsw i32 %17, %11
br label %19
19: ; preds = %7, %15, %1
%20 = phi i32 [ %18, %15 ], [ %11, %7 ], [ %3, %1 ]
ret i32 %20
}