#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, 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 {
    printf("setparams: Internal error: invalid class type %c\n", class);
    exit(1);
  }
  fprintf(fp, "#define\tCLASS\t \'%c\'\n", class);
  fprintf(fp, "#define\tM\t%d\n", m);
}


x86 assembly (clang, -O0):
<write_ep_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x53,%eax
jne    115b <write_ep_info+0x2b>
movl   $0x18,-0x10(%rbp)
jmp    11ed <write_ep_info+0xbd>
movsbl -0x9(%rbp),%eax
cmp    $0x57,%eax
jne    1174 <write_ep_info+0x44>
movl   $0x19,-0x10(%rbp)
jmp    11e8 <write_ep_info+0xb8>
movsbl -0x9(%rbp),%eax
cmp    $0x41,%eax
jne    118d <write_ep_info+0x5d>
movl   $0x1c,-0x10(%rbp)
jmp    11e3 <write_ep_info+0xb3>
movsbl -0x9(%rbp),%eax
cmp    $0x42,%eax
jne    11a6 <write_ep_info+0x76>
movl   $0x1e,-0x10(%rbp)
jmp    11de <write_ep_info+0xae>
movsbl -0x9(%rbp),%eax
cmp    $0x43,%eax
jne    11bf <write_ep_info+0x8f>
movl   $0x20,-0x10(%rbp)
jmp    11d9 <write_ep_info+0xa9>
lea    0xe3a(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11de <write_ep_info+0xae>
jmp    11e3 <write_ep_info+0xb3>
jmp    11e8 <write_ep_info+0xb8>
jmp    11ed <write_ep_info+0xbd>
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%edx
lea    0xe36(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xe38(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_ep_info>:
push   %rbp
push   %rbx
push   %rax
lea    -0x41(%rsi),%eax
cmp    $0x16,%al
ja     1199 <write_ep_info+0x69>
mov    %rdi,%rbx
mov    $0x18,%ebp
movzbl %al,%eax
lea    0xeb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x1c,%ebp
jmp    116f <write_ep_info+0x3f>
mov    $0x1e,%ebp
jmp    116f <write_ep_info+0x3f>
mov    $0x20,%ebp
jmp    116f <write_ep_info+0x3f>
mov    $0x19,%ebp
movzbl %sil,%edx
lea    0xf14(%rip),%rsi
mov    %rbx,%rdi
call   1040 <fprintf@plt>
lea    0xf1a(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fprintf@plt>
movsbl %sil,%esi
lea    0xeb8(%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\09CLASS\09 '%c'\0A\00"
@.str.2 = [14 x i8] c"#define\09M\09%d\0A\00"
define void @write_ep_info(i32* %0, i8 signext %1) {
%3 = alloca i32*
%4 = alloca i8
%5 = alloca i32
store i32* %0, i32** %3
store i8 %1, i8* %4
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 83
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 24, i32* %5
br label %38
10: ; preds = %2
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 87
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 25, i32* %5
br label %37
15: ; preds = %10
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 65
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 28, i32* %5
br label %36
20: ; preds = %15
%21 = load i8, i8* %4
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 66
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 30, i32* %5
br label %35
25: ; preds = %20
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 67
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 32, i32* %5
br label %34
30: ; preds = %25
%31 = load i8, i8* %4
%32 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %31)
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %29
br label %35
35: ; preds = %34, %24
br label %36
36: ; preds = %35, %19
br label %37
37: ; preds = %36, %14
br label %38
38: ; preds = %37, %9
%39 = load i32*, i32** %3
%40 = load i8, i8* %4
%41 = sext i8 %40 to i32
%42 = call i32 @fprintf(i32* %39, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %41)
%43 = load i32*, i32** %3
%44 = load i32, i32* %5
%45 = call i32 @fprintf(i32* %43, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %44)
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\09CLASS\09 '%c'\0A\00"
@.str.2 = [14 x i8] c"#define\09M\09%d\0A\00"
define void @write_ep_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 [ 25, %3 ], [ 28, %4 ], [ 30, %5 ], [ 32, %6 ], [ 24, %2 ]
%12 = zext i8 %1 to i32
%13 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret void
}