#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*/ printf(char *, ...);
void iprint(int info, int iter, double resid, double t) {
  switch (info) {
  case 0:
    printf("BiCGSTAB converged successfully to %.4f in %.2f seconds after %d "
           "iterations.\n",
           resid, t, iter);
    break;
  case -1:
    printf("Illegal parameter - n must be >= 0.\n");
    break;
  case -2:
    printf("Illegal parameter - ldw must be >= n.\n");
    break;
  case -3:
    printf("Illegal parameter - iter must be > 0.\n");
    break;
  case -10:
    printf("Breakdown after %d iteration(s) - rho and rtld have become "
           "orthogonal in %.4f seconds.\n",
           iter, t);
    break;
  case -11:
    printf("Breakdown after %d iteration(s) - s and t have become orthogonal "
           "relative to t'*t in %.4f seconds.\n",
           iter, t);
    break;
  default:
    printf("BiCGSTAB did not converge after %d iterations in %.4f seconds.\n",
           iter, t);
    break;
  }
}


x86 assembly (clang, -O0):
<iprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x4(%rbp),%eax
add    $0xb,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0xb,%eax
ja     11e0 <iprint+0xd0>
mov    -0x20(%rbp),%rax
lea    0xeb8(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    -0x8(%rbp),%esi
lea    0xecb(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
jmp    11f6 <iprint+0xe6>
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f6 <iprint+0xe6>
lea    0xf18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f6 <iprint+0xe6>
lea    0xf2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11f6 <iprint+0xe6>
mov    -0x8(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xf38(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11f6 <iprint+0xe6>
mov    -0x8(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xf75(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    11f6 <iprint+0xe6>
mov    -0x8(%rbp),%esi
movsd  -0x18(%rbp),%xmm0
lea    0xfbe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iprint>:
add    $0xb,%edi
cmp    $0xb,%edi
ja     114a <iprint+0x2a>
lea    0xed1(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf97(%rip),%rdi
jmp    1151 <iprint+0x31>
lea    0xf36(%rip),%rdi
jmp    1151 <iprint+0x31>
lea    0xfe9(%rip),%rdi
movaps %xmm1,%xmm0
mov    $0x1,%al
jmp    1040 <printf@plt>
lea    0x1018(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x1032(%rip),%rdi
jmp    1030 <puts@plt>
lea    0x104c(%rip),%rdi
jmp    1030 <puts@plt>
lea    0xeaa(%rip),%rdi
mov    $0x2,%al
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [78 x i8] c"BiCGSTAB converged successfully to %.4f in %.2f seconds after %d iterations.\0A\00"
@.str.1 = [37 x i8] c"Illegal parameter - n must be >= 0.\0A\00"
@.str.2 = [39 x i8] c"Illegal parameter - ldw must be >= n.\0A\00"
@.str.3 = [39 x i8] c"Illegal parameter - iter must be > 0.\0A\00"
@.str.4 = [88 x i8] c"Breakdown after %d iteration(s) - rho and rtld have become orthogonal in %.4f seconds.\0A\00"
@.str.5 = [100 x i8] c"Breakdown after %d iteration(s) - s and t have become orthogonal relative to t'*t in %.4f seconds.\0A\00"
@.str.6 = [64 x i8] c"BiCGSTAB did not converge after %d iterations in %.4f seconds.\0A\00"
define void @iprint(i32 %0, i32 %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %5
store i32 %1, i32* %6
store double %2, double* %7
store double %3, double* %8
%9 = load i32, i32* %5
switch i32 %9, label %29 [
i32 0, label %10
i32 -1, label %15
i32 -2, label %17
i32 -3, label %19
i32 -10, label %21
i32 -11, label %25
]
10: ; preds = %4
%11 = load double, double* %7
%12 = load double, double* %8
%13 = load i32, i32* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), double %11, double %12, i32 %13)
br label %33
15: ; preds = %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
br label %33
17: ; preds = %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
br label %33
19: ; preds = %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
br label %33
21: ; preds = %4
%22 = load i32, i32* %6
%23 = load double, double* %8
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str.4, i64 0, i64 0), i32 %22, double %23)
br label %33
25: ; preds = %4
%26 = load i32, i32* %6
%27 = load double, double* %8
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i32 %26, double %27)
br label %33
29: ; preds = %4
%30 = load i32, i32* %6
%31 = load double, double* %8
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0), i32 %30, double %31)
br label %33
33: ; preds = %29, %25, %21, %19, %17, %15, %10
ret void
}

LLVM IR (-O2):
@.str = [78 x i8] c"BiCGSTAB converged successfully to %.4f in %.2f seconds after %d iterations.\0A\00"
@.str.4 = [88 x i8] c"Breakdown after %d iteration(s) - rho and rtld have become orthogonal in %.4f seconds.\0A\00"
@.str.5 = [100 x i8] c"Breakdown after %d iteration(s) - s and t have become orthogonal relative to t'*t in %.4f seconds.\0A\00"
@.str.6 = [64 x i8] c"BiCGSTAB did not converge after %d iterations in %.4f seconds.\0A\00"
@str = [38 x i8] c"Illegal parameter - iter must be > 0.\00"
@str.7 = [38 x i8] c"Illegal parameter - ldw must be >= n.\00"
@str.8 = [36 x i8] c"Illegal parameter - n must be >= 0.\00"
define void @iprint(i32 %0, i32 %1, double %2, double %3) {
switch i32 %0, label %17 [
i32 0, label %5
i32 -1, label %7
i32 -2, label %9
i32 -3, label %11
i32 -10, label %13
i32 -11, label %15
]
5: ; preds = %4
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), double %2, double %3, i32 %1)
br label %19
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.8, i64 0, i64 0))
br label %19
9: ; preds = %4
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.7, i64 0, i64 0))
br label %19
11: ; preds = %4
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %19
13: ; preds = %4
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @.str.4, i64 0, i64 0), i32 %1, double %3)
br label %19
15: ; preds = %4
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str.5, i64 0, i64 0), i32 %1, double %3)
br label %19
17: ; preds = %4
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.6, i64 0, i64 0), i32 %1, double %3)
br label %19
19: ; preds = %17, %15, %13, %11, %9, %7, %5
ret void
}