#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 */
int /*<<< orphan*/ printf(char *, int, char *, double);
double timer_read(int);
void print_timers(void) {
  int i;
  char *tstrings[] = {"          total ", "          setup ",
                      "            fft ", "         evolve ",
                      "       checksum ", "         fftlow ",
                      "        fftcopy "};
  for (i = 0; i < 7; i++) {
    if (timer_read(i) != 0.0) {
      printf("timer %2d(%16s( :%10.6f\n", i, tstrings[i], timer_read(i));
    }
  }
}


x86 assembly (clang, -O0):
<print_timers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0x2c9d(%rip),%rsi
mov    $0x38,%edx
call   1050 <memcpy@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x7,-0x4(%rbp)
jge    11bf <print_timers+0x8f>
mov    -0x4(%rbp),%edi
call   1040 <timer_read@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117e <print_timers+0x4e>
jp     117e <print_timers+0x4e>
jmp    11ac <print_timers+0x7c>
mov    -0x4(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movslq -0x4(%rbp),%rax
mov    -0x40(%rbp,%rax,8),%rax
mov    %rax,-0x48(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <timer_read@plt>
mov    -0x4c(%rbp),%esi
mov    -0x48(%rbp),%rdx
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
jmp    11b1 <print_timers+0x81>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1154 <print_timers+0x24>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_timers>:
push   %rax
xor    %edi,%edi
call   1040 <timer_read@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1134 <print_timers+0x14>
jnp    1150 <print_timers+0x30>
xor    %edi,%edi
call   1040 <timer_read@plt>
lea    0xf3d(%rip),%rdi
lea    0xebf(%rip),%rdx
xor    %esi,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <timer_read@plt>
ucomisd 0xe9e(%rip),%xmm0
jne    1166 <print_timers+0x46>
jnp    1188 <print_timers+0x68>
mov    $0x1,%edi
call   1040 <timer_read@plt>
lea    0xf08(%rip),%rdi
lea    0xe9b(%rip),%rdx
mov    $0x1,%esi
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <timer_read@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    119e <print_timers+0x7e>
jnp    11c0 <print_timers+0xa0>
mov    $0x2,%edi
call   1040 <timer_read@plt>
lea    0xed0(%rip),%rdi
lea    0xe74(%rip),%rdx
mov    $0x2,%esi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <timer_read@plt>
ucomisd 0xe2e(%rip),%xmm0
jne    11d6 <print_timers+0xb6>
jnp    11f8 <print_timers+0xd8>
mov    $0x3,%edi
call   1040 <timer_read@plt>
lea    0xe98(%rip),%rdi
lea    0xe4d(%rip),%rdx
mov    $0x3,%esi
call   1030 <printf@plt>
mov    $0x4,%edi
call   1040 <timer_read@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    120e <print_timers+0xee>
jnp    1230 <print_timers+0x110>
mov    $0x4,%edi
call   1040 <timer_read@plt>
lea    0xe60(%rip),%rdi
lea    0xe26(%rip),%rdx
mov    $0x4,%esi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <timer_read@plt>
ucomisd 0xdbe(%rip),%xmm0
jne    1246 <print_timers+0x126>
jnp    1268 <print_timers+0x148>
mov    $0x5,%edi
call   1040 <timer_read@plt>
lea    0xe28(%rip),%rdi
lea    0xdff(%rip),%rdx
mov    $0x5,%esi
call   1030 <printf@plt>
mov    $0x6,%edi
call   1040 <timer_read@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    127e <print_timers+0x15e>
jnp    12a1 <print_timers+0x181>
mov    $0x6,%edi
call   1040 <timer_read@plt>
lea    0xdf0(%rip),%rdi
lea    0xdd8(%rip),%rdx
mov    $0x6,%esi
pop    %rax
jmp    1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c" total \00"
@.str.1 = [17 x i8] c" setup \00"
@.str.2 = [17 x i8] c" fft \00"
@.str.3 = [17 x i8] c" evolve \00"
@.str.4 = [17 x i8] c" checksum \00"
@.str.5 = [17 x i8] c" fftlow \00"
@.str.6 = [17 x i8] c" fftcopy \00"
@__const.print_timers.tstrings = [7 x i8*] [i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i32 0, i32 0)]
@.str.7 = [25 x i8] c"timer %2d(%16s( :%10.6f\0A\00"
define void @print_timers() {
%1 = alloca i32
%2 = alloca [7 x i8*]
%3 = bitcast [7 x i8*]* %2 to i8*
store i32 0, i32* %1
br label %4
4: ; preds = %21, %0
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 7
br i1 %6, label %7, label %24
7: ; preds = %4
%8 = load i32, i32* %1
%9 = call double @timer_read(i32 %8)
%10 = fcmp une double %9, 0.000000e+00
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i32, i32* %1
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [7 x i8*], [7 x i8*]* %2, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = load i32, i32* %1
%18 = call double @timer_read(i32 %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %12, i8* %16, double %18)
br label %20
20: ; preds = %11, %7
br label %21
21: ; preds = %20
%22 = load i32, i32* %1
%23 = add nsw i32 %22, 1
store i32 %23, i32* %1
br label %4
24: ; preds = %4
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c" total \00"
@.str.1 = [17 x i8] c" setup \00"
@.str.2 = [17 x i8] c" fft \00"
@.str.3 = [17 x i8] c" evolve \00"
@.str.4 = [17 x i8] c" checksum \00"
@.str.5 = [17 x i8] c" fftlow \00"
@.str.6 = [17 x i8] c" fftcopy \00"
@.str.7 = [25 x i8] c"timer %2d(%16s( :%10.6f\0A\00"
define void @print_timers() {
%1 = tail call double @timer_read(i32 0)
%2 = fcmp une double %1, 0.000000e+00
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call double @timer_read(i32 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %4)
br label %6
6: ; preds = %0, %3
%7 = tail call double @timer_read(i32 1)
%8 = fcmp une double %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = tail call double @timer_read(i32 1)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), double %10)
br label %12
12: ; preds = %9, %6
%13 = tail call double @timer_read(i32 2)
%14 = fcmp une double %13, 0.000000e+00
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = tail call double @timer_read(i32 2)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), double %16)
br label %18
18: ; preds = %15, %12
%19 = tail call double @timer_read(i32 3)
%20 = fcmp une double %19, 0.000000e+00
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = tail call double @timer_read(i32 3)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), double %22)
br label %24
24: ; preds = %21, %18
%25 = tail call double @timer_read(i32 4)
%26 = fcmp une double %25, 0.000000e+00
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = tail call double @timer_read(i32 4)
%29 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), double %28)
br label %30
30: ; preds = %27, %24
%31 = tail call double @timer_read(i32 5)
%32 = fcmp une double %31, 0.000000e+00
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = tail call double @timer_read(i32 5)
%35 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), double %34)
br label %36
36: ; preds = %33, %30
%37 = tail call double @timer_read(i32 6)
%38 = fcmp une double %37, 0.000000e+00
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = tail call double @timer_read(i32 6)
%41 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), double %40)
br label %42
42: ; preds = %39, %36
ret void
}