#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*/ fprintf(int /*<<< orphan*/ *, char *, int);
int isdigit(char);
int islower(char);
int isspace(char);
int isupper(char);
char toupper(char);
unsigned int _ctype(FILE *output) {
  char test;
  fprintf(output, "%u", isdigit('1'));
  fprintf(output, "%u", islower('A'));
  fprintf(output, "%u", isspace(' '));
  test = toupper('b');
  fprintf(output, "%u", isupper(test));
  return 0;
}


x86 assembly (clang, -O0):
<_ctype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x31,%edi
call   1030 <isdigit@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
lea    0xe75(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x41,%edi
call   1040 <islower@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe51(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x20,%edi
call   1060 <isspace@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0xe2d(%rip),%rsi
call   1070 <fprintf@plt>
mov    $0x62,%edi
call   1050 <toupper@plt>
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movsbl -0x9(%rbp),%edi
call   1080 <isupper@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%edx
lea    0xdfd(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ctype>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x31,%edi
call   1030 <isdigit@plt>
lea    0xe88(%rip),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1070 <fprintf@plt>
mov    $0x41,%edi
call   1040 <islower@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1070 <fprintf@plt>
mov    $0x20,%edi
call   1060 <isspace@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1070 <fprintf@plt>
mov    $0x62,%edi
call   1050 <toupper@plt>
movsbl %al,%edi
call   1080 <isupper@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%u\00"
define i32 @_ctype(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @isdigit(i8 signext 49)
%6 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32*, i32** %2
%8 = call i32 @islower(i8 signext 65)
%9 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32*, i32** %2
%11 = call i32 @isspace(i8 signext 32)
%12 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call signext i8 @toupper(i8 signext 98)
store i8 %13, i8* %3
%14 = load i32*, i32** %2
%15 = load i8, i8* %3
%16 = call i32 @isupper(i8 signext %15)
%17 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%u\00"
define i32 @_ctype(i32* nocapture %0) {
%2 = tail call i32 @isdigit(i8 signext 49)
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @islower(i8 signext 65)
%5 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @isspace(i8 signext 32)
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call signext i8 @toupper(i8 signext 98)
%9 = tail call i32 @isupper(i8 signext %8)
%10 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}