#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*/ t;
typedef int attr_t;

/* Variables and functions */
int find_pos(char *, int, int *, int *);
int /*<<< orphan*/ printf(char *, char const *, int, int);
void chtype_rep(const char *name, attr_t mask) {
  attr_t x = -1;
  attr_t t = x & mask;
  int low, high;
  int l = find_pos((char *)&t, sizeof(t), &low, &high);
  if (l >= 0)
    printf("         %-5s at 0 range %2d .. %2d;\n", name, low, high);
}


x86 assembly (clang, -O0):
<chtype_rep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0xffffffff,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0x4,%esi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1040 <find_pos@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1178 <chtype_rep+0x58>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chtype_rep>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
mov    $0x4,%esi
call   1040 <find_pos@plt>
test   %eax,%eax
js     1160 <chtype_rep+0x40>
mov    0x8(%rsp),%edx
mov    0x4(%rsp),%ecx
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c" %-5s at 0 range %2d .. %2d;\0A\00"
define void @chtype_rep(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 -1, i32* %5
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = and i32 %10, %11
store i32 %12, i32* %6
%13 = bitcast i32* %6 to i8*
%14 = call i32 @find_pos(i8* %13, i32 4, i32* %7, i32* %8)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp sge i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %2
%18 = load i8*, i8** %3
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %18, i32 %19, i32 %20)
br label %22
22: ; preds = %17, %2
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c" %-5s at 0 range %2d .. %2d;\0A\00"
define void @chtype_rep(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %3 to i8*
store i32 %1, i32* %3
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i32 @find_pos(i8* %6, i32 4, i32* %4, i32* %5)
%10 = icmp sgt i32 %9, -1
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %12, i32 %13)
br label %15
15: ; preds = %11, %2
ret void
}