#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 */
char *hierarchical_label(char const *, size_t, char *, int);
char *label(char const *, size_t, char *, int);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ putchar(char);
int print_label(char const *type, size_t type_n, char const *name,
                size_t name_n, char const *value, size_t value_n) {
  char tbuf[1024], nbuf[1024], vbuf[1024];
  putchar('"');
  if (type != NULL && type_n != 0) {
    if (name != NULL && name_n != 0) {
      if (value != NULL && value_n != 0) {
        printf("{%s|{%s|%s}}",
               hierarchical_label(type, type_n, tbuf, sizeof tbuf),
               hierarchical_label(name, name_n, nbuf, sizeof nbuf),
               label(value, value_n, vbuf, sizeof vbuf));
      } else {
        printf("{%s|%s}", hierarchical_label(type, type_n, tbuf, sizeof tbuf),
               hierarchical_label(name, name_n, nbuf, sizeof nbuf));
      }
    } else {
      if (value != NULL && value_n != 0) {
        printf("{%s|%s}", hierarchical_label(type, type_n, tbuf, sizeof tbuf),
               label(value, value_n, vbuf, sizeof vbuf));
      } else {
        printf("%s", hierarchical_label(type, type_n, tbuf, sizeof tbuf));
      }
    }
  } else {
    if (name != NULL && name_n != 0) {
      if (value != NULL && value_n != 0) {
        printf("%s|%s", hierarchical_label(name, name_n, nbuf, sizeof nbuf),
               label(value, value_n, vbuf, sizeof vbuf));
      } else {
        printf("%s", hierarchical_label(name, name_n, nbuf, sizeof nbuf));
      }
    } else {
      if (value != NULL && value_n != 0) {
        printf("%s", label(value, value_n, vbuf, sizeof vbuf));
      } else {
      }
    }
  }
  putchar('"');
  return 0;
}


