#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stdout;
int resetInnerLoop(double timeMin, double threshold_lo, unsigned int *NLOOP) {
  if (timeMin < threshold_lo) {
    *NLOOP = (*NLOOP) * threshold_lo / timeMin;
    fprintf(stdout,
            "\n\tWarning : Internal loop too short for timer overhead.");
    fprintf(stdout, "\n\tWarning : Internal loop reset to NLOOP = %d\n",
            *NLOOP);
    fflush(stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<resetInnerLoop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11b6 <resetInnerLoop+0x96>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
cvtsi2sd %rax,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resetInnerLoop>:
ucomisd %xmm0,%xmm1
jbe    117d <resetInnerLoop+0x5d>
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%eax
cvtsi2sd %rax,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
cvttsd2si %xmm2,%rax
mov    %eax,(%rdi)
mov    0x2e96(%rip),%r14
mov    (%r14),%edi
lea    0xeac(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%edx
lea    0xed1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
call   1040 <fflush@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
xor    %eax,%eax
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [56 x i8] c"\0A\09Warning : Internal loop too short for timer overhead.\00"
@.str.1 = [47 x i8] c"\0A\09Warning : Internal loop reset to NLOOP = %d\0A\00"
define i32 @resetInnerLoop(double %0, double %1, i32* %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca i32*
store double %0, double* %4
store double %1, double* %5
store i32* %2, i32** %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fcmp olt double %7, %8
br i1 %9, label %10, label %28
10: ; preds = %3
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = uitofp i32 %12 to double
%14 = load double, double* %5
%15 = fmul double %13, %14
%16 = load double, double* %4
%17 = fdiv double %15, %16
%18 = fptoui double %17 to i32
%19 = load i32*, i32** %6
store i32 %18, i32* %19
%20 = load i32, i32* @stdout
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%22 = load i32, i32* @stdout
%23 = load i32*, i32** %6
%24 = load i32, i32* %23
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* @stdout
%27 = call i32 @fflush(i32 %26)
br label %28
28: ; preds = %10, %3
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [56 x i8] c"\0A\09Warning : Internal loop too short for timer overhead.\00"
@.str.1 = [47 x i8] c"\0A\09Warning : Internal loop reset to NLOOP = %d\0A\00"
define i32 @resetInnerLoop(double %0, double %1, i32* nocapture %2) {
%4 = fcmp olt double %0, %1
br i1 %4, label %5, label %18
5: ; preds = %3
%6 = load i32, i32* %2
%7 = uitofp i32 %6 to double
%8 = fmul double %7, %1
%9 = fdiv double %8, %0
%10 = fptoui double %9 to i32
store i32 %10, i32* %2
%11 = load i32, i32* @stdout
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @stdout
%14 = load i32, i32* %2
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* @stdout
%17 = tail call i32 @fflush(i32 %16)
br label %18
18: ; preds = %5, %3
ret i32 0
}