#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, ...);
int /*<<< orphan*/ printf(char *, char);
void write_ft_info(FILE *fp, int nprocs, char class) {
  int nx, ny, nz, maxdim, niter;
  if (class == 'S') {
    nx = 64;
    ny = 64;
    nz = 64;
    niter = 6;
  } else if (class == 'W') {
    nx = 128;
    ny = 128;
    nz = 32;
    niter = 6;
  } else if (class == 'A') {
    nx = 256;
    ny = 256;
    nz = 128;
    niter = 6;
  } else if (class == 'B') {
    nx = 512;
    ny = 256;
    nz = 256;
    niter = 20;
  } else if (class == 'C') {
    nx = 512;
    ny = 512;
    nz = 512;
    niter = 20;
  } else if (class == 'D') {
    nx = 2048;
    ny = 1024;
    nz = 1024;
    niter = 25;
  } else if (class == 'E') {
    nx = 4096;
    ny = 2048;
    nz = 2048;
    niter = 25;
  } else {
    printf("setparams: Internal error: invalid class type %c\n", class);
    exit(1);
  }
  maxdim = nx;
  if (ny > maxdim)
    maxdim = ny;
  if (nz > maxdim)
    maxdim = nz;
  fprintf(fp, "%sinteger nx, ny, nz, maxdim, niter_default, ntdivnp, np_min\n",
          "        ");
  fprintf(fp, "%sparameter (nx=%d, ny=%d, nz=%d, maxdim=%d)\n", "        ", nx,
          ny, nz, maxdim);
  fprintf(fp, "%sparameter (niter_default=%d)\n", "        ", niter);
  fprintf(fp, "%sparameter (np_min = %d)\n", "        ", nprocs);
  fprintf(fp, "%sparameter (ntdivnp=((nx*ny)/np_min)*nz)\n", "        ");
  fprintf(fp, "%sdouble precision ntotal_f\n", "        ");
  fprintf(fp, "%sparameter (ntotal_f=1.d0*nx*ny*nz)\n", "        ");
}


