#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 */
struct type {
  int dummy;
};
struct compile_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ internal_error(struct compile_state *, int /*<<< orphan*/,
                                  char *);
int size_of(struct compile_state *, struct type *);
const char *type_suffix(struct compile_state *state, struct type *type) {
  const char *suffix;
  switch (size_of(state, type)) {
  case 8:
    suffix = "b";
    break;
  case 16:
    suffix = "w";
    break;
  case 32:
    suffix = "l";
    break;
  default:
    internal_error(state, 0, "unknown suffix");
    suffix = 0;
    break;
  }
  return suffix;
}


x86 assembly (clang, -O0):
<type_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <size_of@plt>
mov    %eax,%ecx
mov    %ecx,-0x1c(%rbp)
sub    $0x8,%eax
je     1172 <type_suffix+0x52>
jmp    1150 <type_suffix+0x30>
mov    -0x1c(%rbp),%eax
sub    $0x10,%eax
je     1182 <type_suffix+0x62>
jmp    1161 <type_suffix+0x41>
mov    -0x1c(%rbp),%eax
sub    $0x20,%eax
je     1192 <type_suffix+0x72>
jmp    11a2 <type_suffix+0x82>
lea    0xe87(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11bc <type_suffix+0x9c>
lea    0xe79(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11bc <type_suffix+0x9c>
lea    0xe6b(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11bc <type_suffix+0x9c>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
lea    0xe57(%rip),%rdx
call   1030 <internal_error@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type_suffix>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <size_of@plt>
cmp    $0x8,%eax
je     1144 <type_suffix+0x24>
cmp    $0x20,%eax
je     114d <type_suffix+0x2d>
cmp    $0x10,%eax
jne    1156 <type_suffix+0x36>
lea    0xec0(%rip),%r14
jmp    116a <type_suffix+0x4a>
lea    0xeb5(%rip),%r14
jmp    116a <type_suffix+0x4a>
lea    0xeb0(%rip),%r14
jmp    116a <type_suffix+0x4a>
lea    0xea9(%rip),%rdx
xor    %r14d,%r14d
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <internal_error@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.compile_state = type { i32 }
%struct.type = type { i32 }
@.str = [2 x i8] c"b\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"l\00"
@.str.3 = [15 x i8] c"unknown suffix\00"
define i8* @type_suffix(%struct.compile_state* %0, %struct.type* %1) {
%3 = alloca %struct.compile_state*
%4 = alloca %struct.type*
%5 = alloca i8*
store %struct.compile_state* %0, %struct.compile_state** %3
store %struct.type* %1, %struct.type** %4
%6 = load %struct.compile_state*, %struct.compile_state** %3
%7 = load %struct.type*, %struct.type** %4
%8 = call i32 @size_of(%struct.compile_state* %6, %struct.type* %7)
switch i32 %8, label %12 [
i32 8, label %9
i32 16, label %10
i32 32, label %11
]
9: ; preds = %2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5
br label %15
10: ; preds = %2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %15
11: ; preds = %2
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %15
12: ; preds = %2
%13 = load %struct.compile_state*, %struct.compile_state** %3
%14 = call i32 @internal_error(%struct.compile_state* %13, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
store i8* null, i8** %5
br label %15
15: ; preds = %12, %11, %10, %9
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
%struct.compile_state = type { i32 }
%struct.type = type { i32 }
@.str = [2 x i8] c"b\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [2 x i8] c"l\00"
@.str.3 = [15 x i8] c"unknown suffix\00"
define i8* @type_suffix(%struct.compile_state* %0, %struct.type* %1) {
%3 = tail call i32 @size_of(%struct.compile_state* %0, %struct.type* %1)
switch i32 %3, label %6 [
i32 8, label %8
i32 16, label %4
i32 32, label %5
]
4: ; preds = %2
br label %8
5: ; preds = %2
br label %8
6: ; preds = %2
%7 = tail call i32 @internal_error(%struct.compile_state* %0, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %8
8: ; preds = %2, %6, %5, %4
%9 = phi i8* [ null, %6 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %4 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %9
}