#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 */

/* Variables and functions */
long double get_time();
int /*<<< orphan*/ printf(char *, int, long double);
int main() {
  int i;
  long double start = get_time(), end;
  int sum = 0;
  for (i = 1; i < 20; i++)
    sum += i;
  end = get_time();
  printf("%d %Lf\n", sum, (end - start));
  i = 20;
  start = get_time();
  i = (i * (i - 1)) / 2;
  end = get_time();
  printf("%d %Lf", i, (end - start));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1040 <get_time@plt>
fstpt  -0x20(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x14,-0x8(%rbp)
jge    1168 <main+0x48>
mov    -0x8(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <main+0x27>
xor    %eax,%eax
mov    %al,-0x35(%rbp)
call   1040 <get_time@plt>
fstpt  -0x30(%rbp)
mov    -0x34(%rbp),%esi
fldt   -0x30(%rbp)
fldt   -0x20(%rbp)
fsubrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x35(%rbp),%al
movl   $0x14,-0x8(%rbp)
call   1040 <get_time@plt>
mov    -0x35(%rbp),%al
fstpt  -0x20(%rbp)
mov    -0x8(%rbp),%ecx
mov    %ecx,%edx
add    $0xffffffff,%edx
imul   %edx,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
add    %edx,%ecx
sar    %ecx
mov    %ecx,-0x8(%rbp)
call   1040 <get_time@plt>
fstpt  -0x30(%rbp)
mov    -0x8(%rbp),%esi
fldt   -0x30(%rbp)
fldt   -0x20(%rbp)
fsubrp %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
xor    %eax,%eax
call   1040 <get_time@plt>
fstpt  0x1c(%rsp)
xor    %eax,%eax
call   1040 <get_time@plt>
fldt   0x1c(%rsp)
fsubrp %st,%st(1)
fstpt  (%rsp)
lea    0xeba(%rip),%rdi
mov    $0xbe,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <get_time@plt>
fstpt  0x1c(%rsp)
xor    %eax,%eax
call   1040 <get_time@plt>
fldt   0x1c(%rsp)
fsubrp %st,%st(1)
fstpt  (%rsp)
lea    0xe96(%rip),%rdi
mov    $0xbe,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%d %Lf\0A\00"
@.str.1 = [7 x i8] c"%d %Lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca x86_fp80
%4 = alloca x86_fp80
%5 = alloca i32
store i32 0, i32* %1
%6 = call x86_fp80 (...) @get_time()
store x86_fp80 %6, x86_fp80* %3
store i32 0, i32* %5
store i32 1, i32* %2
br label %7
7: ; preds = %14, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 20
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %2
%12 = load i32, i32* %5
%13 = add nsw i32 %12, %11
store i32 %13, i32* %5
br label %14
14: ; preds = %10
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %7
17: ; preds = %7
%18 = call x86_fp80 (...) @get_time()
store x86_fp80 %18, x86_fp80* %4
%19 = load i32, i32* %5
%20 = load x86_fp80, x86_fp80* %4
%21 = load x86_fp80, x86_fp80* %3
%22 = fsub x86_fp80 %20, %21
%23 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %19, x86_fp80 %22)
store i32 20, i32* %2
%24 = call x86_fp80 (...) @get_time()
store x86_fp80 %24, x86_fp80* %3
%25 = load i32, i32* %2
%26 = load i32, i32* %2
%27 = sub nsw i32 %26, 1
%28 = mul nsw i32 %25, %27
%29 = sdiv i32 %28, 2
store i32 %29, i32* %2
%30 = call x86_fp80 (...) @get_time()
store x86_fp80 %30, x86_fp80* %4
%31 = load i32, i32* %2
%32 = load x86_fp80, x86_fp80* %4
%33 = load x86_fp80, x86_fp80* %3
%34 = fsub x86_fp80 %32, %33
%35 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %31, x86_fp80 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"%d %Lf\0A\00"
@.str.1 = [7 x i8] c"%d %Lf\00"
define i32 @main() {
%1 = tail call x86_fp80 (...) @get_time()
%2 = tail call x86_fp80 (...) @get_time()
%3 = fsub x86_fp80 %2, %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 190, x86_fp80 %3)
%5 = tail call x86_fp80 (...) @get_time()
%6 = tail call x86_fp80 (...) @get_time()
%7 = fsub x86_fp80 %6, %5
%8 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 190, x86_fp80 %7)
ret i32 0
}