#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*/ printf(char *, char const *, ...);
void mod_type(const char *name, size_t size) {
  (void)printf("  %s_Size : constant Positive := %u;\n", name,
               (unsigned int)size);
  (void)printf("  type %s_t is mod 2 ** %u;\n", name, (unsigned int)size);
  (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):
<mod_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mod_type>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf04(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [38 x i8] c" %s_Size : constant Positive := %u;\0A\00"
@.str.1 = [29 x i8] c" type %s_t is mod 2 ** %u;\0A\00"
@.str.2 = [30 x i8] c" for %s_t'Size use %s_Size;\0A\00"
@.str.3 = [32 x i8] c" pragma Convention (C, %s_t);\0A\00"
define void @mod_type(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = trunc i64 %6 to i32
%8 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %7)
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = trunc i64 %10 to i32
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %11)
%13 = load i8*, i8** %3
%14 = load i8*, i8** %3
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %13, i8* %14)
%16 = load i8*, i8** %3
%17 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c" %s_Size : constant Positive := %u;\0A\00"
@.str.1 = [29 x i8] c" type %s_t is mod 2 ** %u;\0A\00"
@.str.2 = [30 x i8] c" for %s_t'Size use %s_Size;\0A\00"
@.str.3 = [32 x i8] c" pragma Convention (C, %s_t);\0A\00"
define void @mod_type(i8* %0, i64 %1) {
%3 = trunc i64 %1 to i32
%4 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %3)
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 %3)
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %0)
%7 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %0)
ret void
}