#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 */
struct typ {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ typ_generic_arg_const(struct typ const *, size_t);
size_t typ_generic_arity(struct typ const *);
int /*<<< orphan*/ typ_generic_functor_const(struct typ const *);
void pptypptrs(const struct typ *t) {
  fprintf(stderr, "%p (", t);
  if (typ_generic_arity(t) > 0) {
    fprintf(stderr, "%p ", typ_generic_functor_const(t));
    for (size_t n = 0, arity = typ_generic_arity(t); n < arity; ++n) {
      fprintf(stderr, "%p ", typ_generic_arg_const(t, n));
    }
  }
  fprintf(stderr, ")\n");
}


x86 assembly (clang, -O0):
<pptypptrs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea0(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <typ_generic_arity@plt>
cmp    $0x0,%rax
jbe    1207 <pptypptrs+0xc7>
mov    0x2e5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <typ_generic_functor_const@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%edx
lea    0xe6a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <typ_generic_arity@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1202 <pptypptrs+0xc2>
mov    0x2e14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <typ_generic_arg_const@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%edx
lea    0xe1b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    11b7 <pptypptrs+0x77>
jmp    1207 <pptypptrs+0xc7>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pptypptrs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
mov    0x2e8b(%rip),%r13
mov    0x0(%r13),%edi
lea    0xea0(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r14,%rdi
call   1030 <typ_generic_arity@plt>
test   %rax,%rax
je     11d6 <pptypptrs+0x96>
mov    0x0(%r13),%ebx
mov    %r14,%rdi
call   1040 <typ_generic_functor_const@plt>
lea    0xe7b(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r14,%rdi
call   1030 <typ_generic_arity@plt>
test   %rax,%rax
je     11d6 <pptypptrs+0x96>
mov    %rax,%r12
lea    0xe59(%rip),%r15
xor    %ebx,%ebx
xchg   %ax,%ax
mov    0x0(%r13),%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <typ_generic_arg_const@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    11b0 <pptypptrs+0x70>
mov    0x0(%r13),%edi
lea    0xe28(%rip),%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>

LLVM IR (-O0):
%struct.typ = type { i32 }
@stderr = global i32 0
@.str = [5 x i8] c"%p (\00"
@.str.1 = [4 x i8] c"%p \00"
@.str.2 = [3 x i8] c")\0A\00"
define void @pptypptrs(%struct.typ* %0) {
%2 = alloca %struct.typ*
%3 = alloca i64
%4 = alloca i64
store %struct.typ* %0, %struct.typ** %2
%5 = load i32, i32* @stderr
%6 = load %struct.typ*, %struct.typ** %2
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.typ* %6)
%8 = load %struct.typ*, %struct.typ** %2
%9 = call i64 @typ_generic_arity(%struct.typ* %8)
%10 = icmp ugt i64 %9, 0
br i1 %10, label %11, label %32
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = load %struct.typ*, %struct.typ** %2
%14 = call i32 @typ_generic_functor_const(%struct.typ* %13)
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
store i64 0, i64* %3
%16 = load %struct.typ*, %struct.typ** %2
%17 = call i64 @typ_generic_arity(%struct.typ* %16)
store i64 %17, i64* %4
br label %18
18: ; preds = %28, %11
%19 = load i64, i64* %3
%20 = load i64, i64* %4
%21 = icmp ult i64 %19, %20
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = load i32, i32* @stderr
%24 = load %struct.typ*, %struct.typ** %2
%25 = load i64, i64* %3
%26 = call i32 @typ_generic_arg_const(%struct.typ* %24, i64 %25)
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %22
%29 = load i64, i64* %3
%30 = add i64 %29, 1
store i64 %30, i64* %3
br label %18
31: ; preds = %18
br label %32
32: ; preds = %31, %1
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.typ = type { i32 }
@stderr = global i32 0
@.str = [5 x i8] c"%p (\00"
@.str.1 = [4 x i8] c"%p \00"
@.str.2 = [3 x i8] c")\0A\00"
define void @pptypptrs(%struct.typ* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %struct.typ* %0)
%4 = tail call i64 @typ_generic_arity(%struct.typ* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %19, label %6
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @typ_generic_functor_const(%struct.typ* %0)
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = tail call i64 @typ_generic_arity(%struct.typ* %0)
%11 = icmp eq i64 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %6, %12
%13 = phi i64 [ %17, %12 ], [ 0, %6 ]
%14 = load i32, i32* @stderr
%15 = tail call i32 @typ_generic_arg_const(%struct.typ* %0, i64 %13)
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = add nuw i64 %13, 1
%18 = icmp eq i64 %17, %10
br i1 %18, label %19, label %12
19: ; preds = %12, %6, %1
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}