#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*/ memcpy(char *, char *, size_t);
size_t strlen(char *);
char *strtok(char *, char *);
int com_parse_command(char *command, char *request) {
  char req[256];
  char *com;
  memcpy(req, request, 256);
  com = strtok(req, " ;\n");
  memcpy(command, com, strlen(com));
  command[strlen(com)] = 0;
  return 0;
}


x86 assembly (clang, -O0):
<com_parse_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x100,%edx
call   1040 <memcpy@plt>
lea    -0x110(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x118(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x130(%rbp)
mov    -0x118(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x118(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x130(%rbp),%rdi
mov    -0x128(%rbp),%rsi
mov    %rax,%rdx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x118(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x120(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<com_parse_command>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rdi,%r15
mov    %rsp,%r14
mov    $0x100,%edx
mov    %r14,%rdi
call   1040 <memcpy@plt>
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
call   1050 <strtok@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <strlen@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
movb   $0x0,(%r15,%rax,1)
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c" ;\0A\00"
define i32 @com_parse_command(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = call i32 @memcpy(i8* %7, i8* %8, i64 256)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%11 = call i8* @strtok(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %11, i8** %6
%12 = load i8*, i8** %3
%13 = load i8*, i8** %6
%14 = load i8*, i8** %6
%15 = call i64 @strlen(i8* %14)
%16 = call i32 @memcpy(i8* %12, i8* %13, i64 %15)
%17 = load i8*, i8** %3
%18 = load i8*, i8** %6
%19 = call i64 @strlen(i8* %18)
%20 = getelementptr inbounds i8, i8* %17, i64 %19
store i8 0, i8* %20
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c" ;\0A\00"
define i32 @com_parse_command(i8* %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @memcpy(i8* %4, i8* %1, i64 256)
%6 = call i8* @strtok(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%7 = call i64 @strlen(i8* dereferenceable(1) %6)
%8 = call i32 @memcpy(i8* %0, i8* %6, i64 %7)
%9 = call i64 @strlen(i8* dereferenceable(1) %6)
%10 = getelementptr inbounds i8, i8* %0, i64 %9
store i8 0, i8* %10
ret i32 0
}