#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*/ PrintIndent(int);
int /*<<< orphan*/ print_spec_indented_and_max_length(char const *, int, int,
                                                      char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strlen(char const *);
void OpenSubset(const char *SubName, const char *xml_name, const char *SubDesc,
                int *IndentLevel, int CommentLevel) {
  switch (CommentLevel) {
  case (1):
  case (2):
  case (3):
    printf("\n   ****  %s  ****\n\n", SubName);
    return;
    break;
  case (4):
    PrintIndent(*IndentLevel);
    printf("<subset>\n");
    *IndentLevel += 1;
    PrintIndent(*IndentLevel);
    if (strlen(xml_name) > 0) {
      printf("<subset_name>%s</subset_name>\n", xml_name);
    } else {
      printf("<subset_name>%s</subset_name>\n", SubName);
    }
    PrintIndent(*IndentLevel);
    printf("<subset_description>\n");
    print_spec_indented_and_max_length(SubDesc, 70, *IndentLevel + 2, "");
    PrintIndent(*IndentLevel);
    printf("</subset_description>\n");
    break;
  }
}


x86 assembly (clang, -O0):
<OpenSubset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
add    $0xffffffff,%eax
sub    $0x3,%eax
jb     1184 <OpenSubset+0x44>
jmp    1173 <OpenSubset+0x33>
mov    -0x28(%rbp),%eax
sub    $0x4,%eax
je     119b <OpenSubset+0x5b>
jmp    1255 <OpenSubset+0x115>
mov    -0x8(%rbp),%rsi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1255 <OpenSubset+0x115>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1050 <PrintIndent@plt>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1050 <PrintIndent@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
jle    11f3 <OpenSubset+0xb3>
mov    -0x10(%rbp),%rsi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1205 <OpenSubset+0xc5>
mov    -0x8(%rbp),%rsi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1050 <PrintIndent@plt>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
add    $0x2,%edx
mov    $0x46,%esi
lea    0xddd(%rip),%rcx
call   1060 <print_spec_indented_and_max_length@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1050 <PrintIndent@plt>
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OpenSubset>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    -0x1(%r8),%eax
cmp    $0x3,%eax
jae    1180 <OpenSubset+0x30>
lea    0xe95(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <printf@plt>
cmp    $0x4,%r8d
jne    1220 <OpenSubset+0xd0>
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%r12
mov    (%rcx),%edi
call   1060 <PrintIndent@plt>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%edi
add    $0x1,%edi
mov    %edi,(%r15)
call   1060 <PrintIndent@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
cmovg  %r12,%rbx
lea    0xe4c(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%r15),%edi
call   1060 <PrintIndent@plt>
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
mov    (%r15),%edx
add    $0x2,%edx
lea    0xe20(%rip),%rcx
mov    %r14,%rdi
mov    $0x46,%esi
call   1070 <print_spec_indented_and_max_length@plt>
mov    (%r15),%edi
call   1060 <PrintIndent@plt>
lea    0xe42(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <puts@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0A **** %s ****\0A\0A\00"
@.str.1 = [10 x i8] c"<subset>\0A\00"
@.str.2 = [31 x i8] c"<subset_name>%s</subset_name>\0A\00"
@.str.3 = [22 x i8] c"<subset_description>\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [23 x i8] c"</subset_description>\0A\00"
define void @OpenSubset(i8* %0, i8* %1, i8* %2, i32* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%11 = load i32, i32* %10
switch i32 %11, label %49 [
i32 1, label %12
i32 2, label %12
i32 3, label %12
i32 4, label %15
]
12: ; preds = %5, %5, %5
%13 = load i8*, i8** %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %13)
br label %49
15: ; preds = %5
%16 = load i32*, i32** %9
%17 = load i32, i32* %16
%18 = call i32 @PrintIndent(i32 %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32*, i32** %9
%21 = load i32, i32* %20
%22 = add nsw i32 %21, 1
store i32 %22, i32* %20
%23 = load i32*, i32** %9
%24 = load i32, i32* %23
%25 = call i32 @PrintIndent(i32 %24)
%26 = load i8*, i8** %7
%27 = call i32 @strlen(i8* %26)
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %15
%30 = load i8*, i8** %7
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %30)
br label %35
32: ; preds = %15
%33 = load i8*, i8** %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %32, %29
%36 = load i32*, i32** %9
%37 = load i32, i32* %36
%38 = call i32 @PrintIndent(i32 %37)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%40 = load i8*, i8** %8
%41 = load i32*, i32** %9
%42 = load i32, i32* %41
%43 = add nsw i32 %42, 2
%44 = call i32 @print_spec_indented_and_max_length(i8* %40, i32 70, i32 %43, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%45 = load i32*, i32** %9
%46 = load i32, i32* %45
%47 = call i32 @PrintIndent(i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0))
br label %49
49: ; preds = %12, %5, %35
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0A **** %s ****\0A\0A\00"
@.str.2 = [31 x i8] c"<subset_name>%s</subset_name>\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@str = [9 x i8] c"<subset>\00"
@str.6 = [21 x i8] c"<subset_description>\00"
@str.7 = [22 x i8] c"</subset_description>\00"
define void @OpenSubset(i8* %0, i8* %1, i8* %2, i32* nocapture %3, i32 %4) {
switch i32 %4, label %28 [
i32 1, label %6
i32 2, label %6
i32 3, label %6
i32 4, label %8
]
6: ; preds = %5, %5, %5
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %28
8: ; preds = %5
%9 = load i32, i32* %3
%10 = tail call i32 @PrintIndent(i32 %9)
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = tail call i32 @PrintIndent(i32 %13)
%15 = tail call i32 @strlen(i8* %1)
%16 = icmp sgt i32 %15, 0
%17 = select i1 %16, i8* %1, i8* %0
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = load i32, i32* %3
%20 = tail call i32 @PrintIndent(i32 %19)
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 2
%24 = tail call i32 @print_spec_indented_and_max_length(i8* %2, i32 70, i32 %23, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%25 = load i32, i32* %3
%26 = tail call i32 @PrintIndent(i32 %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.7, i64 0, i64 0))
br label %28
28: ; preds = %6, %5, %8
ret void
}