#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 base;

/* Variables and functions */
unsigned int CHAR_BIT;
int is_bigendian();
int /*<<< orphan*/ printf(char *, ...);
void calculate_ranges(void) {
  printf("The output will have the following syntax:\n");
  printf("TYPE\n\tunsigned: max-value\n\tsigned: min-value TO max-value\n\n");
  printf("CHAR\n\tunsigned: %u\n\tsigned: %d TO %d\n\n", ((unsigned char)~0),
         -((char)(((unsigned char)~0) >> 1)) - 1,
         ((char)(((unsigned char)~0) >> 1)));
  printf("SHORT\n\tunsigned: %u\n\tsigned: %d TO %d\n\n", ((unsigned short)~0),
         -((short)(((unsigned short)~0) >> 1)) - 1,
         ((short)(((unsigned short)~0) >> 1)));
  printf("INT\n\tunsigned: %u\n\tsigned: %d TO %d\n\n", ((unsigned int)~0),
         -((int)(((unsigned int)~0) >> 1)) - 1,
         ((int)(((unsigned int)~0) >> 1)));
  printf("LONG\n\tunsigned: %lu\n\tsigned: %ld TO %ld\n\n", ((unsigned long)~0),
         -((long)(((unsigned long)~0) >> 1)) - 1,
         ((long)(((unsigned long)~0) >> 1)));
  {
    int be = is_bigendian(), base = 0, i;
    unsigned int m = 0;
    unsigned char my_type[sizeof(float)] = {0};
    float *f = (float *)my_type;
    if (!be)
      base = sizeof(float) - 1;
    float a = 1.0;
    float b = 0.5;
    float c = a + b;
    while (c != a) {
      m++;
      b /= 2;
      c = a + b;
    }
    my_type[((base) != 0 ? ((base) - (sizeof(float) - 1))
                         : (sizeof(float) - 1))] = 1;
    printf("float"
           "\n\tLowest possible number with precision loss (only 1 precision "
           "bit): %g\n",
           *f);
    my_type[((base) != 0 ? ((base) - (sizeof(float) - 1))
                         : (sizeof(float) - 1))] = 0;
    ((my_type)[((base) != 0 ? ((base) - (sizeof(float) - m / CHAR_BIT - 1))
                            : (sizeof(float) - m / CHAR_BIT - 1))] |=
     (unsigned char)1 << (m % CHAR_BIT));
    printf("\tWithout precision loss: %g", *f);
    for (i = 0; i < sizeof(float); i++)
      my_type[i] = ~my_type[i];
    ((my_type)[((base) != 0 ? ((base) - (0)) : (0))] &=
     ~((unsigned char)1 << (CHAR_BIT - 1)));
    printf(" TO %g\n", *f);
  };
  {
    int be = is_bigendian(), base = 0, i;
    unsigned int m = 0;
    unsigned char my_type[sizeof(double)] = {0};
    double *f = (double *)my_type;
    if (!be)
      base = sizeof(double) - 1;
    double a = 1.0;
    double b = 0.5;
    double c = a + b;
    while (c != a) {
      m++;
      b /= 2;
      c = a + b;
    }
    my_type[((base) != 0 ? ((base) - (sizeof(double) - 1))
                         : (sizeof(double) - 1))] = 1;
    printf("double"
           "\n\tLowest possible number with precision loss (only 1 precision "
           "bit): %g\n",
           *f);
    my_type[((base) != 0 ? ((base) - (sizeof(double) - 1))
                         : (sizeof(double) - 1))] = 0;
    ((my_type)[((base) != 0 ? ((base) - (sizeof(double) - m / CHAR_BIT - 1))
                            : (sizeof(double) - m / CHAR_BIT - 1))] |=
     (unsigned char)1 << (m % CHAR_BIT));
    printf("\tWithout precision loss: %g", *f);
    for (i = 0; i < sizeof(double); i++)
      my_type[i] = ~my_type[i];
    ((my_type)[((base) != 0 ? ((base) - (0)) : (0))] &=
     ~((unsigned char)1 << (CHAR_BIT - 1)));
    printf(" TO %g\n", *f);
  };
}


