#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 */
scalar_t__ isspace(char);
char *strtok(char *, char *);
int /*<<< orphan*/ tfprintf(int /*<<< orphan*/ *, char *, char *);
void write_textinfo_xref(FILE *f, char *xref) {
  char *tok;
  tok = strtok(xref, ",;");
  while (tok) {
    while ((*tok) && (isspace(*tok)))
      tok++;
    tfprintf(f, "@xref{%s}.@*\n", tok);
    tok = strtok(NULL, ",;");
  }
}


x86 assembly (clang, -O0):
<write_textinfo_xref>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11dd <write_textinfo_xref+0xad>
jmp    1164 <write_textinfo_xref+0x34>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     118f <write_textinfo_xref+0x5f>
mov    -0x18(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    119f <write_textinfo_xref+0x6f>
jmp    11b0 <write_textinfo_xref+0x80>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1164 <write_textinfo_xref+0x34>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe44(%rip),%rsi
call   1040 <tfprintf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe31(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x18(%rbp)
jmp    1154 <write_textinfo_xref+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_textinfo_xref>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r12
lea    0xebb(%rip),%rsi
mov    %rax,%rdi
call   1050 <strtok@plt>
test   %rax,%rax
je     11bb <write_textinfo_xref+0x8b>
mov    %rax,%rbx
lea    0xea7(%rip),%r14
lea    0xe9d(%rip),%r15
jmp    1190 <write_textinfo_xref+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1040 <tfprintf@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   1050 <strtok@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11bb <write_textinfo_xref+0x8b>
mov    (%rbx),%al
test   %al,%al
je     1170 <write_textinfo_xref+0x40>
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %rax,%rax
je     1170 <write_textinfo_xref+0x40>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    11a0 <write_textinfo_xref+0x70>
jmp    1170 <write_textinfo_xref+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c",;\00"
@.str.1 = [14 x i8] c"@xref{%s}.@*\0A\00"
define void @write_textinfo_xref(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 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %7, i8** %5
br label %8
8: ; preds = %27, %2
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %32
11: ; preds = %8
br label %12
12: ; preds = %24, %11
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i8*, i8** %5
%19 = load i8, i8* %18
%20 = call i64 @isspace(i8 signext %19)
%21 = icmp ne i64 %20, 0
br label %22
22: ; preds = %17, %12
%23 = phi i1 [ false, %12 ], [ %21, %17 ]
br i1 %23, label %24, label %27
24: ; preds = %22
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %5
br label %12
27: ; preds = %22
%28 = load i32*, i32** %3
%29 = load i8*, i8** %5
%30 = call i32 @tfprintf(i32* %28, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %31, i8** %5
br label %8
32: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c",;\00"
@.str.1 = [14 x i8] c"@xref{%s}.@*\0A\00"
define void @write_textinfo_xref(i32* %0, i8* %1) {
%3 = tail call i8* @strtok(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %23, label %5
5: ; preds = %2, %18
%6 = phi i8* [ %21, %18 ], [ %3, %2 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %5, %14
%10 = phi i8 [ %16, %14 ], [ %7, %5 ]
%11 = phi i8* [ %15, %14 ], [ %6, %5 ]
%12 = tail call i64 @isspace(i8 signext %10)
%13 = icmp eq i64 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = getelementptr inbounds i8, i8* %11, i64 1
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %9
18: ; preds = %9, %14, %5
%19 = phi i8* [ %6, %5 ], [ %15, %14 ], [ %11, %9 ]
%20 = tail call i32 @tfprintf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp eq i8* %21, null
br i1 %22, label %23, label %5
23: ; preds = %18, %2
ret void
}