x86 assembly (clang, -O0):
<write_ft_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x53,%eax
jne    1172 <write_ft_info+0x42>
movl   $0x40,-0x14(%rbp)
movl   $0x40,-0x18(%rbp)
movl   $0x40,-0x1c(%rbp)
movl   $0x6,-0x24(%rbp)
jmp    12be <write_ft_info+0x18e>
movsbl -0xd(%rbp),%eax
cmp    $0x57,%eax
jne    11a0 <write_ft_info+0x70>
movl   $0x80,-0x14(%rbp)
movl   $0x80,-0x18(%rbp)
movl   $0x20,-0x1c(%rbp)
movl   $0x6,-0x24(%rbp)
jmp    12b9 <write_ft_info+0x189>
movsbl -0xd(%rbp),%eax
cmp    $0x41,%eax
jne    11ce <write_ft_info+0x9e>
movl   $0x100,-0x14(%rbp)
movl   $0x100,-0x18(%rbp)
movl   $0x80,-0x1c(%rbp)
movl   $0x6,-0x24(%rbp)
jmp    12b4 <write_ft_info+0x184>
movsbl -0xd(%rbp),%eax
cmp    $0x42,%eax
jne    11fc <write_ft_info+0xcc>
movl   $0x200,-0x14(%rbp)
movl   $0x100,-0x18(%rbp)
movl   $0x100,-0x1c(%rbp)
movl   $0x14,-0x24(%rbp)
jmp    12af <write_ft_info+0x17f>
movsbl -0xd(%rbp),%eax
cmp    $0x43,%eax
jne    122a <write_ft_info+0xfa>
movl   $0x200,-0x14(%rbp)
movl   $0x200,-0x18(%rbp)
movl   $0x200,-0x1c(%rbp)
movl   $0x14,-0x24(%rbp)
jmp    12aa <write_ft_info+0x17a>
movsbl -0xd(%rbp),%eax
cmp    $0x44,%eax
jne    1258 <write_ft_info+0x128>
movl   $0x800,-0x14(%rbp)
movl   $0x400,-0x18(%rbp)
movl   $0x400,-0x1c(%rbp)
movl   $0x19,-0x24(%rbp)
jmp    12a5 <write_ft_info+0x175>
movsbl -0xd(%rbp),%eax
cmp    $0x45,%eax
jne    1286 <write_ft_info+0x156>
movl   $0x1000,-0x14(%rbp)
movl   $0x800,-0x18(%rbp)
movl   $0x800,-0x1c(%rbp)
movl   $0x19,-0x24(%rbp)
jmp    12a0 <write_ft_info+0x170>
lea    0xd73(%rip),%rdi
movsbl -0xd(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    12a5 <write_ft_info+0x175>
jmp    12aa <write_ft_info+0x17a>
jmp    12af <write_ft_info+0x17f>
jmp    12b4 <write_ft_info+0x184>
jmp    12b9 <write_ft_info+0x189>
jmp    12be <write_ft_info+0x18e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    12d6 <write_ft_info+0x1a6>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    12e8 <write_ft_info+0x1b8>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xd3f(%rip),%rsi
lea    0xd76(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%eax
lea    0xd5f(%rip),%rsi
lea    0xd4f(%rip),%rdx
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%ecx
lea    0xd6e(%rip),%rsi
lea    0xd30(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0xd72(%rip),%rsi
lea    0xd14(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd74(%rip),%rsi
lea    0xcfb(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd86(%rip),%rsi
lea    0xce2(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xd8a(%rip),%rsi
lea    0xcc9(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_ft_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,0x14(%rsp)
lea    -0x41(%rdx),%eax
cmp    $0x16,%al
ja     12c1 <write_ft_info+0x191>
mov    %rdi,%r12
mov    $0x6,%esi
mov    $0x40,%r15d
movzbl %al,%eax
lea    0xe9b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
mov    $0x40,%ebx
mov    $0x40,%ebp
jmp    *%rax
mov    $0x80,%ebp
mov    $0x100,%r15d
mov    $0x100,%ebx
jmp    11f6 <write_ft_info+0xc6>
mov    $0x14,%esi
mov    $0x100,%ebx
mov    $0x200,%r15d
mov    $0x100,%ebp
jmp    11f6 <write_ft_info+0xc6>
mov    $0x14,%esi
mov    $0x200,%r15d
mov    $0x200,%ebx
mov    $0x200,%ebp
jmp    11f6 <write_ft_info+0xc6>
mov    $0x19,%esi
mov    $0x400,%ebx
mov    $0x800,%r15d
mov    $0x400,%ebp
jmp    11f6 <write_ft_info+0xc6>
mov    $0x19,%esi
mov    $0x800,%ebx
mov    $0x1000,%r15d
mov    $0x800,%ebp
jmp    11f6 <write_ft_info+0xc6>
mov    $0x20,%ebp
mov    $0x80,%r15d
mov    $0x80,%ebx
mov    %esi,0x10(%rsp)
cmp    %r15d,%ebx
mov    %r15d,%r13d
cmova  %ebx,%r13d
cmp    %r13d,%ebp
cmova  %ebp,%r13d
lea    0xe7c(%rip),%rsi
lea    0xeb3(%rip),%r14
mov    %r12,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r13d,(%rsp)
lea    0xea4(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
mov    %r15d,%ecx
mov    %ebx,%r8d
mov    %ebp,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xeb5(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
mov    0x10(%rsp),%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xebd(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
mov    0x14(%rsp),%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xec0(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xed7(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xee0(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>
movsbl %dl,%esi
lea    0xd91(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"setparams: Internal error: invalid class type %c\0A\00"
@.str.1 = [62 x i8] c"%sinteger nx, ny, nz, maxdim, niter_default, ntdivnp, np_min\0A\00"
@.str.2 = [9 x i8] c" \00"
@.str.3 = [46 x i8] c"%sparameter (nx=%d, ny=%d, nz=%d, maxdim=%d)\0A\00"
@.str.4 = [32 x i8] c"%sparameter (niter_default=%d)\0A\00"
@.str.5 = [27 x i8] c"%sparameter (np_min = %d)\0A\00"
@.str.6 = [43 x i8] c"%sparameter (ntdivnp=((nx*ny)/np_min)*nz)\0A\00"
@.str.7 = [29 x i8] c"%sdouble precision ntotal_f\0A\00"
@.str.8 = [38 x i8] c"%sparameter (ntotal_f=1.d0*nx*ny*nz)\0A\00"
define void @write_ft_info(i32* %0, i32 %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%12 = load i8, i8* %6
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 83
br i1 %14, label %15, label %16
15: ; preds = %3
store i32 64, i32* %7
store i32 64, i32* %8
store i32 64, i32* %9
store i32 6, i32* %11
br label %56
16: ; preds = %3
%17 = load i8, i8* %6
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 87
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 128, i32* %7
store i32 128, i32* %8
store i32 32, i32* %9
store i32 6, i32* %11
br label %55
21: ; preds = %16
%22 = load i8, i8* %6
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 65
br i1 %24, label %25, label %26
25: ; preds = %21
store i32 256, i32* %7
store i32 256, i32* %8
store i32 128, i32* %9
store i32 6, i32* %11
br label %54
26: ; preds = %21
%27 = load i8, i8* %6
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 66
br i1 %29, label %30, label %31
30: ; preds = %26
store i32 512, i32* %7
store i32 256, i32* %8
store i32 256, i32* %9
store i32 20, i32* %11
br label %53
31: ; preds = %26
%32 = load i8, i8* %6
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 67
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 512, i32* %7
store i32 512, i32* %8
store i32 512, i32* %9
store i32 20, i32* %11
br label %52
36: ; preds = %31
%37 = load i8, i8* %6
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 68
br i1 %39, label %40, label %41
40: ; preds = %36
store i32 2048, i32* %7
store i32 1024, i32* %8
store i32 1024, i32* %9
store i32 25, i32* %11
br label %51
41: ; preds = %36
%42 = load i8, i8* %6
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 69
br i1 %44, label %45, label %46
45: ; preds = %41
store i32 4096, i32* %7
store i32 2048, i32* %8
store i32 2048, i32* %9
store i32 25, i32* %11
br label %50
46: ; preds = %41
%47 = load i8, i8* %6
%48 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %47)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %45
br label %51
51: ; preds = %50, %40
br label %52
52: ; preds = %51, %35
br label %53
53: ; preds = %52, %30
br label %54
54: ; preds = %53, %25
br label %55
55: ; preds = %54, %20
br label %56
56: ; preds = %55, %15
%57 = load i32, i32* %7
store i32 %57, i32* %10
%58 = load i32, i32* %8
%59 = load i32, i32* %10
%60 = icmp sgt i32 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %56
%62 = load i32, i32* %8
store i32 %62, i32* %10
br label %63
63: ; preds = %61, %56
%64 = load i32, i32* %9
%65 = load i32, i32* %10
%66 = icmp sgt i32 %64, %65
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = load i32, i32* %9
store i32 %68, i32* %10
br label %69
69: ; preds = %67, %63
%70 = load i32*, i32** %4
%71 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %70, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%72 = load i32*, i32** %4
%73 = load i32, i32* %7
%74 = load i32, i32* %8
%75 = load i32, i32* %9
%76 = load i32, i32* %10
%77 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %72, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %73, i32 %74, i32 %75, i32 %76)
%78 = load i32*, i32** %4
%79 = load i32, i32* %11
%80 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %78, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %79)
%81 = load i32*, i32** %4
%82 = load i32, i32* %5
%83 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %81, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %82)
%84 = load i32*, i32** %4
%85 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %84, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%86 = load i32*, i32** %4
%87 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %86, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%88 = load i32*, i32** %4
%89 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"setparams: Internal error: invalid class type %c\0A\00"
@.str.1 = [62 x i8] c"%sinteger nx, ny, nz, maxdim, niter_default, ntdivnp, np_min\0A\00"
@.str.2 = [9 x i8] c" \00"
@.str.3 = [46 x i8] c"%sparameter (nx=%d, ny=%d, nz=%d, maxdim=%d)\0A\00"
@.str.4 = [32 x i8] c"%sparameter (niter_default=%d)\0A\00"
@.str.5 = [27 x i8] c"%sparameter (np_min = %d)\0A\00"
@.str.6 = [43 x i8] c"%sparameter (ntdivnp=((nx*ny)/np_min)*nz)\0A\00"
@.str.7 = [29 x i8] c"%sdouble precision ntotal_f\0A\00"
@.str.8 = [38 x i8] c"%sparameter (ntotal_f=1.d0*nx*ny*nz)\0A\00"
define void @write_ft_info(i32* nocapture %0, i32 %1, i8 signext %2) {
switch i8 %2, label %10 [
i8 83, label %13
i8 87, label %4
i8 65, label %5
i8 66, label %6
i8 67, label %7
i8 68, label %8
i8 69, label %9
]
4: ; preds = %3
br label %13
5: ; preds = %3
br label %13
6: ; preds = %3
br label %13
7: ; preds = %3
br label %13
8: ; preds = %3
br label %13
9: ; preds = %3
br label %13
10: ; preds = %3
%11 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %2)
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %3, %4, %6, %8, %9, %7, %5
%14 = phi i32 [ 128, %4 ], [ 256, %5 ], [ 512, %6 ], [ 512, %7 ], [ 2048, %8 ], [ 4096, %9 ], [ 64, %3 ]
%15 = phi i32 [ 128, %4 ], [ 256, %5 ], [ 256, %6 ], [ 512, %7 ], [ 1024, %8 ], [ 2048, %9 ], [ 64, %3 ]
%16 = phi i32 [ 32, %4 ], [ 128, %5 ], [ 256, %6 ], [ 512, %7 ], [ 1024, %8 ], [ 2048, %9 ], [ 64, %3 ]
%17 = phi i32 [ 6, %4 ], [ 6, %5 ], [ 20, %6 ], [ 20, %7 ], [ 25, %8 ], [ 25, %9 ], [ 6, %3 ]
%18 = icmp ugt i32 %15, %14
%19 = select i1 %18, i32 %15, i32 %14
%20 = icmp ugt i32 %16, %19
%21 = select i1 %20, i32 %16, i32 %19
%22 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%23 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15, i32 %16, i32 %21)
%24 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%25 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %1)
%26 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%27 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%28 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret void
}