#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*/ strcat(char *, char);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int /*<<< orphan*/ strsep(char **, char *);
void parser(char *s, char res[][255], char host[][255]) {
  int i, j = 0;
  int n;
  char hosts[255];
  for (i = 0; s[i] != '\r'; i++)
    ;
  s[i] = '\0';
  n = i++;
  for (i = 0, j = 0; i < 3; i++, j++) {
    strcpy(res[j], strsep(&s, " "));
  }
  for (i = n; s[i] != '\r'; i++) {
    strcat(hosts, s[i]);
  }
  for (i = 0, j = 0; i < 3; i++, j++) {
    strcpy(host[j], strsep(&hosts, ":"));
  }
}


x86 assembly (clang, -O0):
<parser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     117d <parser+0x4d>
jmp    116f <parser+0x3f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1155 <parser+0x25>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    11fd <parser+0xcd>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0xff,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x138(%rbp)
lea    -0x8(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1040 <strsep@plt>
mov    -0x138(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11a5 <parser+0x75>
mov    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xd,%eax
je     123e <parser+0x10e>
lea    -0x130(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1050 <strcat@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1203 <parser+0xd3>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    12a7 <parser+0x177>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
imul   $0xff,%rcx,%rcx
add    %rcx,%rax
mov    %rax,-0x140(%rbp)
lea    -0x130(%rbp),%rdi
lea    0xd85(%rip),%rsi
call   1040 <strsep@plt>
mov    -0x140(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    124c <parser+0x11c>
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parser>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rdx,0x8(%rsp)
mov    %rsi,%rbx
mov    %rdi,(%rsp)
mov    $0xffffffffffffffff,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0xd,0x1(%rdi,%rbp,1)
lea    0x1(%rbp),%rbp
jne    1160 <parser+0x30>
mov    %ebp,%r15d
movb   $0x0,(%rdi,%r15,1)
lea    0xe86(%rip),%r12
mov    %rsp,%r14
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <strsep@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    0xff(%rbx),%r13
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <strsep@plt>
mov    %r13,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
add    $0x1fe,%rbx
mov    %r14,%rdi
mov    %r12,%rsi
call   1040 <strsep@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    (%rsp),%rax
mov    (%rax,%r15,1),%al
cmp    $0xd,%al
je     120b <parser+0xdb>
mov    %ebp,%ebp
add    $0x1,%rbp
lea    0x10(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%esi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    (%rsp),%rax
movzbl (%rax,%rbp,1),%eax
add    $0x1,%rbp
cmp    $0xd,%al
jne    11f0 <parser+0xc0>
lea    0xdf0(%rip),%r15
lea    0x10(%rsp),%r12
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strsep@plt>
mov    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
lea    0xff(%rbp),%rbx
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strsep@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
add    $0x1fe,%rbp
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <strsep@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c":\00"
define void @parser(i8* %0, [255 x i8]* %1, [255 x i8]* %2) {
%4 = alloca i8*
%5 = alloca [255 x i8]*
%6 = alloca [255 x i8]*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [255 x i8]
store i8* %0, i8** %4
store [255 x i8]* %1, [255 x i8]** %5
store [255 x i8]* %2, [255 x i8]** %6
store i32 0, i32* %8
store i32 0, i32* %7
br label %11
11: ; preds = %20, %3
%12 = load i8*, i8** %4
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 13
br i1 %18, label %19, label %23
19: ; preds = %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
store i32 %22, i32* %7
br label %11
23: ; preds = %11
%24 = load i8*, i8** %4
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 0, i8* %27
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
store i32 %28, i32* %9
store i32 0, i32* %7
store i32 0, i32* %8
br label %30
30: ; preds = %41, %23
%31 = load i32, i32* %7
%32 = icmp slt i32 %31, 3
br i1 %32, label %33, label %46
33: ; preds = %30
%34 = load [255 x i8]*, [255 x i8]** %5
%35 = load i32, i32* %8
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [255 x i8], [255 x i8]* %34, i64 %36
%38 = getelementptr inbounds [255 x i8], [255 x i8]* %37, i64 0, i64 0
%39 = call i32 @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%40 = call i32 @strcpy(i8* %38, i32 %39)
br label %41
41: ; preds = %33
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
%44 = load i32, i32* %8
%45 = add nsw i32 %44, 1
store i32 %45, i32* %8
br label %30
46: ; preds = %30
%47 = load i32, i32* %9
store i32 %47, i32* %7
br label %48
48: ; preds = %64, %46
%49 = load i8*, i8** %4
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp ne i32 %54, 13
br i1 %55, label %56, label %67
56: ; preds = %48
%57 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%58 = load i8*, i8** %4
%59 = load i32, i32* %7
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
%62 = load i8, i8* %61
%63 = call i32 @strcat(i8* %57, i8 signext %62)
br label %64
64: ; preds = %56
%65 = load i32, i32* %7
%66 = add nsw i32 %65, 1
store i32 %66, i32* %7
br label %48
67: ; preds = %48
store i32 0, i32* %7
store i32 0, i32* %8
br label %68
68: ; preds = %80, %67
%69 = load i32, i32* %7
%70 = icmp slt i32 %69, 3
br i1 %70, label %71, label %85
71: ; preds = %68
%72 = load [255 x i8]*, [255 x i8]** %6
%73 = load i32, i32* %8
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [255 x i8], [255 x i8]* %72, i64 %74
%76 = getelementptr inbounds [255 x i8], [255 x i8]* %75, i64 0, i64 0
%77 = bitcast [255 x i8]* %10 to i8**
%78 = call i32 @strsep(i8** %77, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%79 = call i32 @strcpy(i8* %76, i32 %78)
br label %80
80: ; preds = %71
%81 = load i32, i32* %7
%82 = add nsw i32 %81, 1
store i32 %82, i32* %7
%83 = load i32, i32* %8
%84 = add nsw i32 %83, 1
store i32 %84, i32* %8
br label %68
85: ; preds = %68
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
@.str.1 = [2 x i8] c":\00"
define void @parser(i8* %0, [255 x i8]* %1, [255 x i8]* %2) {
%4 = alloca i8*
%5 = alloca [255 x i8]
store i8* %0, i8** %4
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
br label %7
7: ; preds = %7, %3
%8 = phi i64 [ %12, %7 ], [ 0, %3 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 13
%12 = add nuw i64 %8, 1
br i1 %11, label %13, label %7
13: ; preds = %7
%14 = and i64 %8, 4294967295
%15 = getelementptr inbounds i8, i8* %0, i64 %14
store i8 0, i8* %15
%16 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%17 = call i32 @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @strcpy(i8* %16, i32 %17)
%19 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 1, i64 0
%20 = call i32 @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @strcpy(i8* %19, i32 %20)
%22 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 2, i64 0
%23 = call i32 @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @strcpy(i8* %22, i32 %23)
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i64 %14
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 13
br i1 %28, label %29, label %40
29: ; preds = %40, %13
%30 = bitcast [255 x i8]* %5 to i8**
%31 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%32 = call i32 @strsep(i8** %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @strcpy(i8* %31, i32 %32)
%34 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 1, i64 0
%35 = call i32 @strsep(i8** %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%36 = call i32 @strcpy(i8* %34, i32 %35)
%37 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 2, i64 0
%38 = call i32 @strsep(i8** %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @strcpy(i8* %37, i32 %38)
ret void
40: ; preds = %13, %40
%41 = phi i64 [ %44, %40 ], [ %14, %13 ]
%42 = phi i8 [ %47, %40 ], [ %27, %13 ]
%43 = call i32 @strcat(i8* %6, i8 signext %42)
%44 = add nuw i64 %41, 1
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i64 %44
%47 = load i8, i8* %46
%48 = icmp eq i8 %47, 13
br i1 %48, label %29, label %40
}