#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 */
int INT_MAX;
int INT_MIN;
unsigned long LONG_MAX;
long LONG_MIN;
int SCHAR_MAX;
int SCHAR_MIN;
int SHRT_MAX;
int SHRT_MIN;
int UCHAR_MAX;
int UINT_MAX;
unsigned long ULONG_MAX;
int USHRT_MAX;
int /*<<< orphan*/ printf(char *, long, unsigned long);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int main(void) {
  unsigned char schar_max;
  unsigned short shrt_max;
  unsigned int int_max;
  unsigned long long_max;
  puts("Standard headers:");
  printf("  signed char:\t%d - %d\n", SCHAR_MIN, SCHAR_MAX);
  printf("unsigned char:\t%u - %u\n", 0, UCHAR_MAX);
  printf("  signed short:\t%d - %d\n", SHRT_MIN, SHRT_MAX);
  printf("unsigned short:\t%u - %u\n", 0, USHRT_MAX);
  printf("  signed int:\t%d - %d\n", INT_MIN, INT_MAX);
  printf("unsigned int:\t%u - %u\n", 0, UINT_MAX);
  printf("  signed long:\t%ld - %ld\n", LONG_MIN, LONG_MAX);
  printf("unsigned long:\t%lu - %lu\n", 0L, ULONG_MAX);
  putchar('\n');
  puts("Direct computation:");
  schar_max = (unsigned char)~0 >> 1;
  shrt_max = (unsigned short)~0 >> 1;
  int_max = ~0U >> 1;
  long_max = ~0UL >> 1;
  printf("  signed char:\t%d - %d\n", (char)(schar_max + 1), schar_max);
  printf("unsigned char:\t%u - %u\n", 0, (unsigned char)~0);
  printf("  signed short:\t%d - %d\n", (short)(shrt_max + 1), shrt_max);
  printf("unsigned short:\t%u - %u\n", 0, (unsigned short)~0);
  printf("  signed int:\t%d - %d\n", int_max + 1, int_max);
  printf("unsigned int:\t%u - %u\n", 0, ~0U);
  printf("  signed long:\t%ld - %ld\n", long_max + 1, long_max);
  printf("unsigned long:\t%lu - %lu\n", 0L, ~0UL);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e5e(%rip),%rax
movslq (%rax),%rsi
mov    0x2e4c(%rip),%rax
movslq (%rax),%rdx
lea    0xeac(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e7e(%rip),%rax
movslq (%rax),%rdx
lea    0xeae(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <printf@plt>
mov    0x2e0c(%rip),%rax
movslq (%rax),%rsi
mov    0x2dfa(%rip),%rax
movslq (%rax),%rdx
lea    0xea2(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e34(%rip),%rax
movslq (%rax),%rdx
lea    0xea5(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <printf@plt>
mov    0x2dfa(%rip),%rax
movslq (%rax),%rsi
mov    0x2e08(%rip),%rax
movslq (%rax),%rdx
lea    0xe9a(%rip),%rdi
call   1050 <printf@plt>
mov    0x2dea(%rip),%rax
movslq (%rax),%rdx
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <printf@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%rsi
mov    0x2d96(%rip),%rax
mov    (%rax),%rdx
lea    0xe8e(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%rdx
lea    0xe92(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe92(%rip),%rdi
call   1040 <puts@plt>
movb   $0x7f,-0x5(%rbp)
movw   $0x7fff,-0x8(%rbp)
movl   $0x7fffffff,-0xc(%rbp)
movabs $0x7fffffffffffffff,%rax
ff ff 7f
mov    %rax,-0x18(%rbp)
movzbl -0x5(%rbp),%eax
add    $0x1,%eax
movsbq %al,%rsi
movzbl -0x5(%rbp),%eax
mov    %eax,%edx
lea    0xd92(%rip),%rdi
call   1050 <printf@plt>
lea    0xd9e(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xff,%edx
call   1050 <printf@plt>
movzwl -0x8(%rbp),%eax
add    $0x1,%eax
movswq %ax,%rsi
movzwl -0x8(%rbp),%eax
mov    %eax,%edx
lea    0xd90(%rip),%rdi
call   1050 <printf@plt>
lea    0xd9d(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffff,%edx
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %eax,%esi
mov    -0xc(%rbp),%eax
mov    %eax,%edx
lea    0xd92(%rip),%rdi
call   1050 <printf@plt>
lea    0xd9d(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffff,%edx
call   1050 <printf@plt>
mov    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    -0x18(%rbp),%rdx
lea    0xd93(%rip),%rdi
call   1050 <printf@plt>
lea    0xda1(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xffffffffffffffff,%rdx
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
call   1040 <puts@plt>
mov    0x2e62(%rip),%rax
movslq (%rax),%rsi
mov    0x2e50(%rip),%rax
movslq (%rax),%rdx
lea    0xeb0(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e82(%rip),%rax
movslq (%rax),%rdx
lea    0xeb2(%rip),%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    0x2e12(%rip),%rax
movslq (%rax),%rsi
mov    0x2e00(%rip),%rax
movslq (%rax),%rdx
lea    0xea8(%rip),%rbx
mov    %rbx,%rdi
call   1050 <printf@plt>
mov    0x2e37(%rip),%rax
movslq (%rax),%rdx
lea    0xea8(%rip),%r13
mov    %r13,%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    0x2dfc(%rip),%rax
movslq (%rax),%rsi
mov    0x2e0a(%rip),%rax
movslq (%rax),%rdx
lea    0xe9c(%rip),%r12
mov    %r12,%rdi
call   1050 <printf@plt>
mov    0x2de9(%rip),%rax
movslq (%rax),%rdx
lea    0xe9a(%rip),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    0x2dc6(%rip),%rax
mov    (%rax),%rsi
mov    0x2d94(%rip),%rax
mov    (%rax),%rdx
lea    0xe8c(%rip),%r14
mov    %r14,%rdi
call   1050 <printf@plt>
mov    0x2d5b(%rip),%rax
mov    (%rax),%rdx
lea    0xe8d(%rip),%r15
mov    %r15,%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
mov    $0x7f,%edx
lea    0xdb7(%rip),%rdi
mov    $0xffffffffffffff80,%rsi
call   1050 <printf@plt>
mov    $0xff,%edx
lea    0xdb7(%rip),%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    $0x7fff,%edx
mov    %rbx,%rdi
mov    $0xffffffffffff8000,%rsi
call   1050 <printf@plt>
mov    $0xffff,%edx
mov    %r13,%rdi
xor    %esi,%esi
call   1050 <printf@plt>
mov    $0x80000000,%ebx
mov    $0x80000000,%esi
mov    $0x7fffffff,%edx
mov    %r12,%rdi
call   1050 <printf@plt>
or     $0x7fffffff,%rbx
mov    %rbp,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1050 <printf@plt>
movabs $0x7fffffffffffffff,%rdx
ff ff 7f
lea    0x1(%rdx),%rsi
mov    %r14,%rdi
call   1050 <printf@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0xffffffffffffffff,%rdx
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Standard headers:\00"
@.str.1 = [24 x i8] c" signed char:\09%d - %d\0A\00"
@SCHAR_MIN = global i32 0
@SCHAR_MAX = global i32 0
@.str.2 = [24 x i8] c"unsigned char:\09%u - %u\0A\00"
@UCHAR_MAX = global i32 0
@.str.3 = [25 x i8] c" signed short:\09%d - %d\0A\00"
@SHRT_MIN = global i32 0
@SHRT_MAX = global i32 0
@.str.4 = [25 x i8] c"unsigned short:\09%u - %u\0A\00"
@USHRT_MAX = global i32 0
@.str.5 = [23 x i8] c" signed int:\09%d - %d\0A\00"
@INT_MIN = global i32 0
@INT_MAX = global i32 0
@.str.6 = [23 x i8] c"unsigned int:\09%u - %u\0A\00"
@UINT_MAX = global i32 0
@.str.7 = [26 x i8] c" signed long:\09%ld - %ld\0A\00"
@LONG_MIN = global i64 0
@LONG_MAX = global i64 0
@.str.8 = [26 x i8] c"unsigned long:\09%lu - %lu\0A\00"
@ULONG_MAX = global i64 0
@.str.9 = [20 x i8] c"Direct computation:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i16
%4 = alloca i32
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 @puts(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @SCHAR_MIN
%8 = sext i32 %7 to i64
%9 = load i32, i32* @SCHAR_MAX
%10 = sext i32 %9 to i64
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %8, i64 %10)
%12 = load i32, i32* @UCHAR_MAX
%13 = sext i32 %12 to i64
%14 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 0, i64 %13)
%15 = load i32, i32* @SHRT_MIN
%16 = sext i32 %15 to i64
%17 = load i32, i32* @SHRT_MAX
%18 = sext i32 %17 to i64
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i64 %16, i64 %18)
%20 = load i32, i32* @USHRT_MAX
%21 = sext i32 %20 to i64
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 0, i64 %21)
%23 = load i32, i32* @INT_MIN
%24 = sext i32 %23 to i64
%25 = load i32, i32* @INT_MAX
%26 = sext i32 %25 to i64
%27 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 %24, i64 %26)
%28 = load i32, i32* @UINT_MAX
%29 = sext i32 %28 to i64
%30 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i64 0, i64 %29)
%31 = load i64, i64* @LONG_MIN
%32 = load i64, i64* @LONG_MAX
%33 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i64 %31, i64 %32)
%34 = load i64, i64* @ULONG_MAX
%35 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i64 0, i64 %34)
%36 = call i32 @putchar(i8 signext 10)
%37 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
store i8 127, i8* %2
store i16 32767, i16* %3
store i32 2147483647, i32* %4
store i64 9223372036854775807, i64* %5
%38 = load i8, i8* %2
%39 = zext i8 %38 to i32
%40 = add nsw i32 %39, 1
%41 = trunc i32 %40 to i8
%42 = sext i8 %41 to i64
%43 = load i8, i8* %2
%44 = zext i8 %43 to i64
%45 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %42, i64 %44)
%46 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 0, i64 255)
%47 = load i16, i16* %3
%48 = zext i16 %47 to i32
%49 = add nsw i32 %48, 1
%50 = trunc i32 %49 to i16
%51 = sext i16 %50 to i64
%52 = load i16, i16* %3
%53 = zext i16 %52 to i64
%54 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i64 %51, i64 %53)
%55 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 0, i64 65535)
%56 = load i32, i32* %4
%57 = add i32 %56, 1
%58 = zext i32 %57 to i64
%59 = load i32, i32* %4
%60 = zext i32 %59 to i64
%61 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 %58, i64 %60)
%62 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i64 0, i64 4294967295)
%63 = load i64, i64* %5
%64 = add i64 %63, 1
%65 = load i64, i64* %5
%66 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i64 %64, i64 %65)
%67 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i64 0, i64 -1)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Standard headers:\00"
@.str.1 = [24 x i8] c" signed char:\09%d - %d\0A\00"
@SCHAR_MIN = global i32 0
@SCHAR_MAX = global i32 0
@.str.2 = [24 x i8] c"unsigned char:\09%u - %u\0A\00"
@UCHAR_MAX = global i32 0
@.str.3 = [25 x i8] c" signed short:\09%d - %d\0A\00"
@SHRT_MIN = global i32 0
@SHRT_MAX = global i32 0
@.str.4 = [25 x i8] c"unsigned short:\09%u - %u\0A\00"
@USHRT_MAX = global i32 0
@.str.5 = [23 x i8] c" signed int:\09%d - %d\0A\00"
@INT_MIN = global i32 0
@INT_MAX = global i32 0
@.str.6 = [23 x i8] c"unsigned int:\09%u - %u\0A\00"
@UINT_MAX = global i32 0
@.str.7 = [26 x i8] c" signed long:\09%ld - %ld\0A\00"
@LONG_MIN = global i64 0
@LONG_MAX = global i64 0
@.str.8 = [26 x i8] c"unsigned long:\09%lu - %lu\0A\00"
@ULONG_MAX = global i64 0
@.str.9 = [20 x i8] c"Direct computation:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @SCHAR_MIN
%3 = sext i32 %2 to i64
%4 = load i32, i32* @SCHAR_MAX
%5 = sext i32 %4 to i64
%6 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 %3, i64 %5)
%7 = load i32, i32* @UCHAR_MAX
%8 = sext i32 %7 to i64
%9 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 0, i64 %8)
%10 = load i32, i32* @SHRT_MIN
%11 = sext i32 %10 to i64
%12 = load i32, i32* @SHRT_MAX
%13 = sext i32 %12 to i64
%14 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i64 %11, i64 %13)
%15 = load i32, i32* @USHRT_MAX
%16 = sext i32 %15 to i64
%17 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 0, i64 %16)
%18 = load i32, i32* @INT_MIN
%19 = sext i32 %18 to i64
%20 = load i32, i32* @INT_MAX
%21 = sext i32 %20 to i64
%22 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 %19, i64 %21)
%23 = load i32, i32* @UINT_MAX
%24 = sext i32 %23 to i64
%25 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i64 0, i64 %24)
%26 = load i64, i64* @LONG_MIN
%27 = load i64, i64* @LONG_MAX
%28 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i64 %26, i64 %27)
%29 = load i64, i64* @ULONG_MAX
%30 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i64 0, i64 %29)
%31 = tail call i32 @putchar(i8 signext 10)
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0))
%33 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i64 -128, i64 127)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 0, i64 255)
%35 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i64 -32768, i64 32767)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i64 0, i64 65535)
%37 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i64 2147483648, i64 2147483647)
%38 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i64 0, i64 4294967295)
%39 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i64 -9223372036854775808, i64 9223372036854775807)
%40 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0), i64 0, i64 -1)
ret i32 0
}