#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 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ print(char *, ...);
int /*<<< orphan*/ reset_timer(struct timeval *);
int /*<<< orphan*/ sleep(int);
double soar_cDetermineTimerResolution(double *, double *);
int /*<<< orphan*/ start_timer(struct timeval *);
int /*<<< orphan*/ stop_timer(struct timeval *, struct timeval *);
int /*<<< orphan*/ timer_value(struct timeval *);
int printTimingInfo() {
  struct timeval start, stop;
  double min, max, min_nz;
  min_nz = soar_cDetermineTimerResolution(&min, &max);
  print("Using system timers...\n");
  print("---------------------------------------------------------------\n");
  print("A timing loop is used to obtain the following values.\n");
  print("At least one additional instruction takes place between\n");
  print("starting and stopping the timers, thus a perfectly accurate\n");
  print("timer which costs nothing to invoke would still accumulate\n");
  print("non-zero value. The loop runs for a total of ~2 seconds as \n");
  print("a result, the Maximum timer value is likely to be relatively \n");
  print("large, but should be < 2 seconds\n");
  print("** NOTE: If the code was optimized, the timing loop may yield\n");
  print("         unanticipated results.  If both minimum values are\n");
  print("         zero, it is unclear what the timer resolution is...\n");
  print("---------------------------------------------------------------\n");
  print("Minimum (Non-Zero) Timer Value: %11.5e sec\n", min_nz);
  print("Minimum Timer Value           : %11.5e sec\n", min);
  print("Maximum Timer Value           : %11.5e sec\n\n", max);
  print("---------------------------------------------------------------\n");
  print("A short delay will be issued using the sleep() command, and \n");
  print("timed using Soar's timers....\n");
  reset_timer(&stop);
  start_timer(&start);
  sleep(3);
  stop_timer(&start, &stop);
  print("Sleep interval  -->   3 seconds\n");
  print("Timers report   -->  %8.5f seconds\n", timer_value(&stop));
  print("---------------------------------------------------------------\n");
  return 1;
}


