#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 */
scalar_t__ atoi(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
double timeToHours(int x) {
  char total[7];
  char hoursHand[3];
  char min[3];
  char sec[3];
  double hours;
  int j = 0;
  int i = 0;
  char check[7];
  sprintf(total, "%d", x);
  if (strlen(total) == 5) {
    strcpy(check, total);
    total[0] = '0';
    for (i = 0; i < strlen(check); i++) {
      total[i + 1] = check[i];
    }
  } else if (strlen(total) == 4) {
    strcpy(check, total);
    total[0] = '0';
    total[1] = '0';
    for (i = 0; i < strlen(check); i++) {
      total[i + 2] = check[i];
    }
  }
  for (i = 0; i <= 1; i++) {
    hoursHand[j] = total[i];
    j++;
  }
  hoursHand[2] = '\0';
  j = 0;
  for (i = 2; i <= 3; i++) {
    min[j] = total[i];
    j++;
  }
  min[2] = '\0';
  j = 0;
  for (i = 4; i <= 5; i++) {
    sec[j] = total[i];
    j++;
  }
  sec[2] = '\0';
  j = 0;
  hours = (double)(atoi(hoursHand) + (((double)atoi(min)) / 60) +
                   (((double)atoi(sec)) / 3600));
  return (hours);
}


x86 assembly (clang, -O0):
<timeToHours>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
lea    -0xb(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xea9(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0xb(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x5,%eax
jne    11d9 <timeToHours+0x99>
lea    -0x2f(%rbp),%rdi
lea    -0xb(%rbp),%rsi
call   1030 <strcpy@plt>
movb   $0x30,-0xb(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x34(%rbp)
lea    -0x2f(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
cmp    %ecx,%eax
jge    11d4 <timeToHours+0x94>
movslq -0x28(%rbp),%rax
mov    -0x2f(%rbp,%rax,1),%cl
mov    -0x28(%rbp),%eax
add    $0x1,%eax
cltq
mov    %cl,-0xb(%rbp,%rax,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1196 <timeToHours+0x56>
jmp    124f <timeToHours+0x10f>
lea    -0xb(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
jne    124a <timeToHours+0x10a>
lea    -0x2f(%rbp),%rdi
lea    -0xb(%rbp),%rsi
call   1030 <strcpy@plt>
movb   $0x30,-0xb(%rbp)
movb   $0x30,-0xa(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x38(%rbp)
lea    -0x2f(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jge    1245 <timeToHours+0x105>
movslq -0x28(%rbp),%rax
mov    -0x2f(%rbp,%rax,1),%cl
mov    -0x28(%rbp),%eax
add    $0x2,%eax
cltq
mov    %cl,-0xb(%rbp,%rax,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1207 <timeToHours+0xc7>
jmp    124a <timeToHours+0x10a>
jmp    124f <timeToHours+0x10f>
movl   $0x0,-0x28(%rbp)
cmpl   $0x1,-0x28(%rbp)
jg     1287 <timeToHours+0x147>
movslq -0x28(%rbp),%rax
mov    -0xb(%rbp,%rax,1),%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0xe(%rbp,%rax,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1256 <timeToHours+0x116>
movb   $0x0,-0xc(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x2,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jg     12ca <timeToHours+0x18a>
movslq -0x28(%rbp),%rax
mov    -0xb(%rbp,%rax,1),%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0x11(%rbp,%rax,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1299 <timeToHours+0x159>
movb   $0x0,-0xf(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x4,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jg     130d <timeToHours+0x1cd>
movslq -0x28(%rbp),%rax
mov    -0xb(%rbp,%rax,1),%cl
movslq -0x24(%rbp),%rax
mov    %cl,-0x14(%rbp,%rax,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    12dc <timeToHours+0x19c>
movb   $0x0,-0x12(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0xe(%rbp),%rdi
call   1050 <atoi@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    -0x11(%rbp),%rdi
call   1050 <atoi@plt>
movsd  -0x48(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
movsd  0xcc2(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <atoi@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
movsd  0xc92(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeToHours>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %edi,%edx
lea    0xec0(%rip),%rsi
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x5,%eax
jne    11be <timeToHours+0x7e>
lea    0x19(%rsp),%rbx
lea    0x6(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
movb   $0x30,0x6(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    121c <timeToHours+0xdc>
xor    %ebx,%ebx
lea    0x19(%rsp),%r14
nopl   0x0(%rax,%rax,1)
movzbl 0x19(%rsp,%rbx,1),%eax
mov    %al,0x7(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11a0 <timeToHours+0x60>
jmp    121c <timeToHours+0xdc>
lea    0x6(%rsp),%rdi
call   1040 <strlen@plt>
cmp    $0x4,%eax
jne    121c <timeToHours+0xdc>
lea    0x19(%rsp),%rbx
lea    0x6(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
movw   $0x3030,0x6(%rsp)
mov    %rbx,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    121c <timeToHours+0xdc>
xor    %ebx,%ebx
lea    0x19(%rsp),%r14
nopl   0x0(%rax)
movzbl 0x19(%rsp,%rbx,1),%eax
mov    %al,0x8(%rsp,%rbx,1)
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1200 <timeToHours+0xc0>
movzwl 0x6(%rsp),%eax
movzwl 0x8(%rsp),%ecx
mov    %ax,0x16(%rsp)
movb   $0x0,0x18(%rsp)
mov    %cx,0x12(%rsp)
movb   $0x0,0x14(%rsp)
movzwl 0xa(%rsp),%eax
mov    %ax,0xe(%rsp)
movb   $0x0,0x10(%rsp)
lea    0x16(%rsp),%rdi
call   1050 <atoi@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0x12(%rsp),%rdi
call   1050 <atoi@plt>
mov    %rax,%rbx
lea    0xe(%rsp),%rdi
call   1050 <atoi@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
cvtsi2sd %rax,%xmm1
unpcklpd %xmm1,%xmm0
divpd  0xd72(%rip),%xmm0
movsd  0x20(%rsp),%xmm1
addsd  %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define double @timeToHours(i32 %0) {
%2 = alloca i32
%3 = alloca [7 x i8]
%4 = alloca [3 x i8]
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca [7 x i8]
store i32 %0, i32* %2
store i32 0, i32* %8
store i32 0, i32* %9
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* %2
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = icmp eq i32 %15, 5
br i1 %16, label %17, label %40
17: ; preds = %1
%18 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 0
%19 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%20 = call i32 @strcpy(i8* %18, i8* %19)
%21 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
store i8 48, i8* %21
store i32 0, i32* %9
br label %22
22: ; preds = %36, %17
%23 = load i32, i32* %9
%24 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 0
%25 = call i32 @strlen(i8* %24)
%26 = icmp slt i32 %23, %25
br i1 %26, label %27, label %39
27: ; preds = %22
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %34
store i8 %31, i8* %35
br label %36
36: ; preds = %27
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
br label %22
39: ; preds = %22
br label %69
40: ; preds = %1
%41 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%42 = call i32 @strlen(i8* %41)
%43 = icmp eq i32 %42, 4
br i1 %43, label %44, label %68
44: ; preds = %40
%45 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 0
%46 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%47 = call i32 @strcpy(i8* %45, i8* %46)
%48 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
store i8 48, i8* %48
%49 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 1
store i8 48, i8* %49
store i32 0, i32* %9
br label %50
50: ; preds = %64, %44
%51 = load i32, i32* %9
%52 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 0
%53 = call i32 @strlen(i8* %52)
%54 = icmp slt i32 %51, %53
br i1 %54, label %55, label %67
55: ; preds = %50
%56 = load i32, i32* %9
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 0, i64 %57
%59 = load i8, i8* %58
%60 = load i32, i32* %9
%61 = add nsw i32 %60, 2
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %62
store i8 %59, i8* %63
br label %64
64: ; preds = %55
%65 = load i32, i32* %9
%66 = add nsw i32 %65, 1
store i32 %66, i32* %9
br label %50
67: ; preds = %50
br label %68
68: ; preds = %67, %40
br label %69
69: ; preds = %68, %39
store i32 0, i32* %9
br label %70
70: ; preds = %83, %69
%71 = load i32, i32* %9
%72 = icmp sle i32 %71, 1
br i1 %72, label %73, label %86
73: ; preds = %70
%74 = load i32, i32* %9
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %75
%77 = load i8, i8* %76
%78 = load i32, i32* %8
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 %79
store i8 %77, i8* %80
%81 = load i32, i32* %8
%82 = add nsw i32 %81, 1
store i32 %82, i32* %8
br label %83
83: ; preds = %73
%84 = load i32, i32* %9
%85 = add nsw i32 %84, 1
store i32 %85, i32* %9
br label %70
86: ; preds = %70
%87 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 0, i8* %87
store i32 0, i32* %8
store i32 2, i32* %9
br label %88
88: ; preds = %101, %86
%89 = load i32, i32* %9
%90 = icmp sle i32 %89, 3
br i1 %90, label %91, label %104
91: ; preds = %88
%92 = load i32, i32* %9
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %93
%95 = load i8, i8* %94
%96 = load i32, i32* %8
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 %97
store i8 %95, i8* %98
%99 = load i32, i32* %8
%100 = add nsw i32 %99, 1
store i32 %100, i32* %8
br label %101
101: ; preds = %91
%102 = load i32, i32* %9
%103 = add nsw i32 %102, 1
store i32 %103, i32* %9
br label %88
104: ; preds = %88
%105 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 2
store i8 0, i8* %105
store i32 0, i32* %8
store i32 4, i32* %9
br label %106
106: ; preds = %119, %104
%107 = load i32, i32* %9
%108 = icmp sle i32 %107, 5
br i1 %108, label %109, label %122
109: ; preds = %106
%110 = load i32, i32* %9
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 %111
%113 = load i8, i8* %112
%114 = load i32, i32* %8
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 %115
store i8 %113, i8* %116
%117 = load i32, i32* %8
%118 = add nsw i32 %117, 1
store i32 %118, i32* %8
br label %119
119: ; preds = %109
%120 = load i32, i32* %9
%121 = add nsw i32 %120, 1
store i32 %121, i32* %9
br label %106
122: ; preds = %106
%123 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 2
store i8 0, i8* %123
store i32 0, i32* %8
%124 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%125 = call i64 @atoi(i8* %124)
%126 = sitofp i64 %125 to double
%127 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%128 = call i64 @atoi(i8* %127)
%129 = sitofp i64 %128 to double
%130 = fdiv double %129, 6.000000e+01
%131 = fadd double %126, %130
%132 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%133 = call i64 @atoi(i8* %132)
%134 = sitofp i64 %133 to double
%135 = fdiv double %134, 3.600000e+03
%136 = fadd double %131, %135
store double %136, double* %7
%137 = load double, double* %7
ret double %137
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define double @timeToHours(i32 %0) {
%2 = alloca [7 x i8]
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
%5 = alloca [3 x i8]
%6 = alloca [7 x i8]
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 0
%12 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%13 = call i32 @strlen(i8* %7)
%14 = icmp eq i32 %13, 5
br i1 %14, label %15, label %28
15: ; preds = %1
%16 = call i32 @strcpy(i8* %11, i8* %7)
store i8 48, i8* %7
%17 = call i32 @strlen(i8* %11)
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %46
19: ; preds = %15, %19
%20 = phi i64 [ %23, %19 ], [ 0, %15 ]
%21 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 %20
%22 = load i8, i8* %21
%23 = add nuw nsw i64 %20, 1
%24 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %23
store i8 %22, i8* %24
%25 = call i32 @strlen(i8* %11)
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %23, %26
br i1 %27, label %19, label %46
28: ; preds = %1
%29 = call i32 @strlen(i8* %7)
%30 = icmp eq i32 %29, 4
br i1 %30, label %31, label %46
31: ; preds = %28
%32 = call i32 @strcpy(i8* %11, i8* %7)
store i8 48, i8* %7
%33 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 1
store i8 48, i8* %33
%34 = call i32 @strlen(i8* %11)
%35 = icmp sgt i32 %34, 0
br i1 %35, label %36, label %46
36: ; preds = %31, %36
%37 = phi i64 [ %42, %36 ], [ 0, %31 ]
%38 = getelementptr inbounds [7 x i8], [7 x i8]* %6, i64 0, i64 %37
%39 = load i8, i8* %38
%40 = add nuw nsw i64 %37, 2
%41 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 %40
store i8 %39, i8* %41
%42 = add nuw nsw i64 %37, 1
%43 = call i32 @strlen(i8* %11)
%44 = sext i32 %43 to i64
%45 = icmp slt i64 %42, %44
br i1 %45, label %36, label %46
46: ; preds = %36, %19, %31, %15, %28
%47 = bitcast [7 x i8]* %2 to i16*
%48 = bitcast [3 x i8]* %3 to i16*
%49 = load i16, i16* %47
store i16 %49, i16* %48
%50 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 0, i8* %50
%51 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 2
%52 = bitcast i8* %51 to i16*
%53 = bitcast [3 x i8]* %4 to i16*
%54 = load i16, i16* %52
store i16 %54, i16* %53
%55 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 2
store i8 0, i8* %55
%56 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 4
%57 = bitcast i8* %56 to i16*
%58 = bitcast [3 x i8]* %5 to i16*
%59 = load i16, i16* %57
store i16 %59, i16* %58
%60 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 2
store i8 0, i8* %60
%61 = call i64 @atoi(i8* %8)
%62 = sitofp i64 %61 to double
%63 = call i64 @atoi(i8* %9)
%64 = call i64 @atoi(i8* %10)
%65 = insertelement <2 x i64> poison, i64 %63, i64 0
%66 = insertelement <2 x i64> %65, i64 %64, i64 1
%67 = sitofp <2 x i64> %66 to <2 x double>
%68 = fdiv <2 x double> %67, <double 6.000000e+01, double 3.600000e+03>
%69 = extractelement <2 x double> %68, i64 0
%70 = fadd double %69, %62
%71 = extractelement <2 x double> %68, i64 1
%72 = fadd double %70, %71
ret double %72
}