#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 */
char *strtok(char *, char *);
void lireCommande(char *ligneCommande, char *nomCommande[]) {
  char *result = NULL;
  char delimiteur[] = " ";
  result = strtok(ligneCommande, delimiteur);
  int i = 0;
  while (result != NULL) {
    nomCommande[i] = result;
    result = strtok(NULL, delimiteur);
    i++;
  }
  nomCommande[i] = (char *)NULL;
}


x86 assembly (clang, -O0):
<lireCommande>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0xed1(%rip),%ax
mov    %ax,-0x1a(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1185 <lireCommande+0x75>
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
lea    -0x1a(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114b <lireCommande+0x3b>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lireCommande>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
movw   $0x20,0xe(%rsp)
lea    0xe(%rsp),%rsi
call   1030 <strtok@plt>
test   %rax,%rax
je     115b <lireCommande+0x4b>
xor    %ebx,%ebx
lea    0xe(%rsp),%r14
nopl   0x0(%rax)
mov    %rax,(%r15,%rbx,8)
xor    %edi,%edi
mov    %r14,%rsi
call   1030 <strtok@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <lireCommande+0x30>
mov    %ebx,%eax
jmp    115d <lireCommande+0x4d>
xor    %eax,%eax
movq   $0x0,(%r15,%rax,8)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @lireCommande(i8* %0, i8** nocapture writeonly %1) {
%3 = alloca i16
%4 = bitcast i16* %3 to i8*
store i16 32, i16* %3
%5 = call i8* @strtok(i8* %0, i8* %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %16, label %7
7: ; preds = %2, %7
%8 = phi i64 [ %12, %7 ], [ 0, %2 ]
%9 = phi i8* [ %11, %7 ], [ %5, %2 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %8
store i8* %9, i8** %10
%11 = call i8* @strtok(i8* null, i8* %4)
%12 = add nuw i64 %8, 1
%13 = icmp eq i8* %11, null
br i1 %13, label %14, label %7
14: ; preds = %7
%15 = and i64 %12, 4294967295
br label %16
16: ; preds = %14, %2
%17 = phi i64 [ 0, %2 ], [ %15, %14 ]
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
store i8* null, i8** %18
ret void
}