x86 assembly (clang, -O0):
<calculate_ranges>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf32(%rip),%rdi
mov    $0xff,%esi
mov    $0xffffff80,%edx
mov    $0x7f,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf3c(%rip),%rdi
mov    $0xffff,%esi
mov    $0xffff8000,%edx
mov    $0x7fff,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf47(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x80000000,%edx
mov    $0x7fffffff,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf50(%rip),%rdi
mov    $0xffffffffffffffff,%rsi
movabs $0x8000000000000000,%rdx
movabs $0x7fffffffffffffff,%rcx
ff ff 7f
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <is_bigendian@plt>
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1050 <memset@plt>
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1218 <calculate_ranges+0xe8>
movl   $0x3,-0x8(%rbp)
movss  0xde4(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  0xdd3(%rip),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
ucomiss -0x24(%rbp),%xmm0
jne    125b <calculate_ranges+0x12b>
jp     125b <calculate_ranges+0x12b>
jmp    128e <calculate_ranges+0x15e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movss  -0x28(%rbp),%xmm0
movss  0xd97(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x24(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1241 <calculate_ranges+0x111>
cmpl   $0x0,-0x8(%rbp)
je     12a9 <calculate_ranges+0x179>
movslq -0x8(%rbp),%rax
sub    $0x3,%rax
mov    %rax,-0x70(%rbp)
jmp    12b7 <calculate_ranges+0x187>
mov    $0x3,%eax
mov    %rax,-0x70(%rbp)
jmp    12b7 <calculate_ranges+0x187>
mov    -0x70(%rbp),%rax
movb   $0x1,-0x14(%rbp,%rax,1)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     12f5 <calculate_ranges+0x1c5>
movslq -0x8(%rbp),%rax
sub    $0x3,%rax
mov    %rax,-0x78(%rbp)
jmp    1303 <calculate_ranges+0x1d3>
mov    $0x3,%eax
mov    %rax,-0x78(%rbp)
jmp    1303 <calculate_ranges+0x1d3>
mov    -0x78(%rbp),%rax
movb   $0x0,-0x14(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
mov    0x2cca(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1371 <calculate_ranges+0x241>
movslq -0x8(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x10(%rbp),%eax
mov    0x2c9b(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %eax,%ecx
mov    -0x90(%rbp),%rax
mov    %ecx,%ecx
mov    %ecx,%edx
mov    $0x4,%ecx
sub    %rdx,%rcx
sub    $0x1,%rcx
sub    %rcx,%rax
mov    %rax,-0x88(%rbp)
jmp    1396 <calculate_ranges+0x266>
mov    -0x10(%rbp),%eax
mov    0x2c65(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x4,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    %rax,-0x88(%rbp)
mov    -0x7c(%rbp),%edx
mov    -0x88(%rbp),%rax
movzbl -0x14(%rbp,%rax,1),%ecx
or     %edx,%ecx
mov    %cl,-0x14(%rbp,%rax,1)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdbf(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
movslq -0xc(%rbp),%rax
cmp    $0x4,%rax
jae    13fe <calculate_ranges+0x2ce>
movslq -0xc(%rbp),%rax
movzbl -0x14(%rbp,%rax,1),%eax
xor    $0xffffffff,%eax
mov    %al,%cl
movslq -0xc(%rbp),%rax
mov    %cl,-0x14(%rbp,%rax,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    13cc <calculate_ranges+0x29c>
mov    0x2bdb(%rip),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0x94(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1435 <calculate_ranges+0x305>
mov    -0x8(%rbp),%eax
sub    $0x0,%eax
mov    %eax,-0x98(%rbp)
jmp    1442 <calculate_ranges+0x312>
xor    %eax,%eax
mov    %eax,-0x98(%rbp)
jmp    1442 <calculate_ranges+0x312>
mov    -0x94(%rbp),%edx
mov    -0x98(%rbp),%eax
cltq
movzbl -0x14(%rbp,%rax,1),%ecx
and    %edx,%ecx
mov    %cl,-0x14(%rbp,%rax,1)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd2b(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <is_bigendian@plt>
mov    %eax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    -0x44(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1050 <memset@plt>
lea    -0x44(%rbp),%rax
mov    %rax,-0x50(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    14b6 <calculate_ranges+0x386>
movl   $0x7,-0x34(%rbp)
movsd  0xb5a(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  0xb45(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
ucomisd -0x58(%rbp),%xmm0
jne    14fa <calculate_ranges+0x3ca>
jp     14fa <calculate_ranges+0x3ca>
jmp    152d <calculate_ranges+0x3fd>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xb10(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    14df <calculate_ranges+0x3af>
cmpl   $0x0,-0x34(%rbp)
je     154b <calculate_ranges+0x41b>
movslq -0x34(%rbp),%rax
sub    $0x7,%rax
mov    %rax,-0xa0(%rbp)
jmp    155c <calculate_ranges+0x42c>
mov    $0x7,%eax
mov    %rax,-0xa0(%rbp)
jmp    155c <calculate_ranges+0x42c>
mov    -0xa0(%rbp),%rax
movb   $0x1,-0x44(%rbp,%rax,1)
mov    -0x50(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xc2a(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x34(%rbp)
je     159c <calculate_ranges+0x46c>
movslq -0x34(%rbp),%rax
sub    $0x7,%rax
mov    %rax,-0xa8(%rbp)
jmp    15ad <calculate_ranges+0x47d>
mov    $0x7,%eax
mov    %rax,-0xa8(%rbp)
jmp    15ad <calculate_ranges+0x47d>
mov    -0xa8(%rbp),%rax
movb   $0x0,-0x44(%rbp,%rax,1)
mov    -0x3c(%rbp),%eax
mov    0x2a1d(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xac(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     1621 <calculate_ranges+0x4f1>
movslq -0x34(%rbp),%rax
mov    %rax,-0xc0(%rbp)
mov    -0x3c(%rbp),%eax
mov    0x29eb(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %eax,%ecx
mov    -0xc0(%rbp),%rax
mov    %ecx,%ecx
mov    %ecx,%edx
mov    $0x8,%ecx
sub    %rdx,%rcx
sub    $0x1,%rcx
sub    %rcx,%rax
mov    %rax,-0xb8(%rbp)
jmp    1646 <calculate_ranges+0x516>
mov    -0x3c(%rbp),%eax
mov    0x29b5(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x8,%eax
sub    %rcx,%rax
sub    $0x1,%rax
mov    %rax,-0xb8(%rbp)
mov    -0xac(%rbp),%edx
mov    -0xb8(%rbp),%rax
movzbl -0x44(%rbp,%rax,1),%ecx
or     %edx,%ecx
mov    %cl,-0x44(%rbp,%rax,1)
mov    -0x50(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xb10(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movl   $0x0,-0x38(%rbp)
movslq -0x38(%rbp),%rax
cmp    $0x8,%rax
jae    16ad <calculate_ranges+0x57d>
movslq -0x38(%rbp),%rax
movzbl -0x44(%rbp,%rax,1),%eax
xor    $0xffffffff,%eax
mov    %al,%cl
movslq -0x38(%rbp),%rax
mov    %cl,-0x44(%rbp,%rax,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    167b <calculate_ranges+0x54b>
mov    0x292c(%rip),%rax
mov    (%rax),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
xor    $0xffffffff,%eax
mov    %eax,-0xc4(%rbp)
cmpl   $0x0,-0x34(%rbp)
je     16e4 <calculate_ranges+0x5b4>
mov    -0x34(%rbp),%eax
sub    $0x0,%eax
mov    %eax,-0xc8(%rbp)
jmp    16f1 <calculate_ranges+0x5c1>
xor    %eax,%eax
mov    %eax,-0xc8(%rbp)
jmp    16f1 <calculate_ranges+0x5c1>
mov    -0xc4(%rbp),%edx
mov    -0xc8(%rbp),%eax
cltq
movzbl -0x44(%rbp,%rax,1),%ecx
and    %edx,%ecx
mov    %cl,-0x44(%rbp,%rax,1)
mov    -0x50(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xa80(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_ranges>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x101b(%rip),%rdi
call   1040 <puts@plt>
lea    0x103a(%rip),%rdi
call   1040 <puts@plt>
lea    0xea3(%rip),%rdi
mov    $0xff,%esi
mov    $0xffffff80,%edx
mov    $0x7f,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0xffff,%esi
mov    $0xffff8000,%edx
mov    $0x7fff,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0xffffffff,%esi
mov    $0x80000000,%edx
mov    $0x7fffffff,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
movabs $0x7fffffffffffffff,%rcx
ff ff 7f
lea    0x1(%rcx),%rdx
lea    0xeb3(%rip),%rdi
mov    $0xffffffffffffffff,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <is_bigendian@plt>
mov    %eax,%ebx
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
test   %ebx,%ebx
setne  %al
lea    (%rax,%rax,2),%rbp
lea    0x4(%rsp),%r15
or     %r15,%rbp
movb   $0x1,0x0(%rbp)
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    0x2dc9(%rip),%r13
mov    $0x17,%eax
xor    %edx,%edx
divl   0x0(%r13)
mov    %edx,%ecx
mov    $0x3,%edx
sub    %rax,%rdx
xor    %esi,%esi
test   %ebx,%ebx
sete   %sil
lea    (%rsi,%rsi,2),%rbx
lea    -0x3(%rax,%rbx,1),%rax
cmovne %rdx,%rax
mov    $0x1,%edx
shl    %cl,%edx
movb   $0x0,0x0(%rbp)
or     %dl,0x4(%rsp,%rax,1)
mov    $0x1,%r14d
movss  0x4(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xe80(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movd   0x10(%rsp),%xmm0
movd   %xmm0,%eax
mov    %eax,%ecx
not    %cl
mov    %cl,0x4(%rsp)
mov    %eax,%ecx
shr    $0x8,%ecx
not    %cl
mov    %cl,0x5(%rsp)
mov    %eax,%ecx
shr    $0x10,%ecx
not    %cl
mov    %cl,0x6(%rsp)
shr    $0x18,%eax
not    %al
mov    %al,0x7(%rsp)
mov    0x0(%r13),%cl
add    $0xff,%cl
mov    $0x1,%eax
shl    %cl,%eax
or     %rbx,%r15
not    %al
and    %al,(%r15)
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <is_bigendian@plt>
mov    %eax,%ebp
movq   $0x0,0x8(%rsp)
test   %eax,%eax
mov    $0x7,%r15d
mov    $0x7,%ebx
mov    $0x0,%r12d
cmove  %r12,%rbx
movb   $0x1,0x8(%rsp,%rbx,1)
movsd  0x8(%rsp),%xmm0
lea    0xe03(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    $0x34,%eax
xor    %edx,%edx
divl   0x0(%r13)
mov    %edx,%ecx
mov    $0x7,%edx
sub    %rax,%rdx
test   %ebp,%ebp
cmovne %r12,%r15
movb   $0x0,0x8(%rsp,%rbx,1)
lea    -0x7(%r15,%rax,1),%rax
cmovne %rdx,%rax
mov    $0x1,%edx
shl    %cl,%edx
or     %dl,0x8(%rsp,%rax,1)
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xd91(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movq   0x10(%rsp),%xmm0
movq   %xmm0,%rax
mov    %eax,%ecx
not    %cl
mov    %cl,0x8(%rsp)
mov    %rax,%rcx
shr    $0x8,%rcx
not    %cl
mov    %cl,0x9(%rsp)
mov    %rax,%rcx
shr    $0x10,%rcx
not    %cl
mov    %cl,0xa(%rsp)
mov    %rax,%rcx
shr    $0x18,%rcx
not    %cl
mov    %cl,0xb(%rsp)
mov    %rax,%rcx
shr    $0x20,%rcx
not    %cl
mov    %cl,0xc(%rsp)
mov    %rax,%rcx
shr    $0x28,%rcx
not    %cl
mov    %cl,0xd(%rsp)
mov    %rax,%rcx
shr    $0x30,%rcx
not    %cl
mov    %cl,0xe(%rsp)
shr    $0x38,%rax
not    %al
mov    %al,0xf(%rsp)
mov    0x0(%r13),%cl
add    $0xff,%cl
shl    %cl,%r14d
not    %r14b
and    %r14b,0x8(%rsp,%r15,1)
movsd  0x8(%rsp),%xmm0
lea    0xd1c(%rip),%rdi
mov    $0x1,%al
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"The output will have the following syntax:\0A\00"
@.str.1 = [60 x i8] c"TYPE\0A\09unsigned: max-value\0A\09signed: min-value TO max-value\0A\0A\00"
@.str.2 = [39 x i8] c"CHAR\0A\09unsigned: %u\0A\09signed: %d TO %d\0A\0A\00"
@.str.3 = [40 x i8] c"SHORT\0A\09unsigned: %u\0A\09signed: %d TO %d\0A\0A\00"
@.str.4 = [38 x i8] c"INT\0A\09unsigned: %u\0A\09signed: %d TO %d\0A\0A\00"
@.str.5 = [42 x i8] c"LONG\0A\09unsigned: %lu\0A\09signed: %ld TO %ld\0A\0A\00"
@.str.6 = [78 x i8] c"float\0A\09Lowest possible number with precision loss (only 1 precision bit): %g\0A\00"
@CHAR_BIT = global i32 0
@.str.7 = [28 x i8] c"\09Without precision loss: %g\00"
@.str.8 = [8 x i8] c" TO %g\0A\00"
@.str.9 = [79 x i8] c"double\0A\09Lowest possible number with precision loss (only 1 precision bit): %g\0A\00"
define void @calculate_ranges() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [4 x i8]
%6 = alloca float*
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [8 x i8]
%15 = alloca double*
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 255, i32 -128, i32 127)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 65535, i32 -32768, i32 32767)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 -1, i32 -2147483648, i32 2147483647)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i64 -1, i64 -9223372036854775808, i64 9223372036854775807)
%25 = call i32 (...) @is_bigendian()
store i32 %25, i32* %1
store i32 0, i32* %2
store i32 0, i32* %4
%26 = bitcast [4 x i8]* %5 to i8*
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 0
%28 = bitcast i8* %27 to float*
store float* %28, float** %6
%29 = load i32, i32* %1
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %0
store i32 3, i32* %2
br label %32
32: ; preds = %31, %0
store float 1.000000e+00, float* %7
store float 5.000000e-01, float* %8
%33 = load float, float* %7
%34 = load float, float* %8
%35 = fadd float %33, %34
store float %35, float* %9
br label %36
36: ; preds = %40, %32
%37 = load float, float* %9
%38 = load float, float* %7
%39 = fcmp une float %37, %38
br i1 %39, label %40, label %48
40: ; preds = %36
%41 = load i32, i32* %4
%42 = add i32 %41, 1
store i32 %42, i32* %4
%43 = load float, float* %8
%44 = fdiv float %43, 2.000000e+00
store float %44, float* %8
%45 = load float, float* %7
%46 = load float, float* %8
%47 = fadd float %45, %46
store float %47, float* %9
br label %36
48: ; preds = %36
%49 = load i32, i32* %2
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %55
51: ; preds = %48
%52 = load i32, i32* %2
%53 = sext i32 %52 to i64
%54 = sub i64 %53, 3
br label %56
55: ; preds = %48
br label %56
56: ; preds = %55, %51
%57 = phi i64 [ %54, %51 ], [ 3, %55 ]
%58 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %57
store i8 1, i8* %58
%59 = load float*, float** %6
%60 = load float, float* %59
%61 = fpext float %60 to double
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.6, i64 0, i64 0), double %61)
%63 = load i32, i32* %2
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %69
65: ; preds = %56
%66 = load i32, i32* %2
%67 = sext i32 %66 to i64
%68 = sub i64 %67, 3
br label %70
69: ; preds = %56
br label %70
70: ; preds = %69, %65
%71 = phi i64 [ %68, %65 ], [ 3, %69 ]
%72 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %71
store i8 0, i8* %72
%73 = load i32, i32* %4
%74 = load i32, i32* @CHAR_BIT
%75 = urem i32 %73, %74
%76 = shl i32 1, %75
%77 = load i32, i32* %2
%78 = icmp ne i32 %77, 0
br i1 %78, label %79, label %89
79: ; preds = %70
%80 = load i32, i32* %2
%81 = sext i32 %80 to i64
%82 = load i32, i32* %4
%83 = load i32, i32* @CHAR_BIT
%84 = udiv i32 %82, %83
%85 = zext i32 %84 to i64
%86 = sub i64 4, %85
%87 = sub i64 %86, 1
%88 = sub i64 %81, %87
br label %96
89: ; preds = %70
%90 = load i32, i32* %4
%91 = load i32, i32* @CHAR_BIT
%92 = udiv i32 %90, %91
%93 = zext i32 %92 to i64
%94 = sub i64 4, %93
%95 = sub i64 %94, 1
br label %96
96: ; preds = %89, %79
%97 = phi i64 [ %88, %79 ], [ %95, %89 ]
%98 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %97
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = or i32 %100, %76
%102 = trunc i32 %101 to i8
store i8 %102, i8* %98
%103 = load float*, float** %6
%104 = load float, float* %103
%105 = fpext float %104 to double
%106 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %105)
store i32 0, i32* %3
br label %107
107: ; preds = %122, %96
%108 = load i32, i32* %3
%109 = sext i32 %108 to i64
%110 = icmp ult i64 %109, 4
br i1 %110, label %111, label %125
111: ; preds = %107
%112 = load i32, i32* %3
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %113
%115 = load i8, i8* %114
%116 = zext i8 %115 to i32
%117 = xor i32 %116, -1
%118 = trunc i32 %117 to i8
%119 = load i32, i32* %3
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %120
store i8 %118, i8* %121
br label %122
122: ; preds = %111
%123 = load i32, i32* %3
%124 = add nsw i32 %123, 1
store i32 %124, i32* %3
br label %107
125: ; preds = %107
%126 = load i32, i32* @CHAR_BIT
%127 = sub i32 %126, 1
%128 = shl i32 1, %127
%129 = xor i32 %128, -1
%130 = load i32, i32* %2
%131 = icmp ne i32 %130, 0
br i1 %131, label %132, label %135
132: ; preds = %125
%133 = load i32, i32* %2
%134 = sub nsw i32 %133, 0
br label %136
135: ; preds = %125
br label %136
136: ; preds = %135, %132
%137 = phi i32 [ %134, %132 ], [ 0, %135 ]
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [4 x i8], [4 x i8]* %5, i64 0, i64 %138
%140 = load i8, i8* %139
%141 = zext i8 %140 to i32
%142 = and i32 %141, %129
%143 = trunc i32 %142 to i8
store i8 %143, i8* %139
%144 = load float*, float** %6
%145 = load float, float* %144
%146 = fpext float %145 to double
%147 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), double %146)
%148 = call i32 (...) @is_bigendian()
store i32 %148, i32* %10
store i32 0, i32* %11
store i32 0, i32* %13
%149 = bitcast [8 x i8]* %14 to i8*
%150 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 0
%151 = bitcast i8* %150 to double*
store double* %151, double** %15
%152 = load i32, i32* %10
%153 = icmp ne i32 %152, 0
br i1 %153, label %155, label %154
154: ; preds = %136
store i32 7, i32* %11
br label %155
155: ; preds = %154, %136
store double 1.000000e+00, double* %16
store double 5.000000e-01, double* %17
%156 = load double, double* %16
%157 = load double, double* %17
%158 = fadd double %156, %157
store double %158, double* %18
br label %159
159: ; preds = %163, %155
%160 = load double, double* %18
%161 = load double, double* %16
%162 = fcmp une double %160, %161
br i1 %162, label %163, label %171
163: ; preds = %159
%164 = load i32, i32* %13
%165 = add i32 %164, 1
store i32 %165, i32* %13
%166 = load double, double* %17
%167 = fdiv double %166, 2.000000e+00
store double %167, double* %17
%168 = load double, double* %16
%169 = load double, double* %17
%170 = fadd double %168, %169
store double %170, double* %18
br label %159
171: ; preds = %159
%172 = load i32, i32* %11
%173 = icmp ne i32 %172, 0
br i1 %173, label %174, label %178
174: ; preds = %171
%175 = load i32, i32* %11
%176 = sext i32 %175 to i64
%177 = sub i64 %176, 7
br label %179
178: ; preds = %171
br label %179
179: ; preds = %178, %174
%180 = phi i64 [ %177, %174 ], [ 7, %178 ]
%181 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 %180
store i8 1, i8* %181
%182 = load double*, double** %15
%183 = load double, double* %182
%184 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.9, i64 0, i64 0), double %183)
%185 = load i32, i32* %11
%186 = icmp ne i32 %185, 0
br i1 %186, label %187, label %191
187: ; preds = %179
%188 = load i32, i32* %11
%189 = sext i32 %188 to i64
%190 = sub i64 %189, 7
br label %192
191: ; preds = %179
br label %192
192: ; preds = %191, %187
%193 = phi i64 [ %190, %187 ], [ 7, %191 ]
%194 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 %193
store i8 0, i8* %194
%195 = load i32, i32* %13
%196 = load i32, i32* @CHAR_BIT
%197 = urem i32 %195, %196
%198 = shl i32 1, %197
%199 = load i32, i32* %11
%200 = icmp ne i32 %199, 0
br i1 %200, label %201, label %211
201: ; preds = %192
%202 = load i32, i32* %11
%203 = sext i32 %202 to i64
%204 = load i32, i32* %13
%205 = load i32, i32* @CHAR_BIT
%206 = udiv i32 %204, %205
%207 = zext i32 %206 to i64
%208 = sub i64 8, %207
%209 = sub i64 %208, 1
%210 = sub i64 %203, %209
br label %218
211: ; preds = %192
%212 = load i32, i32* %13
%213 = load i32, i32* @CHAR_BIT
%214 = udiv i32 %212, %213
%215 = zext i32 %214 to i64
%216 = sub i64 8, %215
%217 = sub i64 %216, 1
br label %218
218: ; preds = %211, %201
%219 = phi i64 [ %210, %201 ], [ %217, %211 ]
%220 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 %219
%221 = load i8, i8* %220
%222 = zext i8 %221 to i32
%223 = or i32 %222, %198
%224 = trunc i32 %223 to i8
store i8 %224, i8* %220
%225 = load double*, double** %15
%226 = load double, double* %225
%227 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %226)
store i32 0, i32* %12
br label %228
228: ; preds = %243, %218
%229 = load i32, i32* %12
%230 = sext i32 %229 to i64
%231 = icmp ult i64 %230, 8
br i1 %231, label %232, label %246
232: ; preds = %228
%233 = load i32, i32* %12
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 %234
%236 = load i8, i8* %235
%237 = zext i8 %236 to i32
%238 = xor i32 %237, -1
%239 = trunc i32 %238 to i8
%240 = load i32, i32* %12
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 %241
store i8 %239, i8* %242
br label %243
243: ; preds = %232
%244 = load i32, i32* %12
%245 = add nsw i32 %244, 1
store i32 %245, i32* %12
br label %228
246: ; preds = %228
%247 = load i32, i32* @CHAR_BIT
%248 = sub i32 %247, 1
%249 = shl i32 1, %248
%250 = xor i32 %249, -1
%251 = load i32, i32* %11
%252 = icmp ne i32 %251, 0
br i1 %252, label %253, label %256
253: ; preds = %246
%254 = load i32, i32* %11
%255 = sub nsw i32 %254, 0
br label %257
256: ; preds = %246
br label %257
257: ; preds = %256, %253
%258 = phi i32 [ %255, %253 ], [ 0, %256 ]
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 %259
%261 = load i8, i8* %260
%262 = zext i8 %261 to i32
%263 = and i32 %262, %250
%264 = trunc i32 %263 to i8
store i8 %264, i8* %260
%265 = load double*, double** %15
%266 = load double, double* %265
%267 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), double %266)
ret void
}

LLVM IR (-O2):
@.str.2 = [39 x i8] c"CHAR\0A\09unsigned: %u\0A\09signed: %d TO %d\0A\0A\00"
@.str.3 = [40 x i8] c"SHORT\0A\09unsigned: %u\0A\09signed: %d TO %d\0A\0A\00"
@.str.4 = [38 x i8] c"INT\0A\09unsigned: %u\0A\09signed: %d TO %d\0A\0A\00"
@.str.5 = [42 x i8] c"LONG\0A\09unsigned: %lu\0A\09signed: %ld TO %ld\0A\0A\00"
@.str.6 = [78 x i8] c"float\0A\09Lowest possible number with precision loss (only 1 precision bit): %g\0A\00"
@CHAR_BIT = global i32 0
@.str.7 = [28 x i8] c"\09Without precision loss: %g\00"
@.str.8 = [8 x i8] c" TO %g\0A\00"
@.str.9 = [79 x i8] c"double\0A\09Lowest possible number with precision loss (only 1 precision bit): %g\0A\00"
@str = [43 x i8] c"The output will have the following syntax:\00"
@str.10 = [59 x i8] c"TYPE\0A\09unsigned: max-value\0A\09signed: min-value TO max-value\0A\00"
define void @calculate_ranges() {
%1 = alloca i32
%2 = alloca i64
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str.10, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), i32 255, i32 -128, i32 127)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 65535, i32 -32768, i32 32767)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i32 -1, i32 -2147483648, i32 2147483647)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i64 -1, i64 -9223372036854775808, i64 9223372036854775807)
%9 = tail call i32 (...) @is_bigendian()
%10 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%11 = icmp eq i32 %9, 0
%12 = bitcast i32* %1 to [4 x i8]*
%13 = bitcast i64* %2 to [8 x i8]*
%14 = bitcast i32* %1 to float*
%15 = select i1 %11, i64 3, i64 0
%16 = select i1 %11, i64 0, i64 3
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 %16
store i8 1, i8* %17
%18 = load float, float* %14
%19 = fpext float %18 to double
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.6, i64 0, i64 0), double %19)
store i8 0, i8* %17
%21 = load i32, i32* @CHAR_BIT
%22 = urem i32 23, %21
%23 = shl nuw nsw i32 1, %22
%24 = udiv i32 23, %21
%25 = zext i32 %24 to i64
%26 = add nsw i64 %15, -3
%27 = add nsw i64 %26, %25
%28 = sub nsw i64 3, %25
%29 = select i1 %11, i64 %27, i64 %28
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = trunc i32 %23 to i8
%33 = or i8 %31, %32
store i8 %33, i8* %30
%34 = load float, float* %14
%35 = fpext float %34 to double
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %35)
%37 = bitcast i32* %1 to i8*
%38 = bitcast float %34 to i32
%39 = trunc i32 %38 to i8
%40 = xor i8 %39, -1
store i8 %40, i8* %37
%41 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
%42 = lshr i32 %38, 8
%43 = trunc i32 %42 to i8
%44 = xor i8 %43, -1
store i8 %44, i8* %41
%45 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
%46 = lshr i32 %38, 16
%47 = trunc i32 %46 to i8
%48 = xor i8 %47, -1
store i8 %48, i8* %45
%49 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 3
%50 = lshr i32 %38, 24
%51 = trunc i32 %50 to i8
%52 = xor i8 %51, -1
store i8 %52, i8* %49
%53 = load i32, i32* @CHAR_BIT
%54 = add i32 %53, -1
%55 = shl nuw i32 1, %54
%56 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 %15
%57 = load i8, i8* %56
%58 = trunc i32 %55 to i8
%59 = xor i8 %58, -1
%60 = and i8 %57, %59
store i8 %60, i8* %56
%61 = load float, float* %14
%62 = fpext float %61 to double
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), double %62)
%64 = tail call i32 (...) @is_bigendian()
%65 = bitcast i64* %2 to i8*
store i64 0, i64* %2
%66 = icmp eq i32 %64, 0
%67 = bitcast i64* %2 to double*
%68 = select i1 %66, i64 7, i64 0
%69 = select i1 %66, i64 0, i64 7
%70 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 %69
store i8 1, i8* %70
%71 = load double, double* %67
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @.str.9, i64 0, i64 0), double %71)
store i8 0, i8* %70
%73 = load i32, i32* @CHAR_BIT
%74 = udiv i32 52, %73
%75 = zext i32 %74 to i64
%76 = add nsw i64 %68, -7
%77 = add nsw i64 %76, %75
%78 = sub nsw i64 7, %75
%79 = select i1 %66, i64 %77, i64 %78
%80 = urem i32 52, %73
%81 = shl nuw i32 1, %80
%82 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 %79
%83 = load i8, i8* %82
%84 = trunc i32 %81 to i8
%85 = or i8 %83, %84
store i8 %85, i8* %82
%86 = load double, double* %67
%87 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), double %86)
%88 = bitcast i64* %2 to i8*
%89 = bitcast double %86 to i64
%90 = trunc i64 %89 to i8
%91 = xor i8 %90, -1
store i8 %91, i8* %88
%92 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 1
%93 = lshr i64 %89, 8
%94 = trunc i64 %93 to i8
%95 = xor i8 %94, -1
store i8 %95, i8* %92
%96 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 2
%97 = lshr i64 %89, 16
%98 = trunc i64 %97 to i8
%99 = xor i8 %98, -1
store i8 %99, i8* %96
%100 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 3
%101 = lshr i64 %89, 24
%102 = trunc i64 %101 to i8
%103 = xor i8 %102, -1
store i8 %103, i8* %100
%104 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 4
%105 = lshr i64 %89, 32
%106 = trunc i64 %105 to i8
%107 = xor i8 %106, -1
store i8 %107, i8* %104
%108 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 5
%109 = lshr i64 %89, 40
%110 = trunc i64 %109 to i8
%111 = xor i8 %110, -1
store i8 %111, i8* %108
%112 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 6
%113 = lshr i64 %89, 48
%114 = trunc i64 %113 to i8
%115 = xor i8 %114, -1
store i8 %115, i8* %112
%116 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 7
%117 = lshr i64 %89, 56
%118 = trunc i64 %117 to i8
%119 = xor i8 %118, -1
store i8 %119, i8* %116
%120 = load i32, i32* @CHAR_BIT
%121 = add i32 %120, -1
%122 = shl nuw i32 1, %121
%123 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 %68
%124 = load i8, i8* %123
%125 = trunc i32 %122 to i8
%126 = xor i8 %125, -1
%127 = and i8 %124, %126
store i8 %127, i8* %123
%128 = load double, double* %67
%129 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), double %128)
ret void
}