#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 tms {
  int tms_utime;
};

/* Variables and functions */
int /*<<< orphan*/ _SC_CLK_TCK;
int sysconf(int /*<<< orphan*/);
int /*<<< orphan*/ times(struct tms *);
float time_used() {
  struct tms now;
  int sec, hun;
  float total;
  int clocks_per_second = 0;
  clocks_per_second = sysconf(_SC_CLK_TCK);
  times(&now);
  hun = ((now.tms_utime % clocks_per_second) * 100) / clocks_per_second;
  sec = (now.tms_utime / clocks_per_second);
  total = (float)sec + ((float)(hun) / 100.0);
  return (total);
}


x86 assembly (clang, -O0):
<time_used>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x18(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
mov    %eax,-0x18(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <times@plt>
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
imul   $0x64,%edx,%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe82(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_used>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
call   1040 <sysconf@plt>
mov    %eax,%ebx
lea    0x8(%rsp),%rdi
call   1030 <times@plt>
mov    0x8(%rsp),%eax
cltd
idiv   %ebx
mov    %eax,%ecx
imul   $0x64,%edx,%eax
cltd
cvtsi2ss %ecx,%xmm0
idiv   %ebx
cvtsi2ss %eax,%xmm1
cvtss2sd %xmm1,%xmm1
divsd  0xe9e(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
addsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tms = type { i32 }
@_SC_CLK_TCK = global i32 0
define float @time_used() {
%1 = alloca %struct.tms
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
store i32 0, i32* %5
%6 = load i32, i32* @_SC_CLK_TCK
%7 = call i32 @sysconf(i32 %6)
store i32 %7, i32* %5
%8 = call i32 @times(%struct.tms* %1)
%9 = getelementptr inbounds %struct.tms, %struct.tms* %1, i32 0, i32 0
%10 = load i32, i32* %9
%11 = load i32, i32* %5
%12 = srem i32 %10, %11
%13 = mul nsw i32 %12, 100
%14 = load i32, i32* %5
%15 = sdiv i32 %13, %14
store i32 %15, i32* %3
%16 = getelementptr inbounds %struct.tms, %struct.tms* %1, i32 0, i32 0
%17 = load i32, i32* %16
%18 = load i32, i32* %5
%19 = sdiv i32 %17, %18
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = sitofp i32 %20 to float
%22 = fpext float %21 to double
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to float
%25 = fpext float %24 to double
%26 = fdiv double %25, 1.000000e+02
%27 = fadd double %22, %26
%28 = fptrunc double %27 to float
store float %28, float* %4
%29 = load float, float* %4
ret float %29
}

LLVM IR (-O2):
%struct.tms = type { i32 }
@_SC_CLK_TCK = global i32 0
define float @time_used() {
%1 = alloca %struct.tms
%2 = bitcast %struct.tms* %1 to i8*
%3 = load i32, i32* @_SC_CLK_TCK
%4 = tail call i32 @sysconf(i32 %3)
%5 = call i32 @times(%struct.tms* %1)
%6 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = srem i32 %7, %4
%9 = mul nsw i32 %8, 100
%10 = sdiv i32 %9, %4
%11 = sdiv i32 %7, %4
%12 = sitofp i32 %11 to float
%13 = fpext float %12 to double
%14 = sitofp i32 %10 to float
%15 = fpext float %14 to double
%16 = fdiv double %15, 1.000000e+02
%17 = fadd double %16, %13
%18 = fptrunc double %17 to float
ret float %18
}