#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 timezone {
  int dummy;
};
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int gettimeofday(struct timeval *, struct timezone *);
int /*<<< orphan*/ perror(char *);
double cclock_r8_() {
  static double c0 = 1.0e-06;
  struct timeval tp;
  struct timezone tzp;
  double wall_time;
  if (gettimeofday(&tp, &tzp) == -1)
    perror("gettimeofday");
  wall_time = tp.tv_sec + c0 * tp.tv_usec;
  return (wall_time);
}


x86 assembly (clang, -O0):
<cclock_r8_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
jne    114a <cclock_r8_+0x2a>
lea    0xebb(%rip),%rdi
call   1040 <perror@plt>
movsd  -0x10(%rbp),%xmm1
movsd  0x2ed9(%rip),%xmm0
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cclock_r8_>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
je     114f <cclock_r8_+0x2f>
movsd  0x10(%rsp),%xmm0
mulsd  0xebc(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret
lea    0xeb2(%rip),%rdi
call   1040 <perror@plt>
jmp    1136 <cclock_r8_+0x16>

LLVM IR (-O0):
%struct.timeval = type { double, double }
%struct.timezone = type { i32 }
@cclock_r8_.c0 = internal global double 0x3EB0C6F7A0B5ED8D
@.str = [13 x i8] c"gettimeofday\00"
define double @cclock_r8_() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = alloca double
%4 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%10 = load double, double* %9
%11 = load double, double* @cclock_r8_.c0
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%13 = load double, double* %12
%14 = call double @llvm.fmuladd.f64(double %11, double %13, double %10)
store double %14, double* %3
%15 = load double, double* %3
ret double %15
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
%struct.timezone = type { i32 }
@.str = [13 x i8] c"gettimeofday\00"
define double @cclock_r8_() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%11 = load double, double* %10
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%13 = load double, double* %12
%14 = tail call double @llvm.fmuladd.f64(double %13, double 0x3EB0C6F7A0B5ED8D, double %11)
ret double %14
}