#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 sscanf(char *, char *, int *);
int decodeTimer(char *timer) {
  int value;
  if (1 == sscanf(timer, "%x", &value)) {
    if (value < 64) {
      return value;
    } else if (value < 128) {
      return (value - 64) * 60;
    } else if (value < 160) {
      return (value - 128) * 3600;
    } else {
      return (value - 160) * 3600 * 24;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<decodeTimer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    11ae <decodeTimer+0x9e>
cmpl   $0x40,-0x14(%rbp)
jge    1154 <decodeTimer+0x44>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11b5 <decodeTimer+0xa5>
cmpl   $0x80,-0x14(%rbp)
jge    1172 <decodeTimer+0x62>
mov    -0x14(%rbp),%eax
sub    $0x40,%eax
imul   $0x3c,%eax,%eax
mov    %eax,-0x4(%rbp)
jmp    11b5 <decodeTimer+0xa5>
cmpl   $0xa0,-0x14(%rbp)
jge    1195 <decodeTimer+0x85>
mov    -0x14(%rbp),%eax
sub    $0x80,%eax
imul   $0xe10,%eax,%eax
mov    %eax,-0x4(%rbp)
jmp    11b5 <decodeTimer+0xa5>
mov    -0x14(%rbp),%eax
sub    $0xa0,%eax
imul   $0xe10,%eax,%eax
imul   $0x18,%eax,%eax
mov    %eax,-0x4(%rbp)
jmp    11b5 <decodeTimer+0xa5>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decodeTimer>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
jne    1162 <decodeTimer+0x52>
mov    0x4(%rsp),%eax
cmp    $0x40,%eax
jl     1162 <decodeTimer+0x52>
cmp    $0x7f,%eax
ja     1143 <decodeTimer+0x33>
imul   $0x3c,%eax,%eax
add    $0xfffff100,%eax
pop    %rcx
ret
cmp    $0x9f,%eax
ja     1157 <decodeTimer+0x47>
imul   $0xe10,%eax,%eax
add    $0xfff8f800,%eax
pop    %rcx
ret
imul   $0x15180,%eax,%eax
add    $0xff2d1000,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%x\00"
define i32 @decodeTimer(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = icmp eq i32 1, %6
br i1 %7, label %8, label %32
8: ; preds = %1
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 64
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = load i32, i32* %4
store i32 %12, i32* %2
br label %33
13: ; preds = %8
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 128
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 64
%19 = mul nsw i32 %18, 60
store i32 %19, i32* %2
br label %33
20: ; preds = %13
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 160
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 128
%26 = mul nsw i32 %25, 3600
store i32 %26, i32* %2
br label %33
27: ; preds = %20
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, 160
%30 = mul nsw i32 %29, 3600
%31 = mul nsw i32 %30, 24
store i32 %31, i32* %2
br label %33
32: ; preds = %1
store i32 0, i32* %2
br label %33
33: ; preds = %32, %27, %23, %16, %11
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define i32 @decodeTimer(i8* nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %22
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 64
br i1 %8, label %22, label %9
9: ; preds = %6
%10 = icmp ult i32 %7, 128
br i1 %10, label %11, label %14
11: ; preds = %9
%12 = mul nuw nsw i32 %7, 60
%13 = add nsw i32 %12, -3840
br label %22
14: ; preds = %9
%15 = icmp ult i32 %7, 160
br i1 %15, label %16, label %19
16: ; preds = %14
%17 = mul nuw nsw i32 %7, 3600
%18 = add nsw i32 %17, -460800
br label %22
19: ; preds = %14
%20 = mul i32 %7, 86400
%21 = add i32 %20, -13824000
br label %22
22: ; preds = %1, %6, %19, %16, %11
%23 = phi i32 [ %13, %11 ], [ %18, %16 ], [ %21, %19 ], [ %7, %6 ], [ 0, %1 ]
ret i32 %23
}