#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 timeval {
  double tv_usec;
  scalar_t__ tv_sec;
};
struct rusage {
  struct timeval ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, scalar_t__);
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ main_prg(int, char **);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  struct rusage u;
  struct timeval start, end;
  getrusage(RUSAGE_SELF, &u);
  start = u.ru_utime;
  main_prg(argc, argv);
  getrusage(RUSAGE_SELF, &u);
  end = u.ru_utime;
  fprintf(stderr, "%lf\n",
          (end.tv_sec - start.tv_sec) + (end.tv_usec - start.tv_usec) * 1.0E-6);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1040 <getrusage@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <main_prg@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
call   1040 <getrusage@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    0x2e43(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rax
sub    -0x28(%rbp),%rax
cvtsi2sd %rax,%xmm1
movsd  -0x40(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  0xe42(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdx
lea    0xe36(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2e90(%rip),%r15
mov    (%r15),%edi
lea    0x8(%rsp),%r14
mov    %r14,%rsi
call   1040 <getrusage@plt>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
mov    0x10(%rsp),%r12
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <main_prg@plt>
mov    (%r15),%edi
mov    %r14,%rsi
call   1040 <getrusage@plt>
movsd  0x8(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
mov    0x10(%rsp),%rax
sub    %r12,%rax
mov    0x2e47(%rip),%rcx
cvtsi2sd %rax,%xmm1
mulsd  0xe5a(%rip),%xmm0
mov    (%rcx),%edi
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdx
lea    0xe50(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.timeval }
%struct.timeval = type { double, i64 }
@RUSAGE_SELF = global i32 0
@stderr = global i32 0
@.str = [5 x i8] c"%lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.rusage
%7 = alloca %struct.timeval
%8 = alloca %struct.timeval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @RUSAGE_SELF
%10 = call i32 @getrusage(i32 %9, %struct.rusage* %6)
%11 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 0
%12 = bitcast %struct.timeval* %7 to i8*
%13 = bitcast %struct.timeval* %11 to i8*
%14 = load i32, i32* %4
%15 = load i8**, i8*** %5
%16 = call i32 @main_prg(i32 %14, i8** %15)
%17 = load i32, i32* @RUSAGE_SELF
%18 = call i32 @getrusage(i32 %17, %struct.rusage* %6)
%19 = getelementptr inbounds %struct.rusage, %struct.rusage* %6, i32 0, i32 0
%20 = bitcast %struct.timeval* %8 to i8*
%21 = bitcast %struct.timeval* %19 to i8*
%22 = load i32, i32* @stderr
%23 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%24 = load i64, i64* %23
%25 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%26 = load i64, i64* %25
%27 = sub nsw i64 %24, %26
%28 = sitofp i64 %27 to double
%29 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%30 = load double, double* %29
%31 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%32 = load double, double* %31
%33 = fsub double %30, %32
%34 = call double @llvm.fmuladd.f64(double %33, double 0x3EB0C6F7A0B5ED8D, double %28)
%35 = fptosi double %34 to i64
%36 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %35)
ret i32 0
}

LLVM IR (-O2):
%struct.rusage = type { %struct.timeval }
%struct.timeval = type { double, i64 }
@RUSAGE_SELF = global i32 0
@stderr = global i32 0
@.str = [5 x i8] c"%lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.rusage
%4 = bitcast %struct.rusage* %3 to i8*
%5 = load i32, i32* @RUSAGE_SELF
%6 = call i32 @getrusage(i32 %5, %struct.rusage* %3)
%7 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0, i32 0
%8 = load double, double* %7
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i64 0, i32 0, i32 1
%10 = load i64, i64* %9
%11 = call i32 @main_prg(i32 %0, i8** %1)
%12 = load i32, i32* @RUSAGE_SELF
%13 = call i32 @getrusage(i32 %12, %struct.rusage* %3)
%14 = load double, double* %7
%15 = load i64, i64* %9
%16 = load i32, i32* @stderr
%17 = sub nsw i64 %15, %10
%18 = sitofp i64 %17 to double
%19 = fsub double %14, %8
%20 = call double @llvm.fmuladd.f64(double %19, double 0x3EB0C6F7A0B5ED8D, double %18)
%21 = fptosi double %20 to i64
%22 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %21)
ret i32 0
}