#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 get_interval_from_guess(double *, int const, double, int);
int test5() {
  const int nt = 50;
  double t[nt];
  double treq = 10.0;
  for (int j = 0; j < nt; ++j)
    t[j] = j * treq / (nt - 1);
  int i = -2;
  int ti = nt - 2;
  i = get_interval_from_guess(t, nt, treq, ti);
  return (i == 49);
}


x86 assembly (clang, -O0):
<test5>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x32,-0x4(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
movsd  0xecf(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x32,-0x1c(%rbp)
jge    1178 <test5+0x68>
cvtsi2sdl -0x1c(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xeaf(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0x1c(%rbp),%rax
movsd  %xmm0,-0x1c0(%rbp,%rax,8)
ff ff
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113d <test5+0x2d>
movl   $0xfffffffe,-0x20(%rbp)
movl   $0x30,-0x24(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x24(%rbp),%edx
lea    -0x1c0(%rbp),%rdi
mov    $0x32,%esi
call   1030 <get_interval_from_guess@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x31,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test5>:
sub    $0x198,%rsp
movdqa 0xee1(%rip),%xmm0
mov    $0x2,%eax
movapd 0xee4(%rip),%xmm1
movapd 0xeec(%rip),%xmm2
movdqa 0xef4(%rip),%xmm3
movdqa 0xefc(%rip),%xmm4
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cvtdq2pd %xmm0,%xmm5
mulpd  %xmm1,%xmm5
divpd  %xmm2,%xmm5
movapd %xmm5,-0x10(%rsp,%rax,8)
cmp    $0x32,%rax
je     118b <test5+0x7b>
movdqa %xmm0,%xmm5
paddd  %xmm3,%xmm5
cvtdq2pd %xmm5,%xmm5
mulpd  %xmm1,%xmm5
divpd  %xmm2,%xmm5
movapd %xmm5,(%rsp,%rax,8)
paddd  %xmm4,%xmm0
add    $0x4,%rax
jmp    1150 <test5+0x40>
mov    %rsp,%rdi
movsd  0xeba(%rip),%xmm0
mov    $0x32,%esi
mov    $0x30,%edx
call   1030 <get_interval_from_guess@plt>
xor    %ecx,%ecx
cmp    $0x31,%eax
sete   %cl
mov    %ecx,%eax
add    $0x198,%rsp
ret

LLVM IR (-O0):
define i32 @test5() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 50, i32* %1
%7 = call i8* @llvm.stacksave()
store i8* %7, i8** %2
%8 = alloca double, i64 50
store double 1.000000e+01, double* %3
store i32 0, i32* %4
br label %9
9: ; preds = %21, %0
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 50
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32, i32* %4
%14 = sitofp i32 %13 to double
%15 = load double, double* %3
%16 = fmul double %14, %15
%17 = fdiv double %16, 4.900000e+01
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %8, i64 %19
store double %17, double* %20
br label %21
21: ; preds = %12
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %9
24: ; preds = %9
store i32 -2, i32* %5
store i32 48, i32* %6
%25 = load double, double* %3
%26 = load i32, i32* %6
%27 = call i32 @get_interval_from_guess(double* %8, i32 50, double %25, i32 %26)
store i32 %27, i32* %5
%28 = load i32, i32* %5
%29 = icmp eq i32 %28, 49
%30 = zext i1 %29 to i32
%31 = load i8*, i8** %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @test5() {
%1 = alloca [50 x double]
br label %2
2: ; preds = %12, %0
%3 = phi i64 [ 0, %0 ], [ %19, %12 ]
%4 = phi <2 x i32> [ <i32 0, i32 1>, %0 ], [ %20, %12 ]
%5 = sitofp <2 x i32> %4 to <2 x double>
%6 = fmul <2 x double> %5, <double 1.000000e+01, double 1.000000e+01>
%7 = fdiv <2 x double> %6, <double 4.900000e+01, double 4.900000e+01>
%8 = getelementptr inbounds [50 x double], [50 x double]* %1, i64 0, i64 %3
%9 = bitcast double* %8 to <2 x double>*
store <2 x double> %7, <2 x double>* %9
%10 = or i64 %3, 2
%11 = icmp eq i64 %10, 50
br i1 %11, label %21, label %12
12: ; preds = %2
%13 = add <2 x i32> %4, <i32 2, i32 2>
%14 = sitofp <2 x i32> %13 to <2 x double>
%15 = fmul <2 x double> %14, <double 1.000000e+01, double 1.000000e+01>
%16 = fdiv <2 x double> %15, <double 4.900000e+01, double 4.900000e+01>
%17 = getelementptr inbounds [50 x double], [50 x double]* %1, i64 0, i64 %10
%18 = bitcast double* %17 to <2 x double>*
store <2 x double> %16, <2 x double>* %18
%19 = add nuw nsw i64 %3, 4
%20 = add <2 x i32> %4, <i32 4, i32 4>
br label %2
21: ; preds = %2
%22 = getelementptr inbounds [50 x double], [50 x double]* %1, i64 0, i64 0
%23 = call i32 @get_interval_from_guess(double* %22, i32 50, double 1.000000e+01, i32 48)
%24 = icmp eq i32 %23, 49
%25 = zext i1 %24 to i32
ret i32 %25
}