#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 /*<<< orphan*/ INT_MIN;
int /*<<< orphan*/ LONG_MIN;
int /*<<< orphan*/ SCHAR_MIN;
int /*<<< orphan*/ SHRT_MIN;
int /*<<< orphan*/ UCHAR_MAX;
int /*<<< orphan*/ UINT_MAX;
int /*<<< orphan*/ ULONG_MAX;
int /*<<< orphan*/ USHRT_MAX;
int /*<<< orphan*/ char_range();
int /*<<< orphan*/ int_range();
int /*<<< orphan*/ long_range();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ printsh(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ short_range();
int main(void) {
  printf("From standard headers:\n");
  printsh("char", SCHAR_MIN, UCHAR_MAX);
  printsh("short", SHRT_MIN, USHRT_MAX);
  printsh("int", INT_MIN, UINT_MAX);
  printsh("long", LONG_MIN, ULONG_MAX);
  printf("\nBy direct computation:\n");
  char_range();
  short_range();
  int_range();
  long_range();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%esi
mov    0x2e65(%rip),%rax
mov    (%rax),%edx
lea    0xe84(%rip),%rdi
call   1040 <printsh@plt>
mov    0x2e10(%rip),%rax
mov    (%rax),%esi
mov    0x2e37(%rip),%rax
mov    (%rax),%edx
lea    0xe6b(%rip),%rdi
call   1040 <printsh@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%esi
mov    0x2e11(%rip),%rax
mov    (%rax),%edx
lea    0xe53(%rip),%rdi
call   1040 <printsh@plt>
mov    0x2df4(%rip),%rax
mov    (%rax),%esi
mov    0x2dbb(%rip),%rax
mov    (%rax),%edx
lea    0xe39(%rip),%rdi
call   1040 <printsh@plt>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <char_range@plt>
mov    $0x0,%al
call   1060 <short_range@plt>
mov    $0x0,%al
call   1070 <int_range@plt>
mov    $0x0,%al
call   1080 <long_range@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%esi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
lea    0xe7a(%rip),%rdi
call   1040 <printsh@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%esi
mov    0x2e45(%rip),%rax
mov    (%rax),%edx
lea    0xe61(%rip),%rdi
call   1040 <printsh@plt>
mov    0x2e18(%rip),%rax
mov    (%rax),%esi
mov    0x2e1f(%rip),%rax
mov    (%rax),%edx
lea    0xe49(%rip),%rdi
call   1040 <printsh@plt>
mov    0x2e02(%rip),%rax
mov    (%rax),%esi
mov    0x2dc9(%rip),%rax
mov    (%rax),%edx
lea    0xe2f(%rip),%rdi
call   1040 <printsh@plt>
lea    0xe3f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <char_range@plt>
xor    %eax,%eax
call   1060 <short_range@plt>
xor    %eax,%eax
call   1070 <int_range@plt>
xor    %eax,%eax
call   1080 <long_range@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"From standard headers:\0A\00"
@.str.1 = [5 x i8] c"char\00"
@SCHAR_MIN = global i32 0
@UCHAR_MAX = global i32 0
@.str.2 = [6 x i8] c"short\00"
@SHRT_MIN = global i32 0
@USHRT_MAX = global i32 0
@.str.3 = [4 x i8] c"int\00"
@INT_MIN = global i32 0
@UINT_MAX = global i32 0
@.str.4 = [5 x i8] c"long\00"
@LONG_MIN = global i32 0
@ULONG_MAX = global i32 0
@.str.5 = [25 x i8] c"\0ABy direct computation:\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @SCHAR_MIN
%4 = load i32, i32* @UCHAR_MAX
%5 = call i32 @printsh(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 %4)
%6 = load i32, i32* @SHRT_MIN
%7 = load i32, i32* @USHRT_MAX
%8 = call i32 @printsh(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7)
%9 = load i32, i32* @INT_MIN
%10 = load i32, i32* @UINT_MAX
%11 = call i32 @printsh(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %9, i32 %10)
%12 = load i32, i32* @LONG_MIN
%13 = load i32, i32* @ULONG_MAX
%14 = call i32 @printsh(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %12, i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
%16 = call i32 (...) @char_range()
%17 = call i32 (...) @short_range()
%18 = call i32 (...) @int_range()
%19 = call i32 (...) @long_range()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"char\00"
@SCHAR_MIN = global i32 0
@UCHAR_MAX = global i32 0
@.str.2 = [6 x i8] c"short\00"
@SHRT_MIN = global i32 0
@USHRT_MAX = global i32 0
@.str.3 = [4 x i8] c"int\00"
@INT_MIN = global i32 0
@UINT_MAX = global i32 0
@.str.4 = [5 x i8] c"long\00"
@LONG_MIN = global i32 0
@ULONG_MAX = global i32 0
@str = [23 x i8] c"From standard headers:\00"
@str.6 = [24 x i8] c"\0ABy direct computation:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @SCHAR_MIN
%3 = load i32, i32* @UCHAR_MAX
%4 = tail call i32 @printsh(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %2, i32 %3)
%5 = load i32, i32* @SHRT_MIN
%6 = load i32, i32* @USHRT_MAX
%7 = tail call i32 @printsh(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %5, i32 %6)
%8 = load i32, i32* @INT_MIN
%9 = load i32, i32* @UINT_MAX
%10 = tail call i32 @printsh(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* @LONG_MIN
%12 = load i32, i32* @ULONG_MAX
%13 = tail call i32 @printsh(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %11, i32 %12)
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.6, i64 0, i64 0))
%15 = tail call i32 (...) @char_range()
%16 = tail call i32 (...) @short_range()
%17 = tail call i32 (...) @int_range()
%18 = tail call i32 (...) @long_range()
ret i32 0
}