#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
char *read_label(char const **);
int /*<<< orphan*/ *stderr;
void print_flow_code(FILE *fp, const char **code_ptr) {
  const char *code = *code_ptr;
  switch (*++code) {
  case ' ':
    switch (*++code) {
    case ' ':
      fprintf(fp, "\n%s:\n", read_label(&code));
      break;
    case '\t':
      fprintf(fp,
              "  "
              "if (!setjmp(call_stack[call_stack_idx++])) {\n"
              "  "
              "  "
              "goto %s;\n"
              "  "
              "}\n",
              read_label(&code));
      break;
    case '\n':
      fprintf(fp,
              "  "
              "goto %s;\n",
              read_label(&code));
      break;
    }
    break;
  case '\t':
    switch (*++code) {
    case ' ':
      fprintf(fp,
              "  "
              "if (!pop()) {\n"
              "  "
              "  "
              "goto %s;\n"
              "  "
              "}\n",
              read_label(&code));
      break;
    case '\t':
      fprintf(fp,
              "  "
              "if (pop() < 0) {\n"
              "  "
              "  "
              "goto %s;\n"
              "  "
              "}\n",
              read_label(&code));
      break;
    case '\n':
      fputs("  "
            "longjmp(call_stack[--call_stack_idx], 1);\n",
            fp);
      break;
    }
    break;
  case '\n':
    if (*++code == '\n') {
      fputs("  "
            "exit(EXIT_SUCCESS);\n",
            fp);
    } else {
      fputs("Undefined flow control command is detected: [N][S/T]\n", stderr);
    }
    break;
  }
  *code_ptr = code;
}