x86 assembly (clang, -O0):
<printTimingInfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <soar_cDetermineTimerResolution@plt>
movsd  %xmm0,-0x28(%rbp)
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xf2f(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xf5d(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xf8c(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xfbd(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xfd1(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0x1002(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0x1031(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xddf(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
movsd  -0x28(%rbp),%xmm0
lea    0x104e(%rip),%rdi
mov    $0x1,%al
call   1040 <print@plt>
movsd  -0x18(%rbp),%xmm0
lea    0x1067(%rip),%rdi
mov    $0x1,%al
call   1040 <print@plt>
movsd  -0x20(%rbp),%xmm0
lea    0x1080(%rip),%rdi
mov    $0x1,%al
call   1040 <print@plt>
lea    0xd98(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0x1091(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0x10c1(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    -0x10(%rbp),%rdi
call   1050 <reset_timer@plt>
lea    -0x8(%rbp),%rdi
call   1070 <start_timer@plt>
mov    $0x3,%edi
call   1090 <sleep@plt>
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1080 <stop_timer@plt>
lea    0x10a9(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    -0x10(%rbp),%rdi
call   1060 <timer_value@plt>
mov    %eax,%esi
lea    0x10b1(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
lea    0xd1e(%rip),%rdi
mov    $0x0,%al
call   1040 <print@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTimingInfo>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <soar_cDetermineTimerResolution@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xe6b(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xe75(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xece(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xef9(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xf28(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xf56(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xf85(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xfb6(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xfca(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0xffb(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0x102a(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0x1050(%rip),%rdi
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
call   1040 <print@plt>
movsd  0x18(%rsp),%xmm0
lea    0x1062(%rip),%rdi
mov    $0x1,%al
call   1040 <print@plt>
movsd  0x10(%rsp),%xmm0
lea    0x107a(%rip),%rdi
mov    $0x1,%al
call   1040 <print@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0x108f(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0x10bf(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
lea    0x20(%rsp),%r15
mov    %r15,%rdi
call   1050 <reset_timer@plt>
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <start_timer@plt>
mov    $0x3,%edi
call   1090 <sleep@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <stop_timer@plt>
lea    0x10a1(%rip),%rdi
xor    %eax,%eax
call   1040 <print@plt>
mov    %r15,%rdi
call   1060 <timer_value@plt>
lea    0x10ac(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <print@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <print@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
@.str = [24 x i8] c"Using system timers...\0A\00"
@.str.1 = [65 x i8] c"---------------------------------------------------------------\0A\00"
@.str.2 = [55 x i8] c"A timing loop is used to obtain the following values.\0A\00"
@.str.3 = [57 x i8] c"At least one additional instruction takes place between\0A\00"
@.str.4 = [61 x i8] c"starting and stopping the timers, thus a perfectly accurate\0A\00"
@.str.5 = [60 x i8] c"timer which costs nothing to invoke would still accumulate\0A\00"
@.str.6 = [61 x i8] c"non-zero value. The loop runs for a total of ~2 seconds as \0A\00"
@.str.7 = [63 x i8] c"a result, the Maximum timer value is likely to be relatively \0A\00"
@.str.8 = [34 x i8] c"large, but should be < 2 seconds\0A\00"
@.str.9 = [63 x i8] c"** NOTE: If the code was optimized, the timing loop may yield\0A\00"
@.str.10 = [61 x i8] c" unanticipated results. If both minimum values are\0A\00"
@.str.11 = [62 x i8] c" zero, it is unclear what the timer resolution is...\0A\00"
@.str.12 = [44 x i8] c"Minimum (Non-Zero) Timer Value: %11.5e sec\0A\00"
@.str.13 = [44 x i8] c"Minimum Timer Value : %11.5e sec\0A\00"
@.str.14 = [45 x i8] c"Maximum Timer Value : %11.5e sec\0A\0A\00"
@.str.15 = [62 x i8] c"A short delay will be issued using the sleep() command, and \0A\00"
@.str.16 = [31 x i8] c"timed using Soar's timers....\0A\00"
@.str.17 = [33 x i8] c"Sleep interval --> 3 seconds\0A\00"
@.str.18 = [36 x i8] c"Timers report --> %8.5f seconds\0A\00"
define i32 @printTimingInfo() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = call double @soar_cDetermineTimerResolution(double* %3, double* %4)
store double %6, double* %5
%7 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
%12 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0))
%14 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0))
%15 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%16 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.9, i64 0, i64 0))
%17 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.10, i64 0, i64 0))
%18 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.11, i64 0, i64 0))
%19 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%20 = load double, double* %5
%21 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.12, i64 0, i64 0), double %20)
%22 = load double, double* %3
%23 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.13, i64 0, i64 0), double %22)
%24 = load double, double* %4
%25 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.14, i64 0, i64 0), double %24)
%26 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.15, i64 0, i64 0))
%28 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.16, i64 0, i64 0))
%29 = call i32 @reset_timer(%struct.timeval* %2)
%30 = call i32 @start_timer(%struct.timeval* %1)
%31 = call i32 @sleep(i32 3)
%32 = call i32 @stop_timer(%struct.timeval* %1, %struct.timeval* %2)
%33 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0))
%34 = call i32 @timer_value(%struct.timeval* %2)
%35 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0), i32 %34)
%36 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
@.str = [24 x i8] c"Using system timers...\0A\00"
@.str.1 = [65 x i8] c"---------------------------------------------------------------\0A\00"
@.str.2 = [55 x i8] c"A timing loop is used to obtain the following values.\0A\00"
@.str.3 = [57 x i8] c"At least one additional instruction takes place between\0A\00"
@.str.4 = [61 x i8] c"starting and stopping the timers, thus a perfectly accurate\0A\00"
@.str.5 = [60 x i8] c"timer which costs nothing to invoke would still accumulate\0A\00"
@.str.6 = [61 x i8] c"non-zero value. The loop runs for a total of ~2 seconds as \0A\00"
@.str.7 = [63 x i8] c"a result, the Maximum timer value is likely to be relatively \0A\00"
@.str.8 = [34 x i8] c"large, but should be < 2 seconds\0A\00"
@.str.9 = [63 x i8] c"** NOTE: If the code was optimized, the timing loop may yield\0A\00"
@.str.10 = [61 x i8] c" unanticipated results. If both minimum values are\0A\00"
@.str.11 = [62 x i8] c" zero, it is unclear what the timer resolution is...\0A\00"
@.str.12 = [44 x i8] c"Minimum (Non-Zero) Timer Value: %11.5e sec\0A\00"
@.str.13 = [44 x i8] c"Minimum Timer Value : %11.5e sec\0A\00"
@.str.14 = [45 x i8] c"Maximum Timer Value : %11.5e sec\0A\0A\00"
@.str.15 = [62 x i8] c"A short delay will be issued using the sleep() command, and \0A\00"
@.str.16 = [31 x i8] c"timed using Soar's timers....\0A\00"
@.str.17 = [33 x i8] c"Sleep interval --> 3 seconds\0A\00"
@.str.18 = [36 x i8] c"Timers report --> %8.5f seconds\0A\00"
define i32 @printTimingInfo() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = alloca double
%4 = alloca double
%5 = bitcast %struct.timeval* %1 to i8*
%6 = bitcast %struct.timeval* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %4 to i8*
%9 = call double @soar_cDetermineTimerResolution(double* %3, double* %4)
%10 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.2, i64 0, i64 0))
%13 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.9, i64 0, i64 0))
%20 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.10, i64 0, i64 0))
%21 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.11, i64 0, i64 0))
%22 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.12, i64 0, i64 0), double %9)
%24 = load double, double* %3
%25 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.13, i64 0, i64 0), double %24)
%26 = load double, double* %4
%27 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.14, i64 0, i64 0), double %26)
%28 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.15, i64 0, i64 0))
%30 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.16, i64 0, i64 0))
%31 = call i32 @reset_timer(%struct.timeval* %2)
%32 = call i32 @start_timer(%struct.timeval* %1)
%33 = call i32 @sleep(i32 3)
%34 = call i32 @stop_timer(%struct.timeval* %1, %struct.timeval* %2)
%35 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.17, i64 0, i64 0))
%36 = call i32 @timer_value(%struct.timeval* %2)
%37 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.18, i64 0, i64 0), i32 %36)
%38 = call i32 (i8*, ...) @print(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
ret i32 1
}