#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 */
scalar_t__ asprintf(char **, char *, char *);
int /*<<< orphan*/ consume_symbol(char *);
int /*<<< orphan*/ exec_kernel_doc(char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ perror(char *);
void docsect(char *filename, char *line) {
  char *vec[7];
  char *s;
  for (s = line; *s; s++)
    if (*s == '\n')
      *s = '\0';
  if (asprintf(&s, "DOC: %s", line) < 0) {
    perror("asprintf");
    exit(1);
  }
  consume_symbol(s);
  free(s);
  vec[0] = "kernel-doc";
  vec[1] = "-docbook";
  vec[2] = "-show-not-found";
  vec[3] = "-function";
  vec[4] = line;
  vec[5] = filename;
  vec[6] = NULL;
  exec_kernel_doc(vec);
}


x86 assembly (clang, -O0):
<docsect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x58(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b2 <docsect+0x52>
mov    -0x58(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    119c <docsect+0x3c>
mov    -0x58(%rbp),%rax
movb   $0x0,(%rax)
jmp    11a1 <docsect+0x41>
mov    -0x58(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x58(%rbp)
jmp    1178 <docsect+0x18>
mov    -0x10(%rbp),%rdx
lea    -0x58(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1060 <asprintf@plt>
cmp    $0x0,%rax
jge    11e6 <docsect+0x86>
lea    0xe31(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x58(%rbp),%rdi
call   1050 <consume_symbol@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
lea    0xe12(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe12(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe10(%rip),%rax
mov    %rax,-0x40(%rbp)
lea    0xe15(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
lea    -0x50(%rbp),%rdi
call   1040 <exec_kernel_doc@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<docsect>:
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rax
jmp    118c <docsect+0x2c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x0,(%rax)
mov    0x8(%rsp),%rax
add    $0x1,%rax
mov    %rax,0x8(%rsp)
movzbl (%rax),%ecx
cmp    $0xa,%cl
je     1180 <docsect+0x20>
test   %cl,%cl
jne    1188 <docsect+0x28>
lea    0xe5c(%rip),%rsi
lea    0x8(%rsp),%rdi
mov    %rbx,%rdx
call   1060 <asprintf@plt>
test   %rax,%rax
js     121f <docsect+0xbf>
mov    0x8(%rsp),%rdi
call   1050 <consume_symbol@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
lea    0xe40(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xe3f(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xe3c(%rip),%rax
mov    %rax,0x20(%rsp)
lea    0xe40(%rip),%rax
mov    %rax,0x28(%rsp)
mov    %rbx,0x30(%rsp)
mov    %r14,0x38(%rsp)
movq   $0x0,0x40(%rsp)
lea    0x10(%rsp),%rdi
call   1040 <exec_kernel_doc@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret
lea    0xde2(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"DOC: %s\00"
@.str.1 = [9 x i8] c"asprintf\00"
@.str.2 = [11 x i8] c"kernel-doc\00"
@.str.3 = [9 x i8] c"-docbook\00"
@.str.4 = [16 x i8] c"-show-not-found\00"
@.str.5 = [10 x i8] c"-function\00"
define void @docsect(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [7 x i8*]
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %4
store i8* %7, i8** %6
br label %8
8: ; preds = %20, %2
%9 = load i8*, i8** %6
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %8
%13 = load i8*, i8** %6
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %19
17: ; preds = %12
%18 = load i8*, i8** %6
store i8 0, i8* %18
br label %19
19: ; preds = %17, %12
br label %20
20: ; preds = %19
%21 = load i8*, i8** %6
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %6
br label %8
23: ; preds = %8
%24 = load i8*, i8** %4
%25 = call i64 @asprintf(i8** %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %23
%28 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %23
%31 = load i8*, i8** %6
%32 = call i32 @consume_symbol(i8* %31)
%33 = load i8*, i8** %6
%34 = call i32 @free(i8* %33)
%35 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %35
%36 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %36
%37 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8** %37
%38 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 3
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %38
%39 = load i8*, i8** %4
%40 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 4
store i8* %39, i8** %40
%41 = load i8*, i8** %3
%42 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 5
store i8* %41, i8** %42
%43 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 6
store i8* null, i8** %43
%44 = getelementptr inbounds [7 x i8*], [7 x i8*]* %5, i64 0, i64 0
%45 = call i32 @exec_kernel_doc(i8** %44)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"DOC: %s\00"
@.str.1 = [9 x i8] c"asprintf\00"
@.str.2 = [11 x i8] c"kernel-doc\00"
@.str.3 = [9 x i8] c"-docbook\00"
@.str.4 = [16 x i8] c"-show-not-found\00"
@.str.5 = [10 x i8] c"-function\00"
define void @docsect(i8* %0, i8* %1) {
%3 = alloca [7 x i8*]
%4 = alloca i8*
%5 = bitcast [7 x i8*]* %3 to i8*
%6 = bitcast i8** %4 to i8*
br label %7
7: ; preds = %12, %2
%8 = phi i8* [ %1, %2 ], [ %14, %12 ]
store i8* %8, i8** %4
%9 = load i8, i8* %8
switch i8 %9, label %12 [
i8 0, label %15
i8 10, label %10
]
10: ; preds = %7
store i8 0, i8* %8
%11 = load i8*, i8** %4
br label %12
12: ; preds = %7, %10
%13 = phi i8* [ %8, %7 ], [ %11, %10 ]
%14 = getelementptr inbounds i8, i8* %13, i64 1
br label %7
15: ; preds = %7
%16 = call i64 @asprintf(i8** %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %1)
%17 = icmp slt i64 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %15
%22 = load i8*, i8** %4
%23 = call i32 @consume_symbol(i8* %22)
%24 = load i8*, i8** %4
%25 = call i32 @free(i8* %24)
%26 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %26
%27 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8** %27
%28 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8** %28
%29 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 3
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8** %29
%30 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 4
store i8* %1, i8** %30
%31 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 5
store i8* %0, i8** %31
%32 = getelementptr inbounds [7 x i8*], [7 x i8*]* %3, i64 0, i64 6
store i8* null, i8** %32
%33 = call i32 @exec_kernel_doc(i8** %26)
ret void
}