#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 */
struct tm {
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(long *);
long time(int /*<<< orphan*/ *);
float getCurrentTime(void) {
  struct tm time_str;
  long currTime = time(NULL);
  time_str = *localtime(&currTime);
  int n = time_str.tm_hour;
  float timeVal = n * 3600;
  n = time_str.tm_min;
  timeVal += n * 60;
  n = time_str.tm_sec;
  timeVal += n;
  return timeVal;
}


x86 assembly (clang, -O0):
<getCurrentTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
imul   $0xe10,-0x1c(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
imul   $0x3c,-0x1c(%rbp),%eax
cvtsi2ss %eax,%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cvtsi2ssl -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCurrentTime>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1030 <localtime@plt>
imul   $0xe10,(%rax),%ecx
cvtsi2ss %ecx,%xmm0
imul   $0x3c,0x4(%rax),%ecx
cvtsi2ss %ecx,%xmm1
addss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsi2ssl 0x8(%rax),%xmm0
addss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
define float @getCurrentTime() {
%1 = alloca %struct.tm
%2 = alloca i64
%3 = alloca i32
%4 = alloca float
%5 = call i64 @time(i32* null)
store i64 %5, i64* %2
%6 = call %struct.tm* @localtime(i64* %2)
%7 = bitcast %struct.tm* %1 to i8*
%8 = bitcast %struct.tm* %6 to i8*
%9 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 0
%10 = load i32, i32* %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 3600
%13 = sitofp i32 %12 to float
store float %13, float* %4
%14 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 1
%15 = load i32, i32* %14
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = mul nsw i32 %16, 60
%18 = sitofp i32 %17 to float
%19 = load float, float* %4
%20 = fadd float %19, %18
store float %20, float* %4
%21 = getelementptr inbounds %struct.tm, %struct.tm* %1, i32 0, i32 2
%22 = load i32, i32* %21
store i32 %22, i32* %3
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to float
%25 = load float, float* %4
%26 = fadd float %25, %24
store float %26, float* %4
%27 = load float, float* %4
ret float %27
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
define float @getCurrentTime() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = tail call i64 @time(i32* null)
store i64 %3, i64* %1
%4 = call %struct.tm* @localtime(i64* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%10 = load i32, i32* %9
%11 = mul nsw i32 %6, 3600
%12 = sitofp i32 %11 to float
%13 = mul nsw i32 %8, 60
%14 = sitofp i32 %13 to float
%15 = fadd float %12, %14
%16 = sitofp i32 %10 to float
%17 = fadd float %15, %16
ret float %17
}