#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, char class) {
  int nx, ny, nz, maxdim, niter, np_min;
  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 {
    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, ntotal\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 (ntotal=nx*ny*nz)\n", "        ");
}


x86 assembly (clang, -O0):
<write_ft_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x53,%eax
jne    1170 <write_ft_info+0x40>
movl   $0x40,-0x10(%rbp)
movl   $0x40,-0x14(%rbp)
movl   $0x40,-0x18(%rbp)
movl   $0x6,-0x20(%rbp)
jmp    1256 <write_ft_info+0x126>
movsbl -0x9(%rbp),%eax
cmp    $0x57,%eax
jne    119e <write_ft_info+0x6e>
movl   $0x80,-0x10(%rbp)
movl   $0x80,-0x14(%rbp)
movl   $0x20,-0x18(%rbp)
movl   $0x6,-0x20(%rbp)
jmp    1251 <write_ft_info+0x121>
movsbl -0x9(%rbp),%eax
cmp    $0x41,%eax
jne    11cc <write_ft_info+0x9c>
movl   $0x100,-0x10(%rbp)
movl   $0x100,-0x14(%rbp)
movl   $0x80,-0x18(%rbp)
movl   $0x6,-0x20(%rbp)
jmp    124c <write_ft_info+0x11c>
movsbl -0x9(%rbp),%eax
cmp    $0x42,%eax
jne    11fa <write_ft_info+0xca>
movl   $0x200,-0x10(%rbp)
movl   $0x100,-0x14(%rbp)
movl   $0x100,-0x18(%rbp)
movl   $0x14,-0x20(%rbp)
jmp    1247 <write_ft_info+0x117>
movsbl -0x9(%rbp),%eax
cmp    $0x43,%eax
jne    1228 <write_ft_info+0xf8>
movl   $0x200,-0x10(%rbp)
movl   $0x200,-0x14(%rbp)
movl   $0x200,-0x18(%rbp)
movl   $0x14,-0x20(%rbp)
jmp    1242 <write_ft_info+0x112>
lea    0xdd1(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    1247 <write_ft_info+0x117>
jmp    124c <write_ft_info+0x11c>
jmp    1251 <write_ft_info+0x121>
jmp    1256 <write_ft_info+0x126>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    126e <write_ft_info+0x13e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1280 <write_ft_info+0x150>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xda7(%rip),%rsi
lea    0xdd5(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
mov    -0x1c(%rbp),%eax
lea    0xdbe(%rip),%rsi
lea    0xdae(%rip),%rdx
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%ecx
lea    0xdcd(%rip),%rsi
lea    0xd8f(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdd4(%rip),%rsi
lea    0xd76(%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
lea    -0x41(%rsi),%eax
cmp    $0x16,%al
ja     124e <write_ft_info+0x11e>
mov    $0x6,%edx
mov    $0x40,%r12d
movzbl %al,%eax
lea    0xea2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
mov    $0x40,%ebx
mov    $0x40,%r14d
jmp    *%rax
mov    $0x80,%ebx
mov    $0x100,%r12d
mov    $0x100,%r14d
jmp    11c6 <write_ft_info+0x96>
mov    $0x200,%r14d
mov    $0x14,%edx
mov    $0x100,%r12d
mov    $0x100,%ebx
jmp    11c6 <write_ft_info+0x96>
mov    $0x14,%edx
mov    $0x200,%r12d
mov    $0x200,%ebx
mov    $0x200,%r14d
jmp    11c6 <write_ft_info+0x96>
mov    $0x20,%ebx
mov    $0x80,%r12d
mov    $0x80,%r14d
mov    %edx,0x14(%rsp)
cmp    %r14d,%r12d
mov    %r14d,%ebp
cmova  %r12d,%ebp
cmp    %ebp,%ebx
cmova  %ebx,%ebp
lea    0xeae(%rip),%rsi
lea    0xedc(%rip),%r15
mov    %rdi,%r13
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %ebp,(%rsp)
lea    0xece(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %r12d,%r8d
mov    %ebx,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xedf(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
mov    0x14(%rsp),%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xee7(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>
movsbl %sil,%esi
lea    0xe03(%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 = [53 x i8] c"%sinteger nx, ny, nz, maxdim, niter_default, ntotal\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 = [31 x i8] c"%sparameter (ntotal=nx*ny*nz)\0A\00"
define void @write_ft_info(i32* %0, i8 signext %1) {
%3 = alloca i32*
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %3
store i8 %1, i8* %4
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 83
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 64, i32* %5
store i32 64, i32* %6
store i32 64, i32* %7
store i32 6, i32* %9
br label %43
15: ; preds = %2
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 87
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 128, i32* %5
store i32 128, i32* %6
store i32 32, i32* %7
store i32 6, i32* %9
br label %42
20: ; preds = %15
%21 = load i8, i8* %4
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 65
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 256, i32* %5
store i32 256, i32* %6
store i32 128, i32* %7
store i32 6, i32* %9
br label %41
25: ; preds = %20
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 66
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 512, i32* %5
store i32 256, i32* %6
store i32 256, i32* %7
store i32 20, i32* %9
br label %40
30: ; preds = %25
%31 = load i8, i8* %4
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 67
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 512, i32* %5
store i32 512, i32* %6
store i32 512, i32* %7
store i32 20, i32* %9
br label %39
35: ; preds = %30
%36 = load i8, i8* %4
%37 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %34
br label %40
40: ; preds = %39, %29
br label %41
41: ; preds = %40, %24
br label %42
42: ; preds = %41, %19
br label %43
43: ; preds = %42, %14
%44 = load i32, i32* %5
store i32 %44, i32* %8
%45 = load i32, i32* %6
%46 = load i32, i32* %8
%47 = icmp sgt i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = load i32, i32* %6
store i32 %49, i32* %8
br label %50
50: ; preds = %48, %43
%51 = load i32, i32* %7
%52 = load i32, i32* %8
%53 = icmp sgt i32 %51, %52
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = load i32, i32* %7
store i32 %55, i32* %8
br label %56
56: ; preds = %54, %50
%57 = load i32*, i32** %3
%58 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %57, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%59 = load i32*, i32** %3
%60 = load i32, i32* %5
%61 = load i32, i32* %6
%62 = load i32, i32* %7
%63 = load i32, i32* %8
%64 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %59, 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 %60, i32 %61, i32 %62, i32 %63)
%65 = load i32*, i32** %3
%66 = load i32, i32* %9
%67 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %65, 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 %66)
%68 = load i32*, i32** %3
%69 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %68, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, 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 = [53 x i8] c"%sinteger nx, ny, nz, maxdim, niter_default, ntotal\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 = [31 x i8] c"%sparameter (ntotal=nx*ny*nz)\0A\00"
define void @write_ft_info(i32* nocapture %0, i8 signext %1) {
switch i8 %1, label %7 [
i8 83, label %10
i8 87, label %3
i8 65, label %4
i8 66, label %5
i8 67, label %6
]
3: ; preds = %2
br label %10
4: ; preds = %2
br label %10
5: ; preds = %2
br label %10
6: ; preds = %2
br label %10
7: ; preds = %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %1)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2, %3, %5, %6, %4
%11 = phi i32 [ 128, %3 ], [ 256, %4 ], [ 256, %5 ], [ 512, %6 ], [ 64, %2 ]
%12 = phi i32 [ 32, %3 ], [ 128, %4 ], [ 256, %5 ], [ 512, %6 ], [ 64, %2 ]
%13 = phi i32 [ 6, %3 ], [ 6, %4 ], [ 20, %5 ], [ 20, %6 ], [ 6, %2 ]
%14 = phi i32 [ 128, %3 ], [ 256, %4 ], [ 512, %5 ], [ 512, %6 ], [ 64, %2 ]
%15 = icmp ugt i32 %11, %14
%16 = select i1 %15, i32 %11, i32 %14
%17 = icmp ugt i32 %12, %16
%18 = select i1 %17, i32 %12, i32 %16
%19 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%20 = 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 %11, i32 %12, i32 %18)
%21 = 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 %13)
%22 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret void
}