#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 tbox {
  int dummy;
};
struct nav_desc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ l_nav_desc_add(struct tbox *, struct nav_desc *);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ tbox_line_add(struct tbox *, char *);
void nav_desc_add(struct tbox *tb, struct nav_desc **desc_normal,
                  struct nav_desc **desc_select,
                  struct nav_desc **desc_general) {
  unsigned int i;
  {
    char line[120 + 1];
    sprintf(line, "\\BSupported keys in this window\\B");
    tbox_line_add(tb, line);
  };
  {
    char line[120 + 1];
    sprintf(line, " ");
    tbox_line_add(tb, line);
  };
  {
    char line[120 + 1];
    sprintf(line, "NORMAL MODE:");
    tbox_line_add(tb, line);
  };
  for (i = 0; (desc_normal[i]); i++)
    l_nav_desc_add(tb, desc_normal[i]);
  {
    char line[120 + 1];
    sprintf(line, " ");
    tbox_line_add(tb, line);
  };
  {
    char line[120 + 1];
    sprintf(line, "SELECT MODE:");
    tbox_line_add(tb, line);
  };
  for (i = 0; (desc_select[i]); i++)
    l_nav_desc_add(tb, desc_select[i]);
  {
    char line[120 + 1];
    sprintf(line, " ");
    tbox_line_add(tb, line);
  };
  {
    char line[120 + 1];
    sprintf(line, "GENERAL:");
    tbox_line_add(tb, line);
  };
  for (i = 0; (desc_general[i]); i++)
    l_nav_desc_add(tb, desc_general[i]);
  {
    char line[120 + 1];
    sprintf(line, " ");
    tbox_line_add(tb, line);
  };
}


