#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 hooke(int, double *, double *, double, double, int);
int /*<<< orphan*/ printf(char *, int, ...);
main() {
  int nvars;
  int itermax;
  int jj;
  int i;
  double startpt[250];
  double rho;
  double epsilon;
  double endpt[250];
  nvars = 2;
  startpt[0] = -1.2;
  startpt[1] = 1.0;
  rho = 0.5;
  itermax = 5000;
  epsilon = 1E-6;
  jj = hooke(nvars, startpt, endpt, rho, epsilon, itermax);
  printf("\n\n\nHOOKE USED %d ITERATIONS, AND RETURNED\n", jj);
  for (i = 0; i < nvars; i++) {
    printf("x[%3d] = %15.7e \n", i, endpt[i]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movsd  0xed7(%rip),%xmm0
movsd  %xmm0,-0x7f0(%rbp)
ff
movsd  0xebf(%rip),%xmm0
movsd  %xmm0,-0x7e8(%rbp)
ff
movsd  0xea7(%rip),%xmm0
movsd  %xmm0,-0x7f8(%rbp)
ff
movl   $0x1388,-0xc(%rbp)
movsd  0xe88(%rip),%xmm0
movsd  %xmm0,-0x800(%rbp)
ff
mov    -0x8(%rbp),%edi
lea    -0x7f0(%rbp),%rsi
lea    -0xfd0(%rbp),%rdx
movsd  -0x7f8(%rbp),%xmm0
ff
movsd  -0x800(%rbp),%xmm1
ff
mov    -0xc(%rbp),%ecx
call   1040 <hooke@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11fc <main+0xdc>
mov    -0x14(%rbp),%esi
movslq -0x14(%rbp),%rax
movsd  -0xfd0(%rbp,%rax,8),%xmm0
ff ff
lea    0xe64(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11c4 <main+0xa4>
mov    -0x4(%rbp),%eax
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xfa0,%rsp
movaps 0xed1(%rip),%xmm0
movaps %xmm0,0x7d0(%rsp)
lea    0x7d0(%rsp),%rsi
mov    %rsp,%rdx
movsd  0xec6(%rip),%xmm0
movsd  0xec6(%rip),%xmm1
mov    $0x2,%edi
mov    $0x1388,%ecx
call   1040 <hooke@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xfa0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [43 x i8] c"\0A\0A\0AHOOKE USED %d ITERATIONS, AND RETURNED\0A\00"
@.str.1 = [18 x i8] c"x[%3d] = %15.7e \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [250 x double]
%7 = alloca double
%8 = alloca double
%9 = alloca [250 x double]
store i32 0, i32* %1
store i32 2, i32* %2
%10 = getelementptr inbounds [250 x double], [250 x double]* %6, i64 0, i64 0
store double -1.200000e+00, double* %10
%11 = getelementptr inbounds [250 x double], [250 x double]* %6, i64 0, i64 1
store double 1.000000e+00, double* %11
store double 5.000000e-01, double* %7
store i32 5000, i32* %3
store double 0x3EB0C6F7A0B5ED8D, double* %8
%12 = load i32, i32* %2
%13 = getelementptr inbounds [250 x double], [250 x double]* %6, i64 0, i64 0
%14 = getelementptr inbounds [250 x double], [250 x double]* %9, i64 0, i64 0
%15 = load double, double* %7
%16 = load double, double* %8
%17 = load i32, i32* %3
%18 = call i32 @hooke(i32 %12, double* %13, double* %14, double %15, double %16, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %19)
store i32 0, i32* %5
br label %21
21: ; preds = %32, %0
%22 = load i32, i32* %5
%23 = load i32, i32* %2
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %35
25: ; preds = %21
%26 = load i32, i32* %5
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [250 x double], [250 x double]* %9, i64 0, i64 %28
%30 = load double, double* %29
%31 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %26, double %30)
br label %32
32: ; preds = %25
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
store i32 %34, i32* %5
br label %21
35: ; preds = %21
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [43 x i8] c"\0A\0A\0AHOOKE USED %d ITERATIONS, AND RETURNED\0A\00"
@.str.1 = [18 x i8] c"x[%3d] = %15.7e \0A\00"
define i32 @main() {
%1 = alloca [250 x double]
%2 = alloca [250 x double]
%3 = bitcast [250 x double]* %1 to i8*
%4 = bitcast [250 x double]* %2 to i8*
%5 = getelementptr inbounds [250 x double], [250 x double]* %1, i64 0, i64 0
%6 = bitcast [250 x double]* %1 to <2 x double>*
store <2 x double> <double -1.200000e+00, double 1.000000e+00>, <2 x double>* %6
%7 = getelementptr inbounds [250 x double], [250 x double]* %2, i64 0, i64 0
%8 = call i32 @hooke(i32 2, double* %5, double* %7, double 5.000000e-01, double 0x3EB0C6F7A0B5ED8D, i32 5000)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load double, double* %7
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 0, double %10)
%12 = getelementptr inbounds [250 x double], [250 x double]* %2, i64 0, i64 1
%13 = load double, double* %12
%14 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 1, double %13)
ret i32 0
}