#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 parse(char *, char **);
int /*<<< orphan*/ strcpy(char *, char *);
char *get_token(char *from, char *to, int token, int *tokret) {
  int argc;
  char *argv[50 * 2];
  to[0] = ('\0');
  argc = parse(from, argv);
  if (token < argc)
    strcpy(to, argv[token]);
  *tokret = argc;
  return to;
}


x86 assembly (clang, -O0):
<get_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
lea    -0x350(%rbp),%rsi
call   1040 <parse@plt>
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1175 <get_token+0x55>
mov    -0x10(%rbp),%rdi
movslq -0x14(%rbp),%rax
mov    -0x350(%rbp,%rax,8),%rsi
ff
call   1030 <strcpy@plt>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_token>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x328,%rsp
mov    %rcx,%r14
mov    %edx,%r15d
mov    %rsi,%rbx
movb   $0x0,(%rsi)
mov    %rsp,%rsi
call   1040 <parse@plt>
mov    %eax,%ebp
cmp    %r15d,%eax
jle    1157 <get_token+0x37>
movslq %r15d,%rax
mov    (%rsp,%rax,8),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %ebp,(%r14)
mov    %rbx,%rax
add    $0x328,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @get_token(i8* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32
%10 = alloca [100 x i8*]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%11 = load i8*, i8** %6
%12 = getelementptr inbounds i8, i8* %11, i64 0
store i8 0, i8* %12
%13 = load i8*, i8** %5
%14 = getelementptr inbounds [100 x i8*], [100 x i8*]* %10, i64 0, i64 0
%15 = call i32 @parse(i8* %13, i8** %14)
store i32 %15, i32* %9
%16 = load i32, i32* %7
%17 = load i32, i32* %9
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %26
19: ; preds = %4
%20 = load i8*, i8** %6
%21 = load i32, i32* %7
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i8*], [100 x i8*]* %10, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = call i32 @strcpy(i8* %20, i8* %24)
br label %26
26: ; preds = %19, %4
%27 = load i32, i32* %9
%28 = load i32*, i32** %8
store i32 %27, i32* %28
%29 = load i8*, i8** %6
ret i8* %29
}

LLVM IR (-O2):
define i8* @get_token(i8* %0, i8* returned %1, i32 %2, i32* nocapture writeonly %3) {
%5 = alloca [100 x i8*]
%6 = bitcast [100 x i8*]* %5 to i8*
store i8 0, i8* %1
%7 = getelementptr inbounds [100 x i8*], [100 x i8*]* %5, i64 0, i64 0
%8 = call i32 @parse(i8* %0, i8** %7)
%9 = icmp sgt i32 %8, %2
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = sext i32 %2 to i64
%12 = getelementptr inbounds [100 x i8*], [100 x i8*]* %5, i64 0, i64 %11
%13 = load i8*, i8** %12
%14 = call i32 @strcpy(i8* %1, i8* %13)
br label %15
15: ; preds = %10, %4
store i32 %8, i32* %3
ret i8* %1
}