#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 */
double lm_enorm(int, double const *);
int /*<<< orphan*/ printf(char *, ...);
void lm_printout_std(int n_par, const double *par, int m_dat, const void *data,
                     const double *fvec, int printflags, int iflag, int iter,
                     int nfev) {
  int i;
  if (!printflags)
    return;
  if (printflags & 1) {
    if (iflag == 2) {
      printf("trying step in gradient direction  ");
    } else if (iflag == 1) {
      printf("determining gradient (iteration %2d)", iter);
    } else if (iflag == 0) {
      printf("starting minimization              ");
    } else if (iflag == -1) {
      printf("terminated after %3d evaluations   ", nfev);
    }
  }
  if (printflags & 2) {
    printf("  par: ");
    for (i = 0; i < n_par; ++i)
      printf(" %18.11g", par[i]);
    printf(" => norm: %18.11g", lm_enorm(m_dat, fvec));
  }
  if (printflags & 3)
    printf("\n");
  if ((printflags & 8) || ((printflags & 4) && iflag == -1)) {
    printf("  residuals:\n");
    for (i = 0; i < m_dat; ++i)
      printf("    fvec[%2d]=%12g\n", i, fvec[i]);
  }
}


x86 assembly (clang, -O0):
<lm_printout_std>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jne    1156 <lm_printout_std+0x36>
jmp    12f8 <lm_printout_std+0x1d8>
mov    -0x2c(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11ee <lm_printout_std+0xce>
cmpl   $0x2,0x10(%rbp)
jne    1182 <lm_printout_std+0x62>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e9 <lm_printout_std+0xc9>
cmpl   $0x1,0x10(%rbp)
jne    11a2 <lm_printout_std+0x82>
mov    0x18(%rbp),%esi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e4 <lm_printout_std+0xc4>
cmpl   $0x0,0x10(%rbp)
jne    11bf <lm_printout_std+0x9f>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11df <lm_printout_std+0xbf>
cmpl   $0xffffffff,0x10(%rbp)
jne    11da <lm_printout_std+0xba>
mov    0x20(%rbp),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11df <lm_printout_std+0xbf>
jmp    11e4 <lm_printout_std+0xc4>
jmp    11e9 <lm_printout_std+0xc9>
jmp    11ee <lm_printout_std+0xce>
mov    -0x2c(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1261 <lm_printout_std+0x141>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1247 <lm_printout_std+0x127>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe70(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1212 <lm_printout_std+0xf2>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1040 <lm_enorm@plt>
lea    0xe3f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     127e <lm_printout_std+0x15e>
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x2c(%rbp),%eax
and    $0x8,%eax
cmp    $0x0,%eax
jne    12a6 <lm_printout_std+0x186>
mov    -0x2c(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     12f8 <lm_printout_std+0x1d8>
cmpl   $0xffffffff,0x10(%rbp)
jne    12f8 <lm_printout_std+0x1d8>
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12f3 <lm_printout_std+0x1d3>
mov    -0x30(%rbp),%esi
mov    -0x28(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xddb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12bb <lm_printout_std+0x19b>
jmp    12f8 <lm_printout_std+0x1d8>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lm_printout_std>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %r9d,%r9d
je     127c <lm_printout_std+0x13c>
mov    %r9d,%r15d
mov    %r8,%r13
mov    %edx,%ebx
mov    %rsi,%r14
mov    %edi,%r12d
mov    0x40(%rsp),%ebp
test   $0x1,%r15b
je     11af <lm_printout_std+0x6f>
lea    0x1(%rbp),%eax
cmp    $0x3,%eax
ja     11af <lm_printout_std+0x6f>
lea    0xe85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x50(%rsp),%esi
lea    0xeee(%rip),%rdi
jmp    11a8 <lm_printout_std+0x68>
lea    0xec1(%rip),%rdi
jmp    1292 <lm_printout_std+0x152>
mov    0x48(%rsp),%esi
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   $0x2,%r15b
je     1219 <lm_printout_std+0xd9>
mov    %ebx,0x4(%rsp)
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r12d,%r12d
jle    11f9 <lm_printout_std+0xb9>
mov    %r12d,%ebp
xor    %ebx,%ebx
lea    0xeda(%rip),%r12
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rbx,8),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11e0 <lm_printout_std+0xa0>
mov    0x4(%rsp),%ebx
mov    %ebx,%edi
mov    %r13,%rsi
call   1060 <lm_enorm@plt>
lea    0xe9b(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x40(%rsp),%ebp
test   $0x3,%r15b
je     1229 <lm_printout_std+0xe9>
mov    $0xa,%edi
call   1030 <putchar@plt>
test   $0x8,%r15b
jne    123a <lm_printout_std+0xfa>
test   $0x4,%r15b
je     127c <lm_printout_std+0x13c>
cmp    $0xffffffff,%ebp
jne    127c <lm_printout_std+0x13c>
lea    0xe8e(%rip),%rdi
call   1040 <puts@plt>
test   %ebx,%ebx
jle    127c <lm_printout_std+0x13c>
mov    %ebx,%ebx
xor    %ebp,%ebp
lea    0xe66(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
movsd  0x0(%r13,%rbp,8),%xmm0
mov    %r14,%rdi
mov    %ebp,%esi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1260 <lm_printout_std+0x120>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd7e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   $0x2,%r15b
jne    11b5 <lm_printout_std+0x75>
jmp    1219 <lm_printout_std+0xd9>

LLVM IR (-O0):
@.str = [36 x i8] c"trying step in gradient direction \00"
@.str.1 = [37 x i8] c"determining gradient (iteration %2d)\00"
@.str.2 = [36 x i8] c"starting minimization \00"
@.str.3 = [36 x i8] c"terminated after %3d evaluations \00"
@.str.4 = [8 x i8] c" par: \00"
@.str.5 = [9 x i8] c" %18.11g\00"
@.str.6 = [18 x i8] c" => norm: %18.11g\00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [14 x i8] c" residuals:\0A\00"
@.str.9 = [20 x i8] c" fvec[%2d]=%12g\0A\00"
define void @lm_printout_std(i32 %0, double* %1, i32 %2, i8* %3, double* %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = alloca i32
%11 = alloca double*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca double*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
store i32 %0, i32* %10
store double* %1, double** %11
store i32 %2, i32* %12
store i8* %3, i8** %13
store double* %4, double** %14
store i32 %5, i32* %15
store i32 %6, i32* %16
store i32 %7, i32* %17
store i32 %8, i32* %18
%20 = load i32, i32* %15
%21 = icmp ne i32 %20, 0
br i1 %21, label %23, label %22
22: ; preds = %9
br label %113
23: ; preds = %9
%24 = load i32, i32* %15
%25 = and i32 %24, 1
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %53
27: ; preds = %23
%28 = load i32, i32* %16
%29 = icmp eq i32 %28, 2
br i1 %29, label %30, label %32
30: ; preds = %27
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %52
32: ; preds = %27
%33 = load i32, i32* %16
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %17
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %36)
br label %51
38: ; preds = %32
%39 = load i32, i32* %16
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %50
43: ; preds = %38
%44 = load i32, i32* %16
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* %18
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %46, %43
br label %50
50: ; preds = %49, %41
br label %51
51: ; preds = %50, %35
br label %52
52: ; preds = %51, %30
br label %53
53: ; preds = %52, %23
%54 = load i32, i32* %15
%55 = and i32 %54, 2
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %78
57: ; preds = %53
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %19
br label %59
59: ; preds = %70, %57
%60 = load i32, i32* %19
%61 = load i32, i32* %10
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %73
63: ; preds = %59
%64 = load double*, double** %11
%65 = load i32, i32* %19
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds double, double* %64, i64 %66
%68 = load double, double* %67
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), double %68)
br label %70
70: ; preds = %63
%71 = load i32, i32* %19
%72 = add nsw i32 %71, 1
store i32 %72, i32* %19
br label %59
73: ; preds = %59
%74 = load i32, i32* %12
%75 = load double*, double** %14
%76 = call double @lm_enorm(i32 %74, double* %75)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), double %76)
br label %78
78: ; preds = %73, %53
%79 = load i32, i32* %15
%80 = and i32 %79, 3
%81 = icmp ne i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %78
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
br label %84
84: ; preds = %82, %78
%85 = load i32, i32* %15
%86 = and i32 %85, 8
%87 = icmp ne i32 %86, 0
br i1 %87, label %95, label %88
88: ; preds = %84
%89 = load i32, i32* %15
%90 = and i32 %89, 4
%91 = icmp ne i32 %90, 0
br i1 %91, label %92, label %113
92: ; preds = %88
%93 = load i32, i32* %16
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %113
95: ; preds = %92, %84
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %19
br label %97
97: ; preds = %109, %95
%98 = load i32, i32* %19
%99 = load i32, i32* %12
%100 = icmp slt i32 %98, %99
br i1 %100, label %101, label %112
101: ; preds = %97
%102 = load i32, i32* %19
%103 = load double*, double** %14
%104 = load i32, i32* %19
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds double, double* %103, i64 %105
%107 = load double, double* %106
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 %102, double %107)
br label %109
109: ; preds = %101
%110 = load i32, i32* %19
%111 = add nsw i32 %110, 1
store i32 %111, i32* %19
br label %97
112: ; preds = %97
br label %113
113: ; preds = %22, %112, %92, %88
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"trying step in gradient direction \00"
@.str.1 = [37 x i8] c"determining gradient (iteration %2d)\00"
@.str.2 = [36 x i8] c"starting minimization \00"
@.str.3 = [36 x i8] c"terminated after %3d evaluations \00"
@.str.4 = [8 x i8] c" par: \00"
@.str.5 = [9 x i8] c" %18.11g\00"
@.str.6 = [18 x i8] c" => norm: %18.11g\00"
@.str.9 = [20 x i8] c" fvec[%2d]=%12g\0A\00"
@str = [13 x i8] c" residuals:\00"
define void @lm_printout_std(i32 %0, double* nocapture %1, i32 %2, i8* nocapture readnone %3, double* %4, i32 %5, i32 %6, i32 %7, i32 %8) {
%10 = icmp eq i32 %5, 0
br i1 %10, label %67, label %11
11: ; preds = %9
%12 = and i32 %5, 1
%13 = icmp eq i32 %12, 0
br i1 %13, label %23, label %14
14: ; preds = %11
switch i32 %6, label %23 [
i32 2, label %15
i32 1, label %17
i32 0, label %19
i32 -1, label %21
]
15: ; preds = %14
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
br label %23
17: ; preds = %14
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %7)
br label %23
19: ; preds = %14
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
br label %23
21: ; preds = %14
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %8)
br label %23
23: ; preds = %14, %15, %19, %21, %17, %11
%24 = and i32 %5, 2
%25 = icmp eq i32 %24, 0
br i1 %25, label %41, label %26
26: ; preds = %23
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp sgt i32 %0, 0
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = zext i32 %0 to i64
br label %31
31: ; preds = %29, %31
%32 = phi i64 [ 0, %29 ], [ %36, %31 ]
%33 = getelementptr inbounds double, double* %1, i64 %32
%34 = load double, double* %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), double %34)
%36 = add nuw nsw i64 %32, 1
%37 = icmp eq i64 %36, %30
br i1 %37, label %38, label %31
38: ; preds = %31, %26
%39 = tail call double @lm_enorm(i32 %2, double* %4)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0), double %39)
br label %41
41: ; preds = %38, %23
%42 = and i32 %5, 3
%43 = icmp eq i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %41
%45 = tail call i32 @putchar(i32 10)
br label %46
46: ; preds = %44, %41
%47 = and i32 %5, 8
%48 = icmp eq i32 %47, 0
br i1 %48, label %49, label %54
49: ; preds = %46
%50 = and i32 %5, 4
%51 = icmp ne i32 %50, 0
%52 = icmp eq i32 %6, -1
%53 = and i1 %51, %52
br i1 %53, label %54, label %67
54: ; preds = %49, %46
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%56 = icmp sgt i32 %2, 0
br i1 %56, label %57, label %67
57: ; preds = %54
%58 = zext i32 %2 to i64
br label %59
59: ; preds = %57, %59
%60 = phi i64 [ 0, %57 ], [ %65, %59 ]
%61 = getelementptr inbounds double, double* %4, i64 %60
%62 = load double, double* %61
%63 = trunc i64 %60 to i32
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i32 %63, double %62)
%65 = add nuw nsw i64 %60, 1
%66 = icmp eq i64 %65, %58
br i1 %66, label %67, label %59
67: ; preds = %59, %54, %49, %9
ret void
}