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

/* Variables and functions */
int /*<<< orphan*/ times(struct tms *);
double Time_F(int s) {
  double ret;
  static struct tms tstart, tend;
  if (s == 0) {
    times(&tstart);
    return (0);
  } else {
    times(&tend);
    ret = ((double)(tend.tms_utime - tstart.tms_utime)) / 100.0;
    return ((ret < 1e-3) ? 1e-3 : ret);
  }
}


x86 assembly (clang, -O0):
<Time_F>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    113e <Time_F+0x2e>
lea    0x2f04(%rip),%rdi
call   1030 <times@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11a7 <Time_F+0x97>
lea    0x2ef3(%rip),%rdi
call   1030 <times@plt>
mov    0x2ee7(%rip),%rax
sub    0x2ed8(%rip),%rax
cvtsi2sd %rax,%xmm0
movsd  0xea3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe8a(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1193 <Time_F+0x83>
movsd  0xe77(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    119d <Time_F+0x8d>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Time_F>:
push   %rax
test   %edi,%edi
je     114a <Time_F+0x3a>
lea    0x2f1c(%rip),%rdi
call   1030 <times@plt>
mov    0x2f10(%rip),%rax
sub    0x2f01(%rip),%rax
cvtsi2sd %rax,%xmm1
divsd  0xec4(%rip),%xmm1
movsd  0xec4(%rip),%xmm0
maxsd  %xmm1,%xmm0
pop    %rax
ret
lea    0x2edf(%rip),%rdi
call   1030 <times@plt>
xorps  %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.tms = type { i64 }
@Time_F.tstart = internal global %struct.tms zeroinitializer
@Time_F.tend = internal global %struct.tms zeroinitializer
define double @Time_F(i32 %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @times(%struct.tms* @Time_F.tstart)
store double 0.000000e+00, double* %2
br label %23
9: ; preds = %1
%10 = call i32 @times(%struct.tms* @Time_F.tend)
%11 = load i64, i64* getelementptr inbounds (%struct.tms, %struct.tms* @Time_F.tend, i32 0, i32 0)
%12 = load i64, i64* getelementptr inbounds (%struct.tms, %struct.tms* @Time_F.tstart, i32 0, i32 0)
%13 = sub nsw i64 %11, %12
%14 = sitofp i64 %13 to double
%15 = fdiv double %14, 1.000000e+02
store double %15, double* %4
%16 = load double, double* %4
%17 = fcmp olt double %16, 1.000000e-03
br i1 %17, label %18, label %19
18: ; preds = %9
br label %21
19: ; preds = %9
%20 = load double, double* %4
br label %21
21: ; preds = %19, %18
%22 = phi double [ 1.000000e-03, %18 ], [ %20, %19 ]
store double %22, double* %2
br label %23
23: ; preds = %21, %7
%24 = load double, double* %2
ret double %24
}

LLVM IR (-O2):
%struct.tms = type { i64 }
@Time_F.tstart = internal global %struct.tms zeroinitializer
@Time_F.tend = internal global %struct.tms zeroinitializer
define double @Time_F(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @times(%struct.tms* @Time_F.tstart)
br label %14
5: ; preds = %1
%6 = tail call i32 @times(%struct.tms* @Time_F.tend)
%7 = load i64, i64* getelementptr inbounds (%struct.tms, %struct.tms* @Time_F.tend, i64 0, i32 0)
%8 = load i64, i64* getelementptr inbounds (%struct.tms, %struct.tms* @Time_F.tstart, i64 0, i32 0)
%9 = sub nsw i64 %7, %8
%10 = sitofp i64 %9 to double
%11 = fdiv double %10, 1.000000e+02
%12 = fcmp olt double %11, 1.000000e-03
%13 = select i1 %12, double 1.000000e-03, double %11
br label %14
14: ; preds = %5, %3
%15 = phi double [ 0.000000e+00, %3 ], [ %13, %5 ]
ret double %15
}