#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*/ strcpy(char *, char *);
char *strtok(char *, char *);
void main_split_input(char *input, char input_arr[4][256]) {
  char *ptr;
  ptr = strtok(input, " ");
  int i = 0;
  while (ptr != NULL) {
    if (i < 4) {
      strcpy(input_arr[i], ptr);
      ptr = strtok(NULL, " ");
      i++;
    }
  }
}


x86 assembly (clang, -O0):
<main_split_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     119a <main_split_input+0x7a>
cmpl   $0x4,-0x1c(%rbp)
jge    1195 <main_split_input+0x75>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
shl    $0x8,%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe7d(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <main_split_input+0x2b>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_split_input>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
lea    0xed1(%rip),%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     117b <main_split_input+0x5b>
xor    %ebx,%ebx
lea    0xebe(%rip),%r14
jmp    1155 <main_split_input+0x35>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %rax,%rax
je     117b <main_split_input+0x5b>
cmp    $0x3,%ebx
jg     1150 <main_split_input+0x30>
movslq %ebx,%rdi
shl    $0x8,%rdi
add    %r15,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <strtok@plt>
add    $0x1,%ebx
jmp    1150 <main_split_input+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define void @main_split_input(i8* %0, [256 x i8]* %1) {
%3 = alloca i8*
%4 = alloca [256 x i8]*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store [256 x i8]* %1, [256 x i8]** %4
%7 = load i8*, i8** %3
%8 = call i8* @strtok(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %8, i8** %5
store i32 0, i32* %6
br label %9
9: ; preds = %26, %2
%10 = load i8*, i8** %5
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %27
12: ; preds = %9
%13 = load i32, i32* %6
%14 = icmp slt i32 %13, 4
br i1 %14, label %15, label %26
15: ; preds = %12
%16 = load [256 x i8]*, [256 x i8]** %4
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %16, i64 %18
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%21 = load i8*, i8** %5
%22 = call i32 @strcpy(i8* %20, i8* %21)
%23 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %23, i8** %5
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %26
26: ; preds = %15, %12
br label %9
27: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define void @main_split_input(i8* %0, [256 x i8]* %1) {
%3 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i8* %3, null
br i1 %4, label %19, label %5
5: ; preds = %2, %15
%6 = phi i32 [ %17, %15 ], [ 0, %2 ]
%7 = phi i8* [ %16, %15 ], [ %3, %2 ]
%8 = icmp slt i32 %6, 4
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = sext i32 %6 to i64
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 %10, i64 0
%12 = tail call i32 @strcpy(i8* %11, i8* %7)
%13 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = add nsw i32 %6, 1
br label %15
15: ; preds = %9, %5
%16 = phi i8* [ %13, %9 ], [ %7, %5 ]
%17 = phi i32 [ %14, %9 ], [ %6, %5 ]
%18 = icmp eq i8* %16, null
br i1 %18, label %19, label %5
19: ; preds = %15, %2
ret void
}