#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct TYPE_3__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct rusage {
  TYPE_2__ ru_stime;
  TYPE_1__ ru_utime;
};

/* Variables and functions */
int /*<<< orphan*/ RUSAGE_SELF;
int /*<<< orphan*/ getrusage(int /*<<< orphan*/, struct rusage *);
int /*<<< orphan*/ printf(char *, long double, ...);
int main(void) {
  struct rusage startusage, endusage;
  long double utime, stime, ttime;
  long double rate;
  int a, b;
  getrusage(RUSAGE_SELF, &startusage);
  for (a = 0; a < 100000; a++) {
    for (b = 0; b < 100000; b++) {
      ;
    }
  }
  getrusage(RUSAGE_SELF, &endusage);
  utime = (long double)endusage.ru_utime.tv_sec +
          ((long double)endusage.ru_utime.tv_usec / 1000000) -
          (long double)startusage.ru_utime.tv_sec +
          ((long double)startusage.ru_utime.tv_usec / 1000000);
  stime = (long double)endusage.ru_stime.tv_sec +
          ((long double)endusage.ru_stime.tv_usec / 1000000) -
          (long double)startusage.ru_stime.tv_sec +
          ((long double)startusage.ru_stime.tv_usec / 1000000);
  ttime = utime + stime;
  rate = 10000000000 / (ttime * 1000 * 1000);
  printf("%.2Lf loops per nanosecond ", rate);
  printf("(%.2Lfs user, %.2Lfs sys, %.2Lfs total)\n", utime, stime, ttime);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1040 <getrusage@plt>
movl   $0x0,-0x94(%rbp)
cmpl   $0x186a0,-0x94(%rbp)
jge    11aa <main+0x8a>
movl   $0x0,-0x98(%rbp)
cmpl   $0x186a0,-0x98(%rbp)
jge    1191 <main+0x71>
jmp    117d <main+0x5d>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    1168 <main+0x48>
jmp    1196 <main+0x76>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    114e <main+0x2e>
mov    0x2e2f(%rip),%rax
mov    (%rax),%edi
lea    -0x48(%rbp),%rsi
call   1040 <getrusage@plt>
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    %rcx,-0xc0(%rbp)
fildll -0xc0(%rbp)
mov    %rax,-0xc8(%rbp)
fildll -0xc8(%rbp)
flds   0xe1c(%rip)
fdivr  %st,%st(1)
fxch   %st(2)
faddp  %st,%st(1)
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,-0xd0(%rbp)
fildll -0xd0(%rbp)
fsubrp %st,%st(1)
mov    %rax,-0xd8(%rbp)
fildll -0xd8(%rbp)
fdiv   %st(2),%st
faddp  %st,%st(1)
fstpt  -0x60(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    %rcx,-0xa0(%rbp)
fildll -0xa0(%rbp)
mov    %rax,-0xa8(%rbp)
fildll -0xa8(%rbp)
fdiv   %st(2),%st
faddp  %st,%st(1)
mov    -0x28(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rcx,-0xb0(%rbp)
fildll -0xb0(%rbp)
fsubrp %st,%st(1)
mov    %rax,-0xb8(%rbp)
fildll -0xb8(%rbp)
fdivp  %st,%st(2)
faddp  %st,%st(1)
fstpt  -0x70(%rbp)
fldt   -0x60(%rbp)
fldt   -0x70(%rbp)
faddp  %st,%st(1)
fstpt  -0x80(%rbp)
fldt   -0x80(%rbp)
flds   0xd8a(%rip)
fmul   %st,%st(1)
fmulp  %st,%st(1)
flds   0xd84(%rip)
fdivp  %st,%st(1)
fstpt  -0x90(%rbp)
fldt   -0x90(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xd6e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
fldt   -0x60(%rbp)
fldt   -0x70(%rbp)
fldt   -0x80(%rbp)
mov    %rsp,%rax
fstpt  0x20(%rax)
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xd68(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xe0,%rsp
mov    0x2eb1(%rip),%rbx
mov    (%rbx),%edi
lea    0xc0(%rsp),%rsi
call   1040 <getrusage@plt>
mov    (%rbx),%edi
lea    0xa0(%rsp),%rsi
call   1040 <getrusage@plt>
mov    0xb8(%rsp),%rax
mov    %rax,0x38(%rsp)
fildll 0x38(%rsp)
mov    0xb0(%rsp),%rax
mov    %rax,0x40(%rsp)
fildll 0x40(%rsp)
flds   0xe8b(%rip)
fdivr  %st,%st(1)
fxch   %st(1)
faddp  %st,%st(2)
mov    0xd8(%rsp),%rax
mov    %rax,0x48(%rsp)
fildll 0x48(%rsp)
fsubrp %st,%st(2)
mov    0xd0(%rsp),%rax
mov    %rax,0x50(%rsp)
fildll 0x50(%rsp)
fdiv   %st(1),%st
faddp  %st,%st(2)
fld    %st(1)
fstpt  0x94(%rsp)
mov    0xa0(%rsp),%rax
mov    0xa8(%rsp),%rcx
mov    %rcx,0x58(%rsp)
fildll 0x58(%rsp)
mov    %rax,0x60(%rsp)
fildll 0x60(%rsp)
fdiv   %st(2),%st
faddp  %st,%st(1)
mov    0xc0(%rsp),%rax
mov    0xc8(%rsp),%rcx
mov    %rcx,0x68(%rsp)
fildll 0x68(%rsp)
fsubrp %st,%st(1)
mov    %rax,0x70(%rsp)
fildll 0x70(%rsp)
fdivp  %st,%st(2)
faddp  %st,%st(1)
fld    %st(0)
fstpt  0x88(%rsp)
faddp  %st,%st(1)
fld    %st(0)
fstpt  0x7c(%rsp)
flds   0xdf3(%rip)
fmul   %st,%st(1)
fmulp  %st,%st(1)
fdivrs 0xded(%rip)
fstpt  (%rsp)
lea    0xde7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
fldt   0x7c(%rsp)
fstpt  0x20(%rsp)
fldt   0x88(%rsp)
fstpt  0x10(%rsp)
fldt   0x94(%rsp)
fstpt  (%rsp)
lea    0xdd8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@RUSAGE_SELF = global i32 0
@.str = [28 x i8] c"%.2Lf loops per nanosecond \00"
@.str.1 = [41 x i8] c"(%.2Lfs user, %.2Lfs sys, %.2Lfs total)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.rusage
%3 = alloca %struct.rusage
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca x86_fp80
%7 = alloca x86_fp80
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = load i32, i32* @RUSAGE_SELF
%11 = call i32 @getrusage(i32 %10, %struct.rusage* %2)
store i32 0, i32* %8
br label %12
12: ; preds = %24, %0
%13 = load i32, i32* %8
%14 = icmp slt i32 %13, 100000
br i1 %14, label %15, label %27
15: ; preds = %12
store i32 0, i32* %9
br label %16
16: ; preds = %20, %15
%17 = load i32, i32* %9
%18 = icmp slt i32 %17, 100000
br i1 %18, label %19, label %23
19: ; preds = %16
br label %20
20: ; preds = %19
%21 = load i32, i32* %9
%22 = add nsw i32 %21, 1
store i32 %22, i32* %9
br label %16
23: ; preds = %16
br label %24
24: ; preds = %23
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
br label %12
27: ; preds = %12
%28 = load i32, i32* @RUSAGE_SELF
%29 = call i32 @getrusage(i32 %28, %struct.rusage* %3)
%30 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 1
%31 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %30, i32 0, i32 1
%32 = load i64, i64* %31
%33 = sitofp i64 %32 to x86_fp80
%34 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 1
%35 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %34, i32 0, i32 0
%36 = load i64, i64* %35
%37 = sitofp i64 %36 to x86_fp80
%38 = fdiv x86_fp80 %37, 0xK4012F424000000000000
%39 = fadd x86_fp80 %33, %38
%40 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i32 0, i32 1
%41 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %40, i32 0, i32 1
%42 = load i64, i64* %41
%43 = sitofp i64 %42 to x86_fp80
%44 = fsub x86_fp80 %39, %43
%45 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i32 0, i32 1
%46 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %45, i32 0, i32 0
%47 = load i64, i64* %46
%48 = sitofp i64 %47 to x86_fp80
%49 = fdiv x86_fp80 %48, 0xK4012F424000000000000
%50 = fadd x86_fp80 %44, %49
store x86_fp80 %50, x86_fp80* %4
%51 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 0
%52 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %51, i32 0, i32 1
%53 = load i64, i64* %52
%54 = sitofp i64 %53 to x86_fp80
%55 = getelementptr inbounds %struct.rusage, %struct.rusage* %3, i32 0, i32 0
%56 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %55, i32 0, i32 0
%57 = load i64, i64* %56
%58 = sitofp i64 %57 to x86_fp80
%59 = fdiv x86_fp80 %58, 0xK4012F424000000000000
%60 = fadd x86_fp80 %54, %59
%61 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i32 0, i32 0
%62 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %61, i32 0, i32 1
%63 = load i64, i64* %62
%64 = sitofp i64 %63 to x86_fp80
%65 = fsub x86_fp80 %60, %64
%66 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i32 0, i32 0
%67 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %66, i32 0, i32 0
%68 = load i64, i64* %67
%69 = sitofp i64 %68 to x86_fp80
%70 = fdiv x86_fp80 %69, 0xK4012F424000000000000
%71 = fadd x86_fp80 %65, %70
store x86_fp80 %71, x86_fp80* %5
%72 = load x86_fp80, x86_fp80* %4
%73 = load x86_fp80, x86_fp80* %5
%74 = fadd x86_fp80 %72, %73
store x86_fp80 %74, x86_fp80* %6
%75 = load x86_fp80, x86_fp80* %6
%76 = fmul x86_fp80 %75, 0xK4008FA00000000000000
%77 = fmul x86_fp80 %76, 0xK4008FA00000000000000
%78 = fdiv x86_fp80 0xK40209502F90000000000, %77
store x86_fp80 %78, x86_fp80* %7
%79 = load x86_fp80, x86_fp80* %7
%80 = call i32 (i8*, x86_fp80, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), x86_fp80 %79)
%81 = load x86_fp80, x86_fp80* %4
%82 = load x86_fp80, x86_fp80* %5
%83 = load x86_fp80, x86_fp80* %6
%84 = call i32 (i8*, x86_fp80, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %81, x86_fp80 %82, x86_fp80 %83)
ret i32 0
}

LLVM IR (-O2):
%struct.rusage = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@RUSAGE_SELF = global i32 0
@.str = [28 x i8] c"%.2Lf loops per nanosecond \00"
@.str.1 = [41 x i8] c"(%.2Lfs user, %.2Lfs sys, %.2Lfs total)\0A\00"
define i32 @main() {
%1 = alloca %struct.rusage
%2 = alloca %struct.rusage
%3 = bitcast %struct.rusage* %1 to i8*
%4 = bitcast %struct.rusage* %2 to i8*
%5 = load i32, i32* @RUSAGE_SELF
%6 = call i32 @getrusage(i32 %5, %struct.rusage* %1)
%7 = load i32, i32* @RUSAGE_SELF
%8 = call i32 @getrusage(i32 %7, %struct.rusage* %2)
%9 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1, i32 1
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to x86_fp80
%12 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 1, i32 0
%13 = load i64, i64* %12
%14 = sitofp i64 %13 to x86_fp80
%15 = fdiv x86_fp80 %14, 0xK4012F424000000000000
%16 = fadd x86_fp80 %15, %11
%17 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 1
%18 = load i64, i64* %17
%19 = sitofp i64 %18 to x86_fp80
%20 = fsub x86_fp80 %16, %19
%21 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 1, i32 0
%22 = load i64, i64* %21
%23 = sitofp i64 %22 to x86_fp80
%24 = fdiv x86_fp80 %23, 0xK4012F424000000000000
%25 = fadd x86_fp80 %20, %24
%26 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 0, i32 1
%27 = load i64, i64* %26
%28 = sitofp i64 %27 to x86_fp80
%29 = getelementptr inbounds %struct.rusage, %struct.rusage* %2, i64 0, i32 0, i32 0
%30 = load i64, i64* %29
%31 = sitofp i64 %30 to x86_fp80
%32 = fdiv x86_fp80 %31, 0xK4012F424000000000000
%33 = fadd x86_fp80 %32, %28
%34 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 1
%35 = load i64, i64* %34
%36 = sitofp i64 %35 to x86_fp80
%37 = fsub x86_fp80 %33, %36
%38 = getelementptr inbounds %struct.rusage, %struct.rusage* %1, i64 0, i32 0, i32 0
%39 = load i64, i64* %38
%40 = sitofp i64 %39 to x86_fp80
%41 = fdiv x86_fp80 %40, 0xK4012F424000000000000
%42 = fadd x86_fp80 %37, %41
%43 = fadd x86_fp80 %25, %42
%44 = fmul x86_fp80 %43, 0xK4008FA00000000000000
%45 = fmul x86_fp80 %44, 0xK4008FA00000000000000
%46 = fdiv x86_fp80 0xK40209502F90000000000, %45
%47 = call i32 (i8*, x86_fp80, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), x86_fp80 %46)
%48 = call i32 (i8*, x86_fp80, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %25, x86_fp80 %42, x86_fp80 %43)
ret i32 0
}