#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 */

/* Variables and functions */
scalar_t__ isalpha(char);
scalar_t__ isdigit(char);
scalar_t__ ispunct(char);
scalar_t__ isspace(char);
char type(char c) {
  char ret;
  if (isalpha(c))
    ret = 'a';
  else if (isdigit(c))
    ret = 'd';
  else if (ispunct(c))
    ret = 'p';
  else if (isspace(c))
    ret = 's';
  return ret;
}


x86 assembly (clang, -O0):
<type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1060 <isalpha@plt>
cmp    $0x0,%rax
je     116a <type+0x2a>
movb   $0x61,-0x2(%rbp)
jmp    11c8 <type+0x88>
movsbl -0x1(%rbp),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1186 <type+0x46>
movb   $0x64,-0x2(%rbp)
jmp    11c3 <type+0x83>
movsbl -0x1(%rbp),%edi
call   1040 <ispunct@plt>
cmp    $0x0,%rax
je     11a2 <type+0x62>
movb   $0x70,-0x2(%rbp)
jmp    11be <type+0x7e>
movsbl -0x1(%rbp),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     11b9 <type+0x79>
movb   $0x73,-0x2(%rbp)
jmp    11be <type+0x7e>
jmp    11c3 <type+0x83>
jmp    11c8 <type+0x88>
movsbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<type>:
push   %rbx
mov    %edi,%ebx
call   1060 <isalpha@plt>
mov    %rax,%rcx
mov    $0x61,%al
test   %rcx,%rcx
je     1154 <type+0x14>
pop    %rbx
ret
movsbl %bl,%ebx
mov    %ebx,%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x64,%al
test   %rcx,%rcx
jne    1152 <type+0x12>
mov    %ebx,%edi
call   1040 <ispunct@plt>
mov    %rax,%rcx
mov    $0x70,%al
test   %rcx,%rcx
jne    1152 <type+0x12>
mov    %ebx,%edi
call   1050 <isspace@plt>
mov    $0x73,%al
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @type(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = call i64 @isalpha(i8 signext %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 97, i8* %3
br label %26
8: ; preds = %1
%9 = load i8, i8* %2
%10 = call i64 @isdigit(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 100, i8* %3
br label %25
13: ; preds = %8
%14 = load i8, i8* %2
%15 = call i64 @ispunct(i8 signext %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13
store i8 112, i8* %3
br label %24
18: ; preds = %13
%19 = load i8, i8* %2
%20 = call i64 @isspace(i8 signext %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %18
store i8 115, i8* %3
br label %23
23: ; preds = %22, %18
br label %24
24: ; preds = %23, %17
br label %25
25: ; preds = %24, %12
br label %26
26: ; preds = %25, %7
%27 = load i8, i8* %3
ret i8 %27
}

LLVM IR (-O2):
define signext i8 @type(i8 signext %0) {
%2 = tail call i64 @isalpha(i8 signext %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = tail call i64 @isdigit(i8 signext %0)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = tail call i64 @ispunct(i8 signext %0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i64 @isspace(i8 signext %0)
br label %12
12: ; preds = %10, %7, %4, %1
%13 = phi i8 [ 97, %1 ], [ 100, %4 ], [ 112, %7 ], [ 115, %10 ]
ret i8 %13
}