x86 assembly (clang, -O0):
<print_label>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    $0x22,%edi
call   1030 <putchar@plt>
cmpq   $0x0,-0x8(%rbp)
je     1322 <print_label+0x1e2>
cmpq   $0x0,-0x10(%rbp)
je     1322 <print_label+0x1e2>
cmpq   $0x0,-0x18(%rbp)
je     1282 <print_label+0x142>
cmpq   $0x0,-0x20(%rbp)
je     1282 <print_label+0x142>
cmpq   $0x0,-0x28(%rbp)
je     122c <print_label+0xec>
cmpq   $0x0,-0x30(%rbp)
je     122c <print_label+0xec>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x430(%rbp),%rdx
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,-0xc40(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x830(%rbp),%rdx
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,-0xc38(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
lea    -0xc30(%rbp),%rdx
mov    $0x400,%ecx
call   1040 <label@plt>
mov    -0xc40(%rbp),%rsi
mov    -0xc38(%rbp),%rdx
mov    %rax,%rcx
lea    0xde0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    127d <print_label+0x13d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x430(%rbp),%rdx
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,-0xc48(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x830(%rbp),%rdx
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    -0xc48(%rbp),%rsi
mov    %rax,%rdx
lea    0xd97(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    131d <print_label+0x1dd>
cmpq   $0x0,-0x28(%rbp)
je     12ee <print_label+0x1ae>
cmpq   $0x0,-0x30(%rbp)
je     12ee <print_label+0x1ae>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x430(%rbp),%rdx
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,-0xc50(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
lea    -0xc30(%rbp),%rdx
mov    $0x400,%ecx
call   1040 <label@plt>
mov    -0xc50(%rbp),%rsi
mov    %rax,%rdx
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1318 <print_label+0x1d8>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x430(%rbp),%rdx
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,%rsi
lea    0xd07(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    131d <print_label+0x1dd>
jmp    1427 <print_label+0x2e7>
cmpq   $0x0,-0x18(%rbp)
je     13d3 <print_label+0x293>
cmpq   $0x0,-0x20(%rbp)
je     13d3 <print_label+0x293>
cmpq   $0x0,-0x28(%rbp)
je     13a4 <print_label+0x264>
cmpq   $0x0,-0x30(%rbp)
je     13a4 <print_label+0x264>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x830(%rbp),%rdx
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,-0xc58(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
lea    -0xc30(%rbp),%rdx
mov    $0x400,%ecx
call   1040 <label@plt>
mov    -0xc58(%rbp),%rsi
mov    %rax,%rdx
lea    0xc7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    13ce <print_label+0x28e>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
lea    -0x830(%rbp),%rdx
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,%rsi
lea    0xc51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1422 <print_label+0x2e2>
cmpq   $0x0,-0x28(%rbp)
je     1418 <print_label+0x2d8>
cmpq   $0x0,-0x30(%rbp)
je     1418 <print_label+0x2d8>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
lea    -0xc30(%rbp),%rdx
mov    $0x400,%ecx
call   1040 <label@plt>
mov    %rax,%rsi
lea    0xc0c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    141d <print_label+0x2dd>
jmp    141d <print_label+0x2dd>
jmp    1422 <print_label+0x2e2>
jmp    1427 <print_label+0x2e7>
mov    $0x22,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xc60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_label>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc28,%rsp
mov    %r9,%r14
mov    %r8,%r13
mov    %rcx,%rbx
mov    %rdx,%rbp
mov    %rsi,%r12
mov    %rdi,%r15
mov    $0x22,%edi
call   1030 <putchar@plt>
mov    %r12,%rsi
mov    %rbp,0x10(%rsp)
test   %rbp,%rbp
setne  %al
mov    %rbx,0x18(%rsp)
test   %rbx,%rbx
setne  %r12b
and    %al,%r12b
mov    %r13,(%rsp)
test   %r13,%r13
setne  %al
mov    %r14,0x8(%rsp)
test   %r14,%r14
setne  %r14b
and    %al,%r14b
test   %r15,%r15
je     122e <print_label+0xee>
test   %rsi,%rsi
je     122e <print_label+0xee>
lea    0x820(%rsp),%rdx
mov    %r15,%rdi
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,%rbp
test   %r12b,%r12b
je     12a8 <print_label+0x168>
lea    0x420(%rsp),%rdx
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,%rbx
test   %r14b,%r14b
je     12e0 <print_label+0x1a0>
lea    0x20(%rsp),%rdx
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    $0x400,%ecx
call   1040 <label@plt>
lea    0xde7(%rip),%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1307 <print_label+0x1c7>
test   %r12b,%r12b
je     127b <print_label+0x13b>
lea    0x420(%rsp),%rdx
mov    0x10(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    $0x400,%ecx
call   1060 <hierarchical_label@plt>
mov    %rax,%rbx
test   %r14b,%r14b
je     12d4 <print_label+0x194>
lea    0x20(%rsp),%rdx
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    $0x400,%ecx
call   1040 <label@plt>
lea    0xd9f(%rip),%rdi
mov    %rbx,%rsi
jmp    12cf <print_label+0x18f>
test   %r14b,%r14b
je     1307 <print_label+0x1c7>
lea    0x20(%rsp),%rdx
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    $0x400,%ecx
call   1040 <label@plt>
lea    0xd75(%rip),%rdi
mov    %rax,%rsi
jmp    1300 <print_label+0x1c0>
test   %r14b,%r14b
je     12f6 <print_label+0x1b6>
lea    0x20(%rsp),%rdx
mov    (%rsp),%rdi
mov    0x8(%rsp),%rsi
mov    $0x400,%ecx
call   1040 <label@plt>
lea    0xd41(%rip),%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
jmp    12ed <print_label+0x1ad>
lea    0xd3d(%rip),%rdi
mov    %rbx,%rsi
jmp    1300 <print_label+0x1c0>
lea    0xd26(%rip),%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1307 <print_label+0x1c7>
lea    0xd1b(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x22,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0xc28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"{%s|{%s|%s}}\00"
@.str.1 = [8 x i8] c"{%s|%s}\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [6 x i8] c"%s|%s\00"
define i32 @print_label(i8* %0, i64 %1, i8* %2, i64 %3, i8* %4, i64 %5) {
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i64
%13 = alloca [1024 x i8]
%14 = alloca [1024 x i8]
%15 = alloca [1024 x i8]
store i8* %0, i8** %7
store i64 %1, i64* %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i64 %5, i64* %12
%16 = call i32 @putchar(i8 signext 34)
%17 = load i8*, i8** %7
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %83
19: ; preds = %6
%20 = load i64, i64* %8
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %83
22: ; preds = %19
%23 = load i8*, i8** %9
%24 = icmp ne i8* %23, null
br i1 %24, label %25, label %59
25: ; preds = %22
%26 = load i64, i64* %10
%27 = icmp ne i64 %26, 0
br i1 %27, label %28, label %59
28: ; preds = %25
%29 = load i8*, i8** %11
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %48
31: ; preds = %28
%32 = load i64, i64* %12
%33 = icmp ne i64 %32, 0
br i1 %33, label %34, label %48
34: ; preds = %31
%35 = load i8*, i8** %7
%36 = load i64, i64* %8
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%38 = call i8* @hierarchical_label(i8* %35, i64 %36, i8* %37, i32 1024)
%39 = load i8*, i8** %9
%40 = load i64, i64* %10
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%42 = call i8* @hierarchical_label(i8* %39, i64 %40, i8* %41, i32 1024)
%43 = load i8*, i8** %11
%44 = load i64, i64* %12
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%46 = call i8* @label(i8* %43, i64 %44, i8* %45, i32 1024)
%47 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %38, i8* %42, i8* %46)
br label %58
48: ; preds = %31, %28
%49 = load i8*, i8** %7
%50 = load i64, i64* %8
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%52 = call i8* @hierarchical_label(i8* %49, i64 %50, i8* %51, i32 1024)
%53 = load i8*, i8** %9
%54 = load i64, i64* %10
%55 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%56 = call i8* @hierarchical_label(i8* %53, i64 %54, i8* %55, i32 1024)
%57 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %52, i8* %56)
br label %58
58: ; preds = %48, %34
br label %82
59: ; preds = %25, %22
%60 = load i8*, i8** %11
%61 = icmp ne i8* %60, null
br i1 %61, label %62, label %75
62: ; preds = %59
%63 = load i64, i64* %12
%64 = icmp ne i64 %63, 0
br i1 %64, label %65, label %75
65: ; preds = %62
%66 = load i8*, i8** %7
%67 = load i64, i64* %8
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%69 = call i8* @hierarchical_label(i8* %66, i64 %67, i8* %68, i32 1024)
%70 = load i8*, i8** %11
%71 = load i64, i64* %12
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%73 = call i8* @label(i8* %70, i64 %71, i8* %72, i32 1024)
%74 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %69, i8* %73)
br label %81
75: ; preds = %62, %59
%76 = load i8*, i8** %7
%77 = load i64, i64* %8
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %13, i64 0, i64 0
%79 = call i8* @hierarchical_label(i8* %76, i64 %77, i8* %78, i32 1024)
%80 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %79)
br label %81
81: ; preds = %75, %65
br label %82
82: ; preds = %81, %58
br label %127
83: ; preds = %19, %6
%84 = load i8*, i8** %9
%85 = icmp ne i8* %84, null
br i1 %85, label %86, label %112
86: ; preds = %83
%87 = load i64, i64* %10
%88 = icmp ne i64 %87, 0
br i1 %88, label %89, label %112
89: ; preds = %86
%90 = load i8*, i8** %11
%91 = icmp ne i8* %90, null
br i1 %91, label %92, label %105
92: ; preds = %89
%93 = load i64, i64* %12
%94 = icmp ne i64 %93, 0
br i1 %94, label %95, label %105
95: ; preds = %92
%96 = load i8*, i8** %9
%97 = load i64, i64* %10
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%99 = call i8* @hierarchical_label(i8* %96, i64 %97, i8* %98, i32 1024)
%100 = load i8*, i8** %11
%101 = load i64, i64* %12
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%103 = call i8* @label(i8* %100, i64 %101, i8* %102, i32 1024)
%104 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %99, i8* %103)
br label %111
105: ; preds = %92, %89
%106 = load i8*, i8** %9
%107 = load i64, i64* %10
%108 = getelementptr inbounds [1024 x i8], [1024 x i8]* %14, i64 0, i64 0
%109 = call i8* @hierarchical_label(i8* %106, i64 %107, i8* %108, i32 1024)
%110 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %109)
br label %111
111: ; preds = %105, %95
br label %126
112: ; preds = %86, %83
%113 = load i8*, i8** %11
%114 = icmp ne i8* %113, null
br i1 %114, label %115, label %124
115: ; preds = %112
%116 = load i64, i64* %12
%117 = icmp ne i64 %116, 0
br i1 %117, label %118, label %124
118: ; preds = %115
%119 = load i8*, i8** %11
%120 = load i64, i64* %12
%121 = getelementptr inbounds [1024 x i8], [1024 x i8]* %15, i64 0, i64 0
%122 = call i8* @label(i8* %119, i64 %120, i8* %121, i32 1024)
%123 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %122)
br label %125
124: ; preds = %115, %112
br label %125
125: ; preds = %124, %118
br label %126
126: ; preds = %125, %111
br label %127
127: ; preds = %126, %82
%128 = call i32 @putchar(i8 signext 34)
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"{%s|{%s|%s}}\00"
@.str.1 = [8 x i8] c"{%s|%s}\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [6 x i8] c"%s|%s\00"
define i32 @print_label(i8* %0, i64 %1, i8* %2, i64 %3, i8* %4, i64 %5) {
%7 = alloca [1024 x i8]
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%13 = tail call i32 @putchar(i8 signext 34)
%14 = icmp ne i8* %0, null
%15 = icmp ne i64 %1, 0
%16 = and i1 %14, %15
%17 = icmp ne i8* %2, null
%18 = icmp ne i64 %3, 0
%19 = and i1 %17, %18
%20 = icmp ne i8* %4, null
%21 = icmp ne i64 %5, 0
%22 = and i1 %20, %21
br i1 %16, label %23, label %38
23: ; preds = %6
%24 = call i8* @hierarchical_label(i8* %0, i64 %1, i8* %10, i32 1024)
br i1 %19, label %25, label %32
25: ; preds = %23
%26 = call i8* @hierarchical_label(i8* %2, i64 %3, i8* %11, i32 1024)
br i1 %22, label %27, label %30
27: ; preds = %25
%28 = call i8* @label(i8* %4, i64 %5, i8* %12, i32 1024)
%29 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %24, i8* %26, i8* %28)
br label %50
30: ; preds = %25
%31 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %24, i8* %26)
br label %50
32: ; preds = %23
br i1 %22, label %33, label %36
33: ; preds = %32
%34 = call i8* @label(i8* %4, i64 %5, i8* %12, i32 1024)
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %24, i8* %34)
br label %50
36: ; preds = %32
%37 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %24)
br label %50
38: ; preds = %6
br i1 %19, label %39, label %46
39: ; preds = %38
%40 = call i8* @hierarchical_label(i8* %2, i64 %3, i8* %11, i32 1024)
br i1 %22, label %41, label %44
41: ; preds = %39
%42 = call i8* @label(i8* %4, i64 %5, i8* %12, i32 1024)
%43 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %40, i8* %42)
br label %50
44: ; preds = %39
%45 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %40)
br label %50
46: ; preds = %38
br i1 %22, label %47, label %50
47: ; preds = %46
%48 = call i8* @label(i8* %4, i64 %5, i8* %12, i32 1024)
%49 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %44, %41, %46, %47, %30, %27, %36, %33
%51 = call i32 @putchar(i8 signext 34)
ret i32 0
}