x86 assembly (clang, -O0):
<print_flow_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl 0x1(%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x9,%eax
je     1252 <print_flow_code+0x122>
jmp    116f <print_flow_code+0x3f>
mov    -0x1c(%rbp),%eax
sub    $0xa,%eax
je     12ff <print_flow_code+0x1cf>
jmp    1180 <print_flow_code+0x50>
mov    -0x1c(%rbp),%eax
sub    $0x20,%eax
jne    134b <print_flow_code+0x21b>
jmp    1191 <print_flow_code+0x61>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl 0x1(%rax),%eax
mov    %eax,-0x20(%rbp)
sub    $0x9,%eax
je     1200 <print_flow_code+0xd0>
jmp    11b5 <print_flow_code+0x85>
mov    -0x20(%rbp),%eax
sub    $0xa,%eax
je     1229 <print_flow_code+0xf9>
jmp    11c6 <print_flow_code+0x96>
mov    -0x20(%rbp),%eax
sub    $0x20,%eax
jne    124d <print_flow_code+0x11d>
jmp    11d7 <print_flow_code+0xa7>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <read_label@plt>
mov    -0x28(%rbp),%rdi
mov    %rax,%rdx
lea    0xe0a(%rip),%rsi
call   1040 <fprintf@plt>
jmp    124d <print_flow_code+0x11d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <read_label@plt>
mov    -0x30(%rbp),%rdi
mov    %rax,%rdx
lea    0xde7(%rip),%rsi
call   1040 <fprintf@plt>
jmp    124d <print_flow_code+0x11d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <read_label@plt>
mov    -0x38(%rbp),%rdi
mov    %rax,%rdx
lea    0xdff(%rip),%rsi
call   1040 <fprintf@plt>
jmp    134b <print_flow_code+0x21b>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl 0x1(%rax),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x9,%eax
je     12c1 <print_flow_code+0x191>
jmp    1276 <print_flow_code+0x146>
mov    -0x3c(%rbp),%eax
sub    $0xa,%eax
je     12ea <print_flow_code+0x1ba>
jmp    1287 <print_flow_code+0x157>
mov    -0x3c(%rbp),%eax
sub    $0x20,%eax
jne    12fa <print_flow_code+0x1ca>
jmp    1298 <print_flow_code+0x168>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <read_label@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rdx
lea    0xd9c(%rip),%rsi
call   1040 <fprintf@plt>
jmp    12fa <print_flow_code+0x1ca>
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <read_label@plt>
mov    -0x50(%rbp),%rdi
mov    %rax,%rdx
lea    0xd95(%rip),%rsi
call   1040 <fprintf@plt>
jmp    12fa <print_flow_code+0x1ca>
mov    -0x8(%rbp),%rsi
lea    0xda5(%rip),%rdi
call   1030 <fputs@plt>
jmp    134b <print_flow_code+0x21b>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0xa,%eax
jne    1330 <print_flow_code+0x200>
mov    -0x8(%rbp),%rsi
lea    0xda1(%rip),%rdi
call   1030 <fputs@plt>
jmp    1346 <print_flow_code+0x216>
mov    0x2ca9(%rip),%rax
mov    (%rax),%rsi
lea    0xd9d(%rip),%rdi
call   1030 <fputs@plt>
jmp    134b <print_flow_code+0x21b>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_flow_code>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rsp)
movsbl 0x1(%rax),%ecx
cmp    $0x9,%ecx
je     1197 <print_flow_code+0x67>
cmp    $0xa,%ecx
je     11cb <print_flow_code+0x9b>
cmp    $0x20,%ecx
jne    125b <print_flow_code+0x12b>
lea    0x2(%rax),%rcx
mov    %rcx,(%rsp)
movsbl 0x2(%rax),%eax
cmp    $0x9,%eax
je     1204 <print_flow_code+0xd4>
cmp    $0xa,%eax
je     1215 <print_flow_code+0xe5>
cmp    $0x20,%eax
jne    125b <print_flow_code+0x12b>
mov    %rsp,%rdi
call   1040 <read_label@plt>
lea    0xe6e(%rip),%rsi
jmp    1235 <print_flow_code+0x105>
lea    0x2(%rax),%rcx
mov    %rcx,(%rsp)
movsbl 0x2(%rax),%eax
cmp    $0x9,%eax
je     1226 <print_flow_code+0xf6>
cmp    $0xa,%eax
je     1242 <print_flow_code+0x112>
cmp    $0x20,%eax
jne    125b <print_flow_code+0x12b>
mov    %rsp,%rdi
call   1040 <read_label@plt>
lea    0xe8a(%rip),%rsi
jmp    1235 <print_flow_code+0x105>
lea    0x2(%rax),%rcx
mov    %rcx,(%rsp)
cmpb   $0xa,0x2(%rax)
jne    11e7 <print_flow_code+0xb7>
lea    0xee7(%rip),%rdi
mov    $0x16,%esi
jmp    124e <print_flow_code+0x11e>
mov    0x2df2(%rip),%rax
mov    (%rax),%rcx
lea    0xee6(%rip),%rdi
mov    $0x35,%esi
mov    $0x1,%edx
jmp    1256 <print_flow_code+0x126>
mov    %rsp,%rdi
call   1040 <read_label@plt>
lea    0xdf3(%rip),%rsi
jmp    1235 <print_flow_code+0x105>
mov    %rsp,%rdi
call   1040 <read_label@plt>
lea    0xe23(%rip),%rsi
jmp    1235 <print_flow_code+0x105>
mov    %rsp,%rdi
call   1040 <read_label@plt>
lea    0xe40(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   1030 <fprintf@plt>
jmp    125b <print_flow_code+0x12b>
lea    0xe51(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
mov    (%rsp),%rax
mov    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"\0A%s:\0A\00"
@.str.1 = [65 x i8] c" if (!setjmp(call_stack[call_stack_idx++])) {\0A goto %s;\0A }\0A\00"
@.str.2 = [12 x i8] c" goto %s;\0A\00"
@.str.3 = [34 x i8] c" if (!pop()) {\0A goto %s;\0A }\0A\00"
@.str.4 = [37 x i8] c" if (pop() < 0) {\0A goto %s;\0A }\0A\00"
@.str.5 = [45 x i8] c" longjmp(call_stack[--call_stack_idx], 1);\0A\00"
@.str.6 = [23 x i8] c" exit(EXIT_SUCCESS);\0A\00"
@.str.7 = [54 x i8] c"Undefined flow control command is detected: [N][S/T]\0A\00"
@stderr = global i32* null
define void @print_flow_code(i32* %0, i8** %1) {
%3 = alloca i32*
%4 = alloca i8**
%5 = alloca i8*
store i32* %0, i32** %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %4
%7 = load i8*, i8** %6
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %5
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
switch i32 %11, label %60 [
i32 32, label %12
i32 9, label %30
i32 10, label %47
]
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %5
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
switch i32 %16, label %29 [
i32 32, label %17
i32 9, label %21
i32 10, label %25
]
17: ; preds = %12
%18 = load i32*, i32** %3
%19 = call i8* @read_label(i8** %5)
%20 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %19)
br label %29
21: ; preds = %12
%22 = load i32*, i32** %3
%23 = call i8* @read_label(i8** %5)
%24 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %23)
br label %29
25: ; preds = %12
%26 = load i32*, i32** %3
%27 = call i8* @read_label(i8** %5)
%28 = call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %12, %25, %21, %17
br label %60
30: ; preds = %2
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %5
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
switch i32 %34, label %46 [
i32 32, label %35
i32 9, label %39
i32 10, label %43
]
35: ; preds = %30
%36 = load i32*, i32** %3
%37 = call i8* @read_label(i8** %5)
%38 = call i32 @fprintf(i32* %36, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %37)
br label %46
39: ; preds = %30
%40 = load i32*, i32** %3
%41 = call i8* @read_label(i8** %5)
%42 = call i32 @fprintf(i32* %40, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %41)
br label %46
43: ; preds = %30
%44 = load i32*, i32** %3
%45 = call i32 @fputs(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32* %44)
br label %46
46: ; preds = %30, %43, %39, %35
br label %60
47: ; preds = %2
%48 = load i8*, i8** %5
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %5
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 10
br i1 %52, label %53, label %56
53: ; preds = %47
%54 = load i32*, i32** %3
%55 = call i32 @fputs(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i32* %54)
br label %59
56: ; preds = %47
%57 = load i32*, i32** @stderr
%58 = call i32 @fputs(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32* %57)
br label %59
59: ; preds = %56, %53
br label %60
60: ; preds = %2, %59, %46, %29
%61 = load i8*, i8** %5
%62 = load i8**, i8*** %4
store i8* %61, i8** %62
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\0A%s:\0A\00"
@.str.1 = [65 x i8] c" if (!setjmp(call_stack[call_stack_idx++])) {\0A goto %s;\0A }\0A\00"
@.str.2 = [12 x i8] c" goto %s;\0A\00"
@.str.3 = [34 x i8] c" if (!pop()) {\0A goto %s;\0A }\0A\00"
@.str.4 = [37 x i8] c" if (pop() < 0) {\0A goto %s;\0A }\0A\00"
@.str.5 = [45 x i8] c" longjmp(call_stack[--call_stack_idx], 1);\0A\00"
@.str.6 = [23 x i8] c" exit(EXIT_SUCCESS);\0A\00"
@.str.7 = [54 x i8] c"Undefined flow control command is detected: [N][S/T]\0A\00"
@stderr = global i32* null
define void @print_flow_code(i32* nocapture %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = load i8*, i8** %1
%6 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %6, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
switch i32 %8, label %43 [
i32 32, label %9
i32 9, label %22
i32 10, label %34
]
9: ; preds = %2
%10 = getelementptr inbounds i8, i8* %5, i64 2
store i8* %10, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
switch i32 %12, label %43 [
i32 32, label %13
i32 9, label %16
i32 10, label %19
]
13: ; preds = %9
%14 = call i8* @read_label(i8** %3)
%15 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %43
16: ; preds = %9
%17 = call i8* @read_label(i8** %3)
%18 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* %17)
br label %43
19: ; preds = %9
%20 = call i8* @read_label(i8** %3)
%21 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %20)
br label %43
22: ; preds = %2
%23 = getelementptr inbounds i8, i8* %5, i64 2
store i8* %23, i8** %3
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
switch i32 %25, label %43 [
i32 32, label %26
i32 9, label %29
i32 10, label %32
]
26: ; preds = %22
%27 = call i8* @read_label(i8** %3)
%28 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i8* %27)
br label %43
29: ; preds = %22
%30 = call i8* @read_label(i8** %3)
%31 = call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), i8* %30)
br label %43
32: ; preds = %22
%33 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i64 44, i64 1, i32* %0)
br label %43
34: ; preds = %2
%35 = getelementptr inbounds i8, i8* %5, i64 2
store i8* %35, i8** %3
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 10
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0), i64 22, i64 1, i32* %0)
br label %43
40: ; preds = %34
%41 = load i32*, i32** @stderr
%42 = tail call i64 @fwrite(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i64 53, i64 1, i32* %41)
br label %43
43: ; preds = %38, %40, %26, %29, %32, %22, %13, %16, %19, %9, %2
%44 = load i8*, i8** %3
store i8* %44, i8** %1
ret void
}