#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 *, int);
int /*<<< orphan*/ printf(char *, char);
void write_ep_info(FILE *fp, int nprocs, char class) {
  int m;
  if (class == 'S') {
    m = 24;
  } else if (class == 'W') {
    m = 25;
  } else if (class == 'A') {
    m = 28;
  } else if (class == 'B') {
    m = 30;
  } else if (class == 'C') {
    m = 32;
  } else if (class == 'D') {
    m = 36;
  } else {
    printf("setparams: Internal error: invalid class type %c\n", class);
    exit(1);
  }
  fprintf(fp, "#define CLASS  \'%c\'\n", class);
  fprintf(fp, "#define M      %d\n", m);
  fprintf(fp, "#define npm    %d\n", nprocs);
}


x86 assembly (clang, -O0):
<write_ep_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x53,%eax
jne    115d <write_ep_info+0x2d>
movl   $0x18,-0x14(%rbp)
jmp    120d <write_ep_info+0xdd>
movsbl -0xd(%rbp),%eax
cmp    $0x57,%eax
jne    1176 <write_ep_info+0x46>
movl   $0x19,-0x14(%rbp)
jmp    1208 <write_ep_info+0xd8>
movsbl -0xd(%rbp),%eax
cmp    $0x41,%eax
jne    118f <write_ep_info+0x5f>
movl   $0x1c,-0x14(%rbp)
jmp    1203 <write_ep_info+0xd3>
movsbl -0xd(%rbp),%eax
cmp    $0x42,%eax
jne    11a8 <write_ep_info+0x78>
movl   $0x1e,-0x14(%rbp)
jmp    11fe <write_ep_info+0xce>
movsbl -0xd(%rbp),%eax
cmp    $0x43,%eax
jne    11c1 <write_ep_info+0x91>
movl   $0x20,-0x14(%rbp)
jmp    11f9 <write_ep_info+0xc9>
movsbl -0xd(%rbp),%eax
cmp    $0x44,%eax
jne    11da <write_ep_info+0xaa>
movl   $0x24,-0x14(%rbp)
jmp    11f4 <write_ep_info+0xc4>
lea    0xe1f(%rip),%rdi
movsbl -0xd(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11f9 <write_ep_info+0xc9>
jmp    11fe <write_ep_info+0xce>
jmp    1203 <write_ep_info+0xd3>
jmp    1208 <write_ep_info+0xd8>
jmp    120d <write_ep_info+0xdd>
mov    -0x8(%rbp),%rdi
movsbl -0xd(%rbp),%edx
lea    0xe16(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe18(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe18(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_ep_info>:
push   %rbp
push   %r14
push   %rbx
lea    -0x41(%rdx),%eax
cmp    $0x16,%al
ja     11b3 <write_ep_info+0x83>
mov    %esi,%r14d
mov    %rdi,%rbx
mov    $0x18,%ebp
movzbl %al,%eax
lea    0xeb0(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x1c,%ebp
jmp    117a <write_ep_info+0x4a>
mov    $0x1e,%ebp
jmp    117a <write_ep_info+0x4a>
mov    $0x20,%ebp
jmp    117a <write_ep_info+0x4a>
mov    $0x24,%ebp
jmp    117a <write_ep_info+0x4a>
mov    $0x19,%ebp
movzbl %dl,%edx
lea    0xf0a(%rip),%rsi
mov    %rbx,%rdi
call   1040 <fprintf@plt>
lea    0xf10(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1040 <fprintf@plt>
lea    0xf12(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fprintf@plt>
movsbl %dl,%esi
lea    0xe9f(%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 = [21 x i8] c"#define CLASS '%c'\0A\00"
@.str.2 = [19 x i8] c"#define M %d\0A\00"
@.str.3 = [19 x i8] c"#define npm %d\0A\00"
define void @write_ep_info(i32* %0, i32 %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 83
br i1 %10, label %11, label %12
11: ; preds = %3
store i32 24, i32* %7
br label %46
12: ; preds = %3
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 87
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 25, i32* %7
br label %45
17: ; preds = %12
%18 = load i8, i8* %6
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 65
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 28, i32* %7
br label %44
22: ; preds = %17
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 66
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 30, i32* %7
br label %43
27: ; preds = %22
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 67
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 32, i32* %7
br label %42
32: ; preds = %27
%33 = load i8, i8* %6
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 68
br i1 %35, label %36, label %37
36: ; preds = %32
store i32 36, i32* %7
br label %41
37: ; preds = %32
%38 = load i8, i8* %6
%39 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %36
br label %42
42: ; preds = %41, %31
br label %43
43: ; preds = %42, %26
br label %44
44: ; preds = %43, %21
br label %45
45: ; preds = %44, %16
br label %46
46: ; preds = %45, %11
%47 = load i32*, i32** %4
%48 = load i8, i8* %6
%49 = sext i8 %48 to i32
%50 = call i32 @fprintf(i32* %47, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %49)
%51 = load i32*, i32** %4
%52 = load i32, i32* %7
%53 = call i32 @fprintf(i32* %51, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%54 = load i32*, i32** %4
%55 = load i32, i32* %5
%56 = call i32 @fprintf(i32* %54, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %55)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"setparams: Internal error: invalid class type %c\0A\00"
@.str.1 = [21 x i8] c"#define CLASS '%c'\0A\00"
@.str.2 = [19 x i8] c"#define M %d\0A\00"
@.str.3 = [19 x i8] c"#define npm %d\0A\00"
define void @write_ep_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 [ 25, %4 ], [ 28, %5 ], [ 30, %6 ], [ 32, %7 ], [ 36, %8 ], [ 24, %3 ]
%14 = zext i8 %2 to i32
%15 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %13)
%17 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %1)
ret void
}