#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 {
    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    128b <write_ft_info+0x15b>
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    1286 <write_ft_info+0x156>
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    1281 <write_ft_info+0x151>
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    127c <write_ft_info+0x14c>
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    1277 <write_ft_info+0x147>
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    1272 <write_ft_info+0x142>
lea    0xda1(%rip),%rdi
movsbl -0xd(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    1277 <write_ft_info+0x147>
jmp    127c <write_ft_info+0x14c>
jmp    1281 <write_ft_info+0x151>
jmp    1286 <write_ft_info+0x156>
jmp    128b <write_ft_info+0x15b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    12a3 <write_ft_info+0x173>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    12b5 <write_ft_info+0x185>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xd72(%rip),%rsi
lea    0xda9(%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    0xd92(%rip),%rsi
lea    0xd82(%rip),%rdx
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%ecx
lea    0xda1(%rip),%rsi
lea    0xd63(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0xda5(%rip),%rsi
lea    0xd47(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xda7(%rip),%rsi
lea    0xd2e(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdb9(%rip),%rsi
lea    0xd15(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdbd(%rip),%rsi
lea    0xcfc(%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     12ae <write_ft_info+0x17e>
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,%r14d
jmp    *%rax
mov    $0x80,%r14d
mov    $0x100,%r15d
mov    $0x100,%ebx
jmp    11e5 <write_ft_info+0xb5>
mov    $0x14,%esi
mov    $0x100,%ebx
mov    $0x200,%r15d
mov    $0x100,%r14d
jmp    11e5 <write_ft_info+0xb5>
mov    $0x14,%esi
mov    $0x200,%r15d
mov    $0x200,%ebx
mov    $0x200,%r14d
jmp    11e5 <write_ft_info+0xb5>
mov    $0x19,%esi
mov    $0x400,%ebx
mov    $0x800,%r15d
mov    $0x400,%r14d
jmp    11e5 <write_ft_info+0xb5>
mov    $0x20,%r14d
mov    $0x80,%r15d
mov    $0x80,%ebx
mov    %esi,0x10(%rsp)
cmp    %r15d,%ebx
mov    %r15d,%ebp
cmova  %ebx,%ebp
cmp    %ebp,%r14d
cmova  %r14d,%ebp
lea    0xe8e(%rip),%rsi
lea    0xec5(%rip),%r13
mov    %r12,%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebp,(%rsp)
lea    0xeb7(%rip),%rsi
mov    %r12,%rdi
mov    %r13,%rdx
mov    %r15d,%ecx
mov    %ebx,%r8d
mov    %r14d,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xec8(%rip),%rsi
mov    %r12,%rdi
mov    %r13,%rdx
mov    0x10(%rsp),%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xed0(%rip),%rsi
mov    %r12,%rdi
mov    %r13,%rdx
mov    0x14(%rsp),%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xed3(%rip),%rsi
mov    %r12,%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xeea(%rip),%rsi
mov    %r12,%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xef3(%rip),%rsi
mov    %r12,%rdi
mov    %r13,%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    0xda4(%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 %50
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 %49
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 %48
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 %47
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 %46
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 %45
41: ; preds = %36
%42 = load i8, i8* %6
%43 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %42)
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %40
br label %46
46: ; preds = %45, %35
br label %47
47: ; preds = %46, %30
br label %48
48: ; preds = %47, %25
br label %49
49: ; preds = %48, %20
br label %50
50: ; preds = %49, %15
%51 = load i32, i32* %7
store i32 %51, i32* %10
%52 = load i32, i32* %8
%53 = load i32, i32* %10
%54 = icmp sgt i32 %52, %53
br i1 %54, label %55, label %57
55: ; preds = %50
%56 = load i32, i32* %8
store i32 %56, i32* %10
br label %57
57: ; preds = %55, %50
%58 = load i32, i32* %9
%59 = load i32, i32* %10
%60 = icmp sgt i32 %58, %59
br i1 %60, label %61, label %63
61: ; preds = %57
%62 = load i32, i32* %9
store i32 %62, i32* %10
br label %63
63: ; preds = %61, %57
%64 = load i32*, i32** %4
%65 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %64, 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))
%66 = load i32*, i32** %4
%67 = load i32, i32* %7
%68 = load i32, i32* %8
%69 = load i32, i32* %9
%70 = load i32, i32* %10
%71 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %66, 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 %67, i32 %68, i32 %69, i32 %70)
%72 = load i32*, i32** %4
%73 = load i32, i32* %11
%74 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %72, 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 %73)
%75 = load i32*, i32** %4
%76 = load i32, i32* %5
%77 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %75, 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 %76)
%78 = load i32*, i32** %4
%79 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %78, 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))
%80 = load i32*, i32** %4
%81 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %80, 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))
%82 = load i32*, i32** %4
%83 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %82, 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 %9 [
i8 83, label %12
i8 87, label %4
i8 65, label %5
i8 66, label %6
i8 67, label %7
i8 68, label %8
]
4: ; preds = %3
br label %12
5: ; preds = %3
br label %12
6: ; preds = %3
br label %12
7: ; preds = %3
br label %12
8: ; preds = %3
br label %12
9: ; preds = %3
%10 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %2)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %3, %4, %6, %8, %7, %5
%13 = phi i32 [ 128, %4 ], [ 256, %5 ], [ 512, %6 ], [ 512, %7 ], [ 2048, %8 ], [ 64, %3 ]
%14 = phi i32 [ 128, %4 ], [ 256, %5 ], [ 256, %6 ], [ 512, %7 ], [ 1024, %8 ], [ 64, %3 ]
%15 = phi i32 [ 32, %4 ], [ 128, %5 ], [ 256, %6 ], [ 512, %7 ], [ 1024, %8 ], [ 64, %3 ]
%16 = phi i32 [ 6, %4 ], [ 6, %5 ], [ 20, %6 ], [ 20, %7 ], [ 25, %8 ], [ 6, %3 ]
%17 = icmp ugt i32 %14, %13
%18 = select i1 %17, i32 %14, i32 %13
%19 = icmp ugt i32 %15, %18
%20 = select i1 %19, i32 %15, i32 %18
%21 = 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))
%22 = 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 %13, i32 %14, i32 %15, i32 %20)
%23 = 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 %16)
%24 = 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)
%25 = 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))
%26 = 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))
%27 = 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
}