x86 assembly (clang, -O0):
<nav_desc_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
call   1040 <tbox_line_add@plt>
lea    -0x120(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x120(%rbp),%rsi
call   1040 <tbox_line_add@plt>
lea    -0x1a0(%rbp),%rdi
lea    0xe85(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1a0(%rbp),%rsi
call   1040 <tbox_line_add@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     11ef <nav_desc_add+0xbf>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    (%rax,%rcx,8),%rsi
call   1030 <l_nav_desc_add@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bb <nav_desc_add+0x8b>
lea    -0x220(%rbp),%rdi
lea    0xe25(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x220(%rbp),%rsi
call   1040 <tbox_line_add@plt>
lea    -0x2a0(%rbp),%rdi
lea    0xe11(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x2a0(%rbp),%rsi
call   1040 <tbox_line_add@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     1270 <nav_desc_add+0x140>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    (%rax,%rcx,8),%rsi
call   1030 <l_nav_desc_add@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    123c <nav_desc_add+0x10c>
lea    -0x320(%rbp),%rdi
lea    0xda4(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x320(%rbp),%rsi
call   1040 <tbox_line_add@plt>
lea    -0x3a0(%rbp),%rdi
lea    0xd9d(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
call   1040 <tbox_line_add@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
cmpq   $0x0,(%rax,%rcx,8)
je     12f1 <nav_desc_add+0x1c1>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x24(%rbp),%ecx
mov    (%rax,%rcx,8),%rsi
call   1030 <l_nav_desc_add@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12bd <nav_desc_add+0x18d>
lea    -0x420(%rbp),%rdi
lea    0xd23(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1040 <tbox_line_add@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nav_desc_add>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
movups 0xece(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0xeb2(%rip),%xmm0
movaps %xmm0,(%rsp)
movw   $0x42,0x20(%rsp)
mov    %rsp,%rsi
call   1040 <tbox_line_add@plt>
movw   $0x20,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <tbox_line_add@plt>
movabs $0x3a45444f4d204c,%rax
mov    %rax,0x5(%rsp)
movabs $0x4d204c414d524f4e,%rax
4c 20 4d
mov    %rax,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <tbox_line_add@plt>
mov    (%r12),%rsi
test   %rsi,%rsi
je     11c6 <nav_desc_add+0xa6>
mov    $0x1,%ebp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <l_nav_desc_add@plt>
mov    %ebp,%eax
mov    (%r12,%rax,8),%rsi
add    $0x1,%ebp
test   %rsi,%rsi
jne    11b0 <nav_desc_add+0x90>
movw   $0x20,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <tbox_line_add@plt>
movabs $0x3a45444f4d2054,%rax
mov    %rax,0x5(%rsp)
movabs $0x4d205443454c4553,%rax
54 20 4d
mov    %rax,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <tbox_line_add@plt>
mov    (%r15),%rsi
test   %rsi,%rsi
je     1226 <nav_desc_add+0x106>
mov    $0x1,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <l_nav_desc_add@plt>
mov    %ebp,%eax
mov    (%r15,%rax,8),%rsi
add    $0x1,%ebp
test   %rsi,%rsi
jne    1210 <nav_desc_add+0xf0>
movw   $0x20,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <tbox_line_add@plt>
movabs $0x3a4c4152454e4547,%rax
41 4c 3a
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <tbox_line_add@plt>
mov    (%r14),%rsi
test   %rsi,%rsi
je     1286 <nav_desc_add+0x166>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1030 <l_nav_desc_add@plt>
mov    %ebp,%eax
mov    (%r14,%rax,8),%rsi
add    $0x1,%ebp
test   %rsi,%rsi
jne    1270 <nav_desc_add+0x150>
movw   $0x20,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <tbox_line_add@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tbox = type { i32 }
%struct.nav_desc = type { i32 }
@.str = [34 x i8] c"\\BSupported keys in this window\\B\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [13 x i8] c"NORMAL MODE:\00"
@.str.3 = [13 x i8] c"SELECT MODE:\00"
@.str.4 = [9 x i8] c"GENERAL:\00"
define void @nav_desc_add(%struct.tbox* %0, %struct.nav_desc** %1, %struct.nav_desc** %2, %struct.nav_desc** %3) {
%5 = alloca %struct.tbox*
%6 = alloca %struct.nav_desc**
%7 = alloca %struct.nav_desc**
%8 = alloca %struct.nav_desc**
%9 = alloca i32
%10 = alloca [121 x i8]
%11 = alloca [121 x i8]
%12 = alloca [121 x i8]
%13 = alloca [121 x i8]
%14 = alloca [121 x i8]
%15 = alloca [121 x i8]
%16 = alloca [121 x i8]
%17 = alloca [121 x i8]
store %struct.tbox* %0, %struct.tbox** %5
store %struct.nav_desc** %1, %struct.nav_desc*** %6
store %struct.nav_desc** %2, %struct.nav_desc*** %7
store %struct.nav_desc** %3, %struct.nav_desc*** %8
%18 = getelementptr inbounds [121 x i8], [121 x i8]* %10, i64 0, i64 0
%19 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%20 = load %struct.tbox*, %struct.tbox** %5
%21 = getelementptr inbounds [121 x i8], [121 x i8]* %10, i64 0, i64 0
%22 = call i32 @tbox_line_add(%struct.tbox* %20, i8* %21)
%23 = getelementptr inbounds [121 x i8], [121 x i8]* %11, i64 0, i64 0
%24 = call i32 @sprintf(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = load %struct.tbox*, %struct.tbox** %5
%26 = getelementptr inbounds [121 x i8], [121 x i8]* %11, i64 0, i64 0
%27 = call i32 @tbox_line_add(%struct.tbox* %25, i8* %26)
%28 = getelementptr inbounds [121 x i8], [121 x i8]* %12, i64 0, i64 0
%29 = call i32 @sprintf(i8* %28, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%30 = load %struct.tbox*, %struct.tbox** %5
%31 = getelementptr inbounds [121 x i8], [121 x i8]* %12, i64 0, i64 0
%32 = call i32 @tbox_line_add(%struct.tbox* %30, i8* %31)
store i32 0, i32* %9
br label %33
33: ; preds = %48, %4
%34 = load %struct.nav_desc**, %struct.nav_desc*** %6
%35 = load i32, i32* %9
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %34, i64 %36
%38 = load %struct.nav_desc*, %struct.nav_desc** %37
%39 = icmp ne %struct.nav_desc* %38, null
br i1 %39, label %40, label %51
40: ; preds = %33
%41 = load %struct.tbox*, %struct.tbox** %5
%42 = load %struct.nav_desc**, %struct.nav_desc*** %6
%43 = load i32, i32* %9
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %42, i64 %44
%46 = load %struct.nav_desc*, %struct.nav_desc** %45
%47 = call i32 @l_nav_desc_add(%struct.tbox* %41, %struct.nav_desc* %46)
br label %48
48: ; preds = %40
%49 = load i32, i32* %9
%50 = add i32 %49, 1
store i32 %50, i32* %9
br label %33
51: ; preds = %33
%52 = getelementptr inbounds [121 x i8], [121 x i8]* %13, i64 0, i64 0
%53 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%54 = load %struct.tbox*, %struct.tbox** %5
%55 = getelementptr inbounds [121 x i8], [121 x i8]* %13, i64 0, i64 0
%56 = call i32 @tbox_line_add(%struct.tbox* %54, i8* %55)
%57 = getelementptr inbounds [121 x i8], [121 x i8]* %14, i64 0, i64 0
%58 = call i32 @sprintf(i8* %57, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%59 = load %struct.tbox*, %struct.tbox** %5
%60 = getelementptr inbounds [121 x i8], [121 x i8]* %14, i64 0, i64 0
%61 = call i32 @tbox_line_add(%struct.tbox* %59, i8* %60)
store i32 0, i32* %9
br label %62
62: ; preds = %77, %51
%63 = load %struct.nav_desc**, %struct.nav_desc*** %7
%64 = load i32, i32* %9
%65 = zext i32 %64 to i64
%66 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %63, i64 %65
%67 = load %struct.nav_desc*, %struct.nav_desc** %66
%68 = icmp ne %struct.nav_desc* %67, null
br i1 %68, label %69, label %80
69: ; preds = %62
%70 = load %struct.tbox*, %struct.tbox** %5
%71 = load %struct.nav_desc**, %struct.nav_desc*** %7
%72 = load i32, i32* %9
%73 = zext i32 %72 to i64
%74 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %71, i64 %73
%75 = load %struct.nav_desc*, %struct.nav_desc** %74
%76 = call i32 @l_nav_desc_add(%struct.tbox* %70, %struct.nav_desc* %75)
br label %77
77: ; preds = %69
%78 = load i32, i32* %9
%79 = add i32 %78, 1
store i32 %79, i32* %9
br label %62
80: ; preds = %62
%81 = getelementptr inbounds [121 x i8], [121 x i8]* %15, i64 0, i64 0
%82 = call i32 @sprintf(i8* %81, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%83 = load %struct.tbox*, %struct.tbox** %5
%84 = getelementptr inbounds [121 x i8], [121 x i8]* %15, i64 0, i64 0
%85 = call i32 @tbox_line_add(%struct.tbox* %83, i8* %84)
%86 = getelementptr inbounds [121 x i8], [121 x i8]* %16, i64 0, i64 0
%87 = call i32 @sprintf(i8* %86, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%88 = load %struct.tbox*, %struct.tbox** %5
%89 = getelementptr inbounds [121 x i8], [121 x i8]* %16, i64 0, i64 0
%90 = call i32 @tbox_line_add(%struct.tbox* %88, i8* %89)
store i32 0, i32* %9
br label %91
91: ; preds = %106, %80
%92 = load %struct.nav_desc**, %struct.nav_desc*** %8
%93 = load i32, i32* %9
%94 = zext i32 %93 to i64
%95 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %92, i64 %94
%96 = load %struct.nav_desc*, %struct.nav_desc** %95
%97 = icmp ne %struct.nav_desc* %96, null
br i1 %97, label %98, label %109
98: ; preds = %91
%99 = load %struct.tbox*, %struct.tbox** %5
%100 = load %struct.nav_desc**, %struct.nav_desc*** %8
%101 = load i32, i32* %9
%102 = zext i32 %101 to i64
%103 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %100, i64 %102
%104 = load %struct.nav_desc*, %struct.nav_desc** %103
%105 = call i32 @l_nav_desc_add(%struct.tbox* %99, %struct.nav_desc* %104)
br label %106
106: ; preds = %98
%107 = load i32, i32* %9
%108 = add i32 %107, 1
store i32 %108, i32* %9
br label %91
109: ; preds = %91
%110 = getelementptr inbounds [121 x i8], [121 x i8]* %17, i64 0, i64 0
%111 = call i32 @sprintf(i8* %110, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%112 = load %struct.tbox*, %struct.tbox** %5
%113 = getelementptr inbounds [121 x i8], [121 x i8]* %17, i64 0, i64 0
%114 = call i32 @tbox_line_add(%struct.tbox* %112, i8* %113)
ret void
}

LLVM IR (-O2):
%struct.tbox = type { i32 }
%struct.nav_desc = type { i32 }
@.str = [34 x i8] c"\\BSupported keys in this window\\B\00"
@.str.2 = [13 x i8] c"NORMAL MODE:\00"
@.str.3 = [13 x i8] c"SELECT MODE:\00"
@.str.4 = [9 x i8] c"GENERAL:\00"
define void @nav_desc_add(%struct.tbox* %0, %struct.nav_desc** nocapture %1, %struct.nav_desc** nocapture %2, %struct.nav_desc** nocapture %3) {
%5 = alloca [121 x i8]
%6 = alloca [121 x i8]
%7 = alloca [121 x i8]
%8 = alloca [121 x i8]
%9 = alloca [121 x i8]
%10 = alloca [121 x i8]
%11 = alloca [121 x i8]
%12 = alloca [121 x i8]
%13 = getelementptr inbounds [121 x i8], [121 x i8]* %5, i64 0, i64 0
%14 = call i32 @tbox_line_add(%struct.tbox* %0, i8* %13)
%15 = getelementptr inbounds [121 x i8], [121 x i8]* %6, i64 0, i64 0
%16 = bitcast [121 x i8]* %6 to i16*
store i16 32, i16* %16
%17 = call i32 @tbox_line_add(%struct.tbox* %0, i8* %15)
%18 = getelementptr inbounds [121 x i8], [121 x i8]* %7, i64 0, i64 0
%19 = call i32 @tbox_line_add(%struct.tbox* %0, i8* %18)
%20 = load %struct.nav_desc*, %struct.nav_desc** %1
%21 = icmp eq %struct.nav_desc* %20, null
br i1 %21, label %31, label %22
22: ; preds = %4, %22
%23 = phi %struct.nav_desc* [ %29, %22 ], [ %20, %4 ]
%24 = phi i32 [ %26, %22 ], [ 0, %4 ]
%25 = call i32 @l_nav_desc_add(%struct.tbox* %0, %struct.nav_desc* %23)
%26 = add i32 %24, 1
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %1, i64 %27
%29 = load %struct.nav_desc*, %struct.nav_desc** %28
%30 = icmp eq %struct.nav_desc* %29, null
br i1 %30, label %31, label %22
31: ; preds = %22, %4
%32 = getelementptr inbounds [121 x i8], [121 x i8]* %8, i64 0, i64 0
%33 = bitcast [121 x i8]* %8 to i16*
store i16 32, i16* %33
%34 = call i32 @tbox_line_add(%struct.tbox* %0, i8* %32)
%35 = getelementptr inbounds [121 x i8], [121 x i8]* %9, i64 0, i64 0
%36 = call i32 @tbox_line_add(%struct.tbox* %0, i8* %35)
%37 = load %struct.nav_desc*, %struct.nav_desc** %2
%38 = icmp eq %struct.nav_desc* %37, null
br i1 %38, label %48, label %39
39: ; preds = %31, %39
%40 = phi %struct.nav_desc* [ %46, %39 ], [ %37, %31 ]
%41 = phi i32 [ %43, %39 ], [ 0, %31 ]
%42 = call i32 @l_nav_desc_add(%struct.tbox* %0, %struct.nav_desc* %40)
%43 = add i32 %41, 1
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %2, i64 %44
%46 = load %struct.nav_desc*, %struct.nav_desc** %45
%47 = icmp eq %struct.nav_desc* %46, null
br i1 %47, label %48, label %39
48: ; preds = %39, %31
%49 = getelementptr inbounds [121 x i8], [121 x i8]* %10, i64 0, i64 0
%50 = bitcast [121 x i8]* %10 to i16*
store i16 32, i16* %50
%51 = call i32 @tbox_line_add(%struct.tbox* %0, i8* %49)
%52 = getelementptr inbounds [121 x i8], [121 x i8]* %11, i64 0, i64 0
%53 = call i32 @tbox_line_add(%struct.tbox* %0, i8* %52)
%54 = load %struct.nav_desc*, %struct.nav_desc** %3
%55 = icmp eq %struct.nav_desc* %54, null
br i1 %55, label %65, label %56
56: ; preds = %48, %56
%57 = phi %struct.nav_desc* [ %63, %56 ], [ %54, %48 ]
%58 = phi i32 [ %60, %56 ], [ 0, %48 ]
%59 = call i32 @l_nav_desc_add(%struct.tbox* %0, %struct.nav_desc* %57)
%60 = add i32 %58, 1
%61 = zext i32 %60 to i64
%62 = getelementptr inbounds %struct.nav_desc*, %struct.nav_desc** %3, i64 %61
%63 = load %struct.nav_desc*, %struct.nav_desc** %62
%64 = icmp eq %struct.nav_desc* %63, null
br i1 %64, label %65, label %56
65: ; preds = %56, %48
%66 = getelementptr inbounds [121 x i8], [121 x i8]* %12, i64 0, i64 0
%67 = bitcast [121 x i8]* %12 to i16*
store i16 32, i16* %67
%68 = call i32 @tbox_line_add(%struct.tbox* %0, i8* %66)
ret void
}