#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ labs(long);
int /*<<< orphan*/ printf(char *, char const *, ...);
int /*<<< orphan*/ stderr;
void int_type(const char *name, long bound_low, long bound_high, int bound_base,
              size_t size) {
  (void)printf("  %s_Size : constant Positive := %u;\n", name,
               (unsigned int)size);
  switch (bound_base) {
  case 8:
    if (bound_low < 0) {
      (void)printf("  type %s_t is range 8#-%lo# .. 8#%lo#;\n", name,
                   (unsigned long)labs(bound_low), (unsigned long)bound_high);
    } else {
      (void)printf("  type %s_t is range 8#%lo# .. 8#%lo#;\n", name,
                   (unsigned long)bound_low, (unsigned long)bound_high);
    }
    break;
  case 10:
    if (bound_low < 0) {
      (void)printf("  type %s_t is range -%ld .. %ld;\n", name, labs(bound_low),
                   bound_high);
    } else {
      (void)printf("  type %s_t is range %ld .. %ld;\n", name, bound_low,
                   bound_high);
    }
    break;
  case 16:
    if (bound_low < 0) {
      (void)printf("  type %s_t is range 16#%lx# .. 16#%lx#;\n", name,
                   (unsigned long)labs(bound_low), (unsigned long)bound_high);
    } else {
      (void)printf("  type %s_t is range 16#-%lx# .. 16#%lx#;\n", name,
                   (unsigned long)bound_low, (unsigned long)bound_high);
    }
    break;
  default:
    (void)fprintf(stderr, "fatal: invalid number base\n");
    exit(EXIT_FAILURE);
  }
  (void)printf("  for %s_t'Size use %s_Size;\n", name, name);
  (void)printf("  pragma Convention (C, %s_t);\n", name);
}


