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

/* Variables and functions */
int A_ATTRIBUTES;
int A_CHARTEXT;
int A_COLOR;
int /*<<< orphan*/ chtype_rep(char *, int);
int /*<<< orphan*/ printf(char *, ...);
void gen_chtype_rep(const char *name) {
  printf("   for %s use\n      record\n", name);
  chtype_rep("Ch", A_CHARTEXT);
  chtype_rep("Color", A_COLOR);
  chtype_rep("Attr", (A_ATTRIBUTES & ~A_COLOR));
  printf("      end record;\n   for %s'Size use %ld;\n", name,
         (long)(8 * sizeof(chtype)));
  printf("      --  Please note: this rep. clause is generated and may be\n");
  printf("      --               different on your system.\n");
}


x86 assembly (clang, -O0):
<gen_chtype_rep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%esi
lea    0xece(%rip),%rdi
call   1040 <chtype_rep@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
lea    0xebc(%rip),%rdi
call   1040 <chtype_rep@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%esi
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    %eax,%esi
lea    0xe9f(%rip),%rdi
call   1040 <chtype_rep@plt>
mov    -0x8(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x20,%edx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_chtype_rep>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%esi
lea    0xec4(%rip),%rdi
call   1050 <chtype_rep@plt>
mov    0x2e7c(%rip),%r14
mov    (%r14),%esi
lea    0xeb1(%rip),%rdi
call   1050 <chtype_rep@plt>
mov    0x2e56(%rip),%rax
mov    (%r14),%esi
not    %esi
and    (%rax),%esi
lea    0xe9d(%rip),%rdi
call   1050 <chtype_rep@plt>
lea    0xe96(%rip),%rdi
mov    $0x20,%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
lea    0xedf(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [28 x i8] c" for %s use\0A record\0A\00"
@.str.1 = [3 x i8] c"Ch\00"
@A_CHARTEXT = global i32 0
@.str.2 = [6 x i8] c"Color\00"
@A_COLOR = global i32 0
@.str.3 = [5 x i8] c"Attr\00"
@A_ATTRIBUTES = global i32 0
@.str.4 = [43 x i8] c" end record;\0A for %s'Size use %ld;\0A\00"
@.str.5 = [65 x i8] c" -- Please note: this rep. clause is generated and may be\0A\00"
@.str.6 = [50 x i8] c" -- different on your system.\0A\00"
define void @gen_chtype_rep(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* @A_CHARTEXT
%6 = call i32 @chtype_rep(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @A_COLOR
%8 = call i32 @chtype_rep(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @A_ATTRIBUTES
%10 = load i32, i32* @A_COLOR
%11 = xor i32 %10, -1
%12 = and i32 %9, %11
%13 = call i32 @chtype_rep(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i8*, i8** %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %14, i64 32)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c" for %s use\0A record\0A\00"
@.str.1 = [3 x i8] c"Ch\00"
@A_CHARTEXT = global i32 0
@.str.2 = [6 x i8] c"Color\00"
@A_COLOR = global i32 0
@.str.3 = [5 x i8] c"Attr\00"
@A_ATTRIBUTES = global i32 0
@.str.4 = [43 x i8] c" end record;\0A for %s'Size use %ld;\0A\00"
@str = [64 x i8] c" -- Please note: this rep. clause is generated and may be\00"
@str.7 = [49 x i8] c" -- different on your system.\00"
define void @gen_chtype_rep(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = load i32, i32* @A_CHARTEXT
%4 = tail call i32 @chtype_rep(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @A_COLOR
%6 = tail call i32 @chtype_rep(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @A_ATTRIBUTES
%8 = load i32, i32* @A_COLOR
%9 = xor i32 %8, -1
%10 = and i32 %7, %9
%11 = tail call i32 @chtype_rep(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0), i8* %0, i64 32)
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.7, i64 0, i64 0))
ret void
}