#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 */
unsigned char CHAR_MAX;
char CHAR_MIN;
unsigned char UCHAR_MAX;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
void range_char(void) {
  unsigned char max, umax;
  char min;
  int BITS = 8;
  min = CHAR_MIN;
  max = CHAR_MAX;
  umax = UCHAR_MAX;
  printf("limit.h: char\n");
  printf(" %19d\tmin\n%20d\tmax\n%20u\tumax\n", min, max, umax);
  min = ~0 << (BITS - 1);
  max = ~(~0 << (BITS - 1));
  umax = ~0;
  printf("bitshift: char\n");
  printf(" %19d\tmin\n%20d\tmax\n%20u\tumax\n", min, max, umax);
  puts("");
  return;
}


x86 assembly (clang, -O0):
<range_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x8,-0x8(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%al
mov    %al,-0x3(%rbp)
mov    0x2e9e(%rip),%rax
mov    (%rax),%al
mov    %al,-0x1(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%al
mov    %al,-0x2(%rbp)
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x3(%rbp),%esi
movzbl -0x1(%rbp),%edx
movzbl -0x2(%rbp),%ecx
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
mov    %al,-0x3(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %al,-0x1(%rbp)
movb   $0xff,-0x2(%rbp)
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movsbl -0x3(%rbp),%esi
movzbl -0x1(%rbp),%edx
movzbl -0x2(%rbp),%ecx
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range_char>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2e9a(%rip),%rax
movsbl (%rax),%r14d
mov    0x2e97(%rip),%rax
movzbl (%rax),%ebp
mov    0x2e9d(%rip),%rax
movzbl (%rax),%ebx
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
lea    0xe97(%rip),%r15
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    $0xffffff80,%esi
mov    $0x7f,%edx
mov    $0xff,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@CHAR_MIN = global i8 0
@CHAR_MAX = global i8 0
@UCHAR_MAX = global i8 0
@.str = [15 x i8] c"limit.h: char\0A\00"
@.str.1 = [30 x i8] c" %19d\09min\0A%20d\09max\0A%20u\09umax\0A\00"
@.str.2 = [16 x i8] c"bitshift: char\0A\00"
@.str.3 = [1 x i8] zeroinitializer
define void @range_char() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = alloca i32
store i32 8, i32* %4
%5 = load i8, i8* @CHAR_MIN
store i8 %5, i8* %3
%6 = load i8, i8* @CHAR_MAX
store i8 %6, i8* %1
%7 = load i8, i8* @UCHAR_MAX
store i8 %7, i8* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = load i8, i8* %1
%12 = zext i8 %11 to i32
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %10, i32 %12, i32 %14)
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, 1
%18 = shl i32 -1, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %3
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 1
%22 = shl i32 -1, %21
%23 = xor i32 %22, -1
%24 = trunc i32 %23 to i8
store i8 %24, i8* %1
store i8 -1, i8* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = load i8, i8* %1
%29 = zext i8 %28 to i32
%30 = load i8, i8* %2
%31 = zext i8 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %29, i32 %31)
%33 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@CHAR_MIN = global i8 0
@CHAR_MAX = global i8 0
@UCHAR_MAX = global i8 0
@.str.1 = [30 x i8] c" %19d\09min\0A%20d\09max\0A%20u\09umax\0A\00"
@str = [14 x i8] c"limit.h: char\00"
@str.4 = [15 x i8] c"bitshift: char\00"
define void @range_char() {
%1 = load i8, i8* @CHAR_MIN
%2 = load i8, i8* @CHAR_MAX
%3 = load i8, i8* @UCHAR_MAX
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%5 = sext i8 %1 to i32
%6 = zext i8 %2 to i32
%7 = zext i8 %3 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %5, i32 %6, i32 %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.4, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 -128, i32 127, i32 255)
%11 = tail call i32 @putchar(i32 10)
ret void
}