x86 assembly (clang, -O0):
<int_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x28(%rbp),%edx
lea    0xe97(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x8,%eax
je     11a6 <int_type+0x66>
jmp    1184 <int_type+0x44>
mov    -0x2c(%rbp),%eax
sub    $0xa,%eax
je     11ff <int_type+0xbf>
jmp    1195 <int_type+0x55>
mov    -0x2c(%rbp),%eax
sub    $0x10,%eax
je     1258 <int_type+0x118>
jmp    12b1 <int_type+0x171>
cmpq   $0x0,-0x10(%rbp)
jge    11e0 <int_type+0xa0>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <labs@plt>
mov    -0x38(%rbp),%rsi
mov    %rax,%rdx
mov    -0x18(%rbp),%rcx
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fa <int_type+0xba>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d4 <int_type+0x194>
cmpq   $0x0,-0x10(%rbp)
jge    1239 <int_type+0xf9>
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <labs@plt>
mov    -0x40(%rbp),%rsi
mov    %rax,%rdx
mov    -0x18(%rbp),%rcx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1253 <int_type+0x113>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d4 <int_type+0x194>
cmpq   $0x0,-0x10(%rbp)
jge    1292 <int_type+0x152>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <labs@plt>
mov    -0x48(%rbp),%rsi
mov    %rax,%rdx
mov    -0x18(%rbp),%rcx
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12ac <int_type+0x16c>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12d4 <int_type+0x194>
mov    0x2d28(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2d0b(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_type>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xeb7(%rip),%rdi
mov    %rbx,%rsi
mov    %r8d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x10,%ebp
je     1177 <int_type+0x47>
cmp    $0xa,%ebp
je     1185 <int_type+0x55>
cmp    $0x8,%ebp
jne    11f4 <int_type+0xc4>
test   %r15,%r15
js     1193 <int_type+0x63>
lea    0xeda(%rip),%rdi
jmp    11b5 <int_type+0x85>
test   %r15,%r15
js     119f <int_type+0x6f>
lea    0xf63(%rip),%rdi
jmp    11b5 <int_type+0x85>
test   %r15,%r15
js     11ab <int_type+0x7b>
lea    0xf09(%rip),%rdi
jmp    11b5 <int_type+0x85>
neg    %r15
lea    0xe89(%rip),%rdi
jmp    11b5 <int_type+0x85>
neg    %r15
lea    0xf13(%rip),%rdi
jmp    11b5 <int_type+0x85>
neg    %r15
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf61(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf6b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
lea    0xf0d(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2dc8(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c" %s_Size : constant Positive := %u;\0A\00"
@.str.1 = [41 x i8] c" type %s_t is range 8#-%lo# .. 8#%lo#;\0A\00"
@.str.2 = [40 x i8] c" type %s_t is range 8#%lo# .. 8#%lo#;\0A\00"
@.str.3 = [35 x i8] c" type %s_t is range -%ld .. %ld;\0A\00"
@.str.4 = [34 x i8] c" type %s_t is range %ld .. %ld;\0A\00"
@.str.5 = [42 x i8] c" type %s_t is range 16#%lx# .. 16#%lx#;\0A\00"
@.str.6 = [43 x i8] c" type %s_t is range 16#-%lx# .. 16#%lx#;\0A\00"
@stderr = global i32 0
@.str.7 = [28 x i8] c"fatal: invalid number base\0A\00"
@EXIT_FAILURE = global i32 0
@.str.8 = [30 x i8] c" for %s_t'Size use %s_Size;\0A\00"
@.str.9 = [32 x i8] c" pragma Convention (C, %s_t);\0A\00"
define void @int_type(i8* %0, i64 %1, i64 %2, i32 %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
%10 = alloca i64
store i8* %0, i8** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i32 %3, i32* %9
store i64 %4, i64* %10
%11 = load i8*, i8** %6
%12 = load i64, i64* %10
%13 = trunc i64 %12 to i32
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %13)
%15 = load i32, i32* %9
switch i32 %15, label %61 [
i32 8, label %16
i32 10, label %31
i32 16, label %46
]
16: ; preds = %5
%17 = load i64, i64* %7
%18 = icmp slt i64 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %16
%20 = load i8*, i8** %6
%21 = load i64, i64* %7
%22 = call i64 @labs(i64 %21)
%23 = load i64, i64* %8
%24 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %20, i64 %22, i64 %23)
br label %30
25: ; preds = %16
%26 = load i8*, i8** %6
%27 = load i64, i64* %7
%28 = load i64, i64* %8
%29 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %26, i64 %27, i64 %28)
br label %30
30: ; preds = %25, %19
br label %66
31: ; preds = %5
%32 = load i64, i64* %7
%33 = icmp slt i64 %32, 0
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i8*, i8** %6
%36 = load i64, i64* %7
%37 = call i64 @labs(i64 %36)
%38 = load i64, i64* %8
%39 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %35, i64 %37, i64 %38)
br label %45
40: ; preds = %31
%41 = load i8*, i8** %6
%42 = load i64, i64* %7
%43 = load i64, i64* %8
%44 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %41, i64 %42, i64 %43)
br label %45
45: ; preds = %40, %34
br label %66
46: ; preds = %5
%47 = load i64, i64* %7
%48 = icmp slt i64 %47, 0
br i1 %48, label %49, label %55
49: ; preds = %46
%50 = load i8*, i8** %6
%51 = load i64, i64* %7
%52 = call i64 @labs(i64 %51)
%53 = load i64, i64* %8
%54 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %50, i64 %52, i64 %53)
br label %60
55: ; preds = %46
%56 = load i8*, i8** %6
%57 = load i64, i64* %7
%58 = load i64, i64* %8
%59 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %56, i64 %57, i64 %58)
br label %60
60: ; preds = %55, %49
br label %66
61: ; preds = %5
%62 = load i32, i32* @stderr
%63 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %60, %45, %30
%67 = load i8*, i8** %6
%68 = load i8*, i8** %6
%69 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %67, i8* %68)
%70 = load i8*, i8** %6
%71 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* %70)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c" %s_Size : constant Positive := %u;\0A\00"
@.str.1 = [41 x i8] c" type %s_t is range 8#-%lo# .. 8#%lo#;\0A\00"
@.str.2 = [40 x i8] c" type %s_t is range 8#%lo# .. 8#%lo#;\0A\00"
@.str.3 = [35 x i8] c" type %s_t is range -%ld .. %ld;\0A\00"
@.str.4 = [34 x i8] c" type %s_t is range %ld .. %ld;\0A\00"
@.str.5 = [42 x i8] c" type %s_t is range 16#%lx# .. 16#%lx#;\0A\00"
@.str.6 = [43 x i8] c" type %s_t is range 16#-%lx# .. 16#%lx#;\0A\00"
@stderr = global i32 0
@.str.7 = [28 x i8] c"fatal: invalid number base\0A\00"
@EXIT_FAILURE = global i32 0
@.str.8 = [30 x i8] c" for %s_t'Size use %s_Size;\0A\00"
@.str.9 = [32 x i8] c" pragma Convention (C, %s_t);\0A\00"
define void @int_type(i8* %0, i64 %1, i64 %2, i32 %3, i64 %4) {
%6 = trunc i64 %4 to i32
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %6)
switch i32 %3, label %29 [
i32 8, label %8
i32 10, label %15
i32 16, label %22
]
8: ; preds = %5
%9 = icmp slt i64 %1, 0
br i1 %9, label %10, label %13
10: ; preds = %8
%11 = sub nsw i64 0, %1
%12 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %0, i64 %11, i64 %2)
br label %34
13: ; preds = %8
%14 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %0, i64 %1, i64 %2)
br label %34
15: ; preds = %5
%16 = icmp slt i64 %1, 0
br i1 %16, label %17, label %20
17: ; preds = %15
%18 = sub nsw i64 0, %1
%19 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %0, i64 %18, i64 %2)
br label %34
20: ; preds = %15
%21 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i8* %0, i64 %1, i64 %2)
br label %34
22: ; preds = %5
%23 = icmp slt i64 %1, 0
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = sub nsw i64 0, %1
%26 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8* %0, i64 %25, i64 %2)
br label %34
27: ; preds = %22
%28 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0), i8* %0, i64 %1, i64 %2)
br label %34
29: ; preds = %5
%30 = load i32, i32* @stderr
%31 = tail call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%32 = load i32, i32* @EXIT_FAILURE
%33 = tail call i32 @exit(i32 %32)
unreachable
34: ; preds = %24, %27, %17, %20, %10, %13
%35 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), i8* %0, i8* %0)
%36 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i8* %0)
ret void
}