#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*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strtok_r(char *, char *, char **);
int parse_list_reply(char *rbuf, int len) {
  char *tok;
  char *tokens[100];
  if ((tok = strtok_r(rbuf, "\r\n", tokens)) == NULL)
    return -1;
  fprintf(stderr, "Server > %s\n", tok);
  while ((tok = strtok_r(NULL, "\r\n", tokens)) != NULL)
    fprintf(stderr, "Server > %s\n", tok);
  return 0;
}


x86 assembly (clang, -O0):
<parse_list_reply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x340(%rbp),%rdx
lea    0xebc(%rip),%rsi
call   1030 <strtok_r@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1163 <parse_list_reply+0x43>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c6 <parse_list_reply+0xa6>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe8c(%rip),%rsi
call   1040 <fprintf@plt>
lea    -0x340(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%edi
lea    0xe72(%rip),%rsi
call   1030 <strtok_r@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     11bf <parse_list_reply+0x9f>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
lea    0xe4e(%rip),%rsi
call   1040 <fprintf@plt>
jmp    117c <parse_list_reply+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_list_reply>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x320,%rsp
lea    0xec9(%rip),%rsi
mov    %rsp,%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
je     11b5 <parse_list_reply+0x95>
mov    0x2e95(%rip),%r13
mov    0x0(%r13),%edi
lea    0xead(%rip),%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
lea    0xe9b(%rip),%rsi
xor    %ebx,%ebx
mov    %rsp,%rdx
xor    %edi,%edi
call   1030 <strtok_r@plt>
test   %rax,%rax
je     11ba <parse_list_reply+0x9a>
lea    0xe86(%rip),%r14
lea    0xe7c(%rip),%r15
mov    %rsp,%r12
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
xor    %ebx,%ebx
xor    %edi,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
jne    1190 <parse_list_reply+0x70>
jmp    11ba <parse_list_reply+0x9a>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x320,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\0D\0A\00"
@stderr = global i32 0
@.str.1 = [13 x i8] c"Server > %s\0A\00"
define i32 @parse_list_reply(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [100 x i8*]
store i8* %0, i8** %4
store i32 %1, i32* %5
%8 = load i8*, i8** %4
%9 = getelementptr inbounds [100 x i8*], [100 x i8*]* %7, i64 0, i64 0
%10 = call i8* @strtok_r(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %9)
store i8* %10, i8** %6
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %26
13: ; preds = %2
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %6
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %21, %13
%18 = getelementptr inbounds [100 x i8*], [100 x i8*]* %7, i64 0, i64 0
%19 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %18)
store i8* %19, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %6
%24 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %23)
br label %17
25: ; preds = %17
store i32 0, i32* %3
br label %26
26: ; preds = %25, %12
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [3 x i8] c"\0D\0A\00"
@stderr = global i32 0
@.str.1 = [13 x i8] c"Server > %s\0A\00"
define i32 @parse_list_reply(i8* %0, i32 %1) {
%3 = alloca [100 x i8*]
%4 = bitcast [100 x i8*]* %3 to i8*
%5 = getelementptr inbounds [100 x i8*], [100 x i8*]* %3, i64 0, i64 0
%6 = call i8* @strtok_r(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5)
%7 = icmp eq i8* %6, null
br i1 %7, label %19, label %8
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%11 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5)
%12 = icmp eq i8* %11, null
br i1 %12, label %19, label %13
13: ; preds = %8, %13
%14 = phi i8* [ %17, %13 ], [ %11, %8 ]
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%17 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5)
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %13
19: ; preds = %13, %8, %2
%20 = phi i32 [ -1, %2 ], [ 0, %8 ], [ 0, %13 ]
ret i32 %20
}