#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 *, ...);
void c_debug(void ***pdea) {
  void **dea = *pdea;
  long *nfa = *(int **)(dea + 4);
  char *pc;
  int len;
  int i;
  printf("%p ", pdea);
  printf("%p ", dea);
  printf("%p ", nfa);
  if (nfa) {
    len = *nfa++;
    pc = (char *)nfa;
    if (len < 32) {
      printf("%d ", len);
      for (i = 0; i < len; i++)
        printf("%c", *pc++);
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<c_debug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     11f7 <c_debug+0xe7>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%rax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpl   $0x20,-0x24(%rbp)
jge    11f2 <c_debug+0xe2>
mov    -0x24(%rbp),%esi
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11ed <c_debug+0xdd>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11b3 <c_debug+0xa3>
jmp    11f2 <c_debug+0xe2>
jmp    11f7 <c_debug+0xe7>
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_debug>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rsi
mov    (%rdi),%rbx
mov    0x20(%rbx),%r14
lea    0xeca(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r14,%r14
je     1194 <c_debug+0x74>
mov    (%r14),%r15
cmp    $0x1f,%r15d
jg     1194 <c_debug+0x74>
lea    0xe95(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r15d,%r15d
jle    1194 <c_debug+0x74>
xor    %ebx,%ebx
movsbl 0x8(%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1180 <c_debug+0x60>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%p \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @c_debug(i8*** %0) {
%2 = alloca i8***
%3 = alloca i8**
%4 = alloca i64*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8*** %0, i8**** %2
%8 = load i8***, i8**** %2
%9 = load i8**, i8*** %8
store i8** %9, i8*** %3
%10 = load i8**, i8*** %3
%11 = getelementptr inbounds i8*, i8** %10, i64 4
%12 = bitcast i8** %11 to i32**
%13 = load i32*, i32** %12
%14 = bitcast i32* %13 to i64*
store i64* %14, i64** %4
%15 = load i8***, i8**** %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8*** %15)
%17 = load i8**, i8*** %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %17)
%19 = load i64*, i64** %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %19)
%21 = load i64*, i64** %4
%22 = icmp ne i64* %21, null
br i1 %22, label %23, label %50
23: ; preds = %1
%24 = load i64*, i64** %4
%25 = getelementptr inbounds i64, i64* %24, i32 1
store i64* %25, i64** %4
%26 = load i64, i64* %24
%27 = trunc i64 %26 to i32
store i32 %27, i32* %6
%28 = load i64*, i64** %4
%29 = bitcast i64* %28 to i8*
store i8* %29, i8** %5
%30 = load i32, i32* %6
%31 = icmp slt i32 %30, 32
br i1 %31, label %32, label %49
32: ; preds = %23
%33 = load i32, i32* %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
store i32 0, i32* %7
br label %35
35: ; preds = %45, %32
%36 = load i32, i32* %7
%37 = load i32, i32* %6
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load i8*, i8** %5
%41 = getelementptr inbounds i8, i8* %40, i32 1
store i8* %41, i8** %5
%42 = load i8, i8* %40
%43 = sext i8 %42 to i32
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %39
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %35
48: ; preds = %35
br label %49
49: ; preds = %48, %23
br label %50
50: ; preds = %49, %1
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%p \00"
@.str.1 = [4 x i8] c"%d \00"
define void @c_debug(i8*** %0) {
%2 = load i8**, i8*** %0
%3 = getelementptr inbounds i8*, i8** %2, i64 4
%4 = bitcast i8** %3 to i64**
%5 = load i64*, i64** %4
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8*** %0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %2)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64* %5)
%9 = icmp eq i64* %5, null
br i1 %9, label %29, label %10
10: ; preds = %1
%11 = load i64, i64* %5
%12 = trunc i64 %11 to i32
%13 = icmp slt i32 %12, 32
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%16 = icmp sgt i32 %12, 0
br i1 %16, label %17, label %29
17: ; preds = %14
%18 = getelementptr inbounds i64, i64* %5, i64 1
%19 = bitcast i64* %18 to i8*
br label %20
20: ; preds = %17, %20
%21 = phi i32 [ %27, %20 ], [ 0, %17 ]
%22 = phi i8* [ %23, %20 ], [ %19, %17 ]
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %22
%25 = sext i8 %24 to i32
%26 = tail call i32 @putchar(i32 %25)
%27 = add nuw nsw i32 %21, 1
%28 = icmp eq i32 %27, %12
br i1 %28, label %29, label %20
29: ; preds = %20, %14, %10, %1
%30 = tail call i32 @putchar(i32 10)
ret void
}