#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;
  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     124c <write_ft_info+0x11c>
mov    $0x6,%edx
mov    $0x40,%r14d
movzbl %al,%eax
lea    0xea2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
mov    $0x40,%ebp
mov    $0x40,%ebx
jmp    *%rax
mov    $0x80,%ebx
mov    $0x100,%r14d
mov    $0x100,%ebp
jmp    11c1 <write_ft_info+0x91>
mov    $0x14,%edx
mov    $0x100,%ebp
mov    $0x200,%r14d
mov    $0x100,%ebx
jmp    11c1 <write_ft_info+0x91>
mov    $0x14,%edx
mov    $0x200,%r14d
mov    $0x200,%ebp
mov    $0x200,%ebx
jmp    11c1 <write_ft_info+0x91>
mov    $0x20,%ebx
mov    $0x80,%r14d
mov    $0x80,%ebp
mov    %edx,0x14(%rsp)
cmp    %r14d,%ebp
mov    %r14d,%r12d
cmova  %ebp,%r12d
cmp    %r12d,%ebx
cmova  %ebx,%r12d
lea    0xeb1(%rip),%rsi
lea    0xedf(%rip),%r15
mov    %rdi,%r13
mov    %r15,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    %r12d,(%rsp)
lea    0xed0(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    %ebx,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xee1(%rip),%rsi
mov    %r13,%rdi
mov    %r15,%rdx
mov    0x14(%rsp),%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xee9(%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    0xe05(%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
store i32* %0, i32** %3
store i8 %1, i8* %4
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 83
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 64, i32* %5
store i32 64, i32* %6
store i32 64, i32* %7
store i32 6, i32* %9
br label %42
14: ; preds = %2
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 87
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 128, i32* %5
store i32 128, i32* %6
store i32 32, i32* %7
store i32 6, i32* %9
br label %41
19: ; preds = %14
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 65
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 256, i32* %5
store i32 256, i32* %6
store i32 128, i32* %7
store i32 6, i32* %9
br label %40
24: ; preds = %19
%25 = load i8, i8* %4
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 66
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 512, i32* %5
store i32 256, i32* %6
store i32 256, i32* %7
store i32 20, i32* %9
br label %39
29: ; preds = %24
%30 = load i8, i8* %4
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 67
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 512, i32* %5
store i32 512, i32* %6
store i32 512, i32* %7
store i32 20, i32* %9
br label %38
34: ; preds = %29
%35 = load i8, i8* %4
%36 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %35)
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %33
br label %39
39: ; preds = %38, %28
br label %40
40: ; preds = %39, %23
br label %41
41: ; preds = %40, %18
br label %42
42: ; preds = %41, %13
%43 = load i32, i32* %5
store i32 %43, i32* %8
%44 = load i32, i32* %6
%45 = load i32, i32* %8
%46 = icmp sgt i32 %44, %45
br i1 %46, label %47, label %49
47: ; preds = %42
%48 = load i32, i32* %6
store i32 %48, i32* %8
br label %49
49: ; preds = %47, %42
%50 = load i32, i32* %7
%51 = load i32, i32* %8
%52 = icmp sgt i32 %50, %51
br i1 %52, label %53, label %55
53: ; preds = %49
%54 = load i32, i32* %7
store i32 %54, i32* %8
br label %55
55: ; preds = %53, %49
%56 = load i32*, i32** %3
%57 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %56, 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))
%58 = load i32*, i32** %3
%59 = load i32, i32* %5
%60 = load i32, i32* %6
%61 = load i32, i32* %7
%62 = load i32, i32* %8
%63 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %58, 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 %59, i32 %60, i32 %61, i32 %62)
%64 = load i32*, i32** %3
%65 = load i32, i32* %9
%66 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %64, 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 %65)
%67 = load i32*, i32** %3
%68 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %67, 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 ], [ 512, %5 ], [ 512, %6 ], [ 64, %2 ]
%12 = phi i32 [ 128, %3 ], [ 256, %4 ], [ 256, %5 ], [ 512, %6 ], [ 64, %2 ]
%13 = phi i32 [ 32, %3 ], [ 128, %4 ], [ 256, %5 ], [ 512, %6 ], [ 64, %2 ]
%14 = phi i32 [ 6, %3 ], [ 6, %4 ], [ 20, %5 ], [ 20, %6 ], [ 6, %2 ]
%15 = icmp ugt i32 %12, %11
%16 = select i1 %15, i32 %12, i32 %11
%17 = icmp ugt i32 %13, %16
%18 = select i1 %17, i32 %13, 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 %11, i32 %12, i32 %13, 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 %14)
%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
}