#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 atoi(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strtok_r(char *, char *, char **);
char *ParseElement(char *p, char *s, int *sid) {
  char dum[100], *q;
  int j;
  strcpy(dum, strtok_r(p, " \t\n", &q));
  j = strlen(dum) - 1;
  while ((j >= 0) && (dum[j] != '-'))
    j--;
  if (j > 0) {
    *sid = atoi(&(dum[j + 1]));
    dum[j] = '\0';
    strcpy(s, dum);
  }
  return (q);
}


x86 assembly (clang, -O0):
<ParseElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe93(%rip),%rsi
lea    -0x88(%rbp),%rdx
call   1050 <strtok_r@plt>
mov    -0x98(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0x8c(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x8c(%rbp)
mov    %al,-0x99(%rbp)
jl     11c7 <ParseElement+0x87>
movslq -0x8c(%rbp),%rax
movsbl -0x80(%rbp,%rax,1),%eax
cmp    $0x2d,%eax
setne  %al
mov    %al,-0x99(%rbp)
mov    -0x99(%rbp),%al
test   $0x1,%al
jne    11da <ParseElement+0x9a>
jmp    11ee <ParseElement+0xae>
mov    -0x8c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8c(%rbp)
jmp    119a <ParseElement+0x5a>
cmpl   $0x0,-0x8c(%rbp)
jle    1233 <ParseElement+0xf3>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
cltq
lea    -0x80(%rbp),%rdi
add    %rax,%rdi
call   1060 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movslq -0x8c(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x88(%rbp),%rax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseElement>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
lea    0xea7(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1050 <strtok_r@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
nopl   (%rax)
test   %eax,%eax
jle    11c0 <ParseElement+0x80>
lea    -0x1(%rax),%rbx
cmpb   $0x2d,0xf(%rsp,%rax,1)
mov    %rbx,%rax
jne    1180 <ParseElement+0x40>
lea    0x1(%rbx),%eax
test   $0xfffffffe,%eax
je     11c0 <ParseElement+0x80>
lea    (%rsp,%rbx,1),%rdi
add    $0x11,%rdi
call   1060 <atoi@plt>
mov    %eax,(%r15)
mov    %ebx,%eax
movb   $0x0,0x10(%rsp,%rax,1)
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    0x8(%rsp),%rax
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c" \09\0A\00"
define i8* @ParseElement(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca [100 x i8]
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%11 = load i8*, i8** %4
%12 = call i8* @strtok_r(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %8)
%13 = call i32 @strcpy(i8* %10, i8* %12)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = sub nsw i32 %15, 1
store i32 %16, i32* %9
br label %17
17: ; preds = %29, %3
%18 = load i32, i32* %9
%19 = icmp sge i32 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %22
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp ne i32 %25, 45
br label %27
27: ; preds = %20, %17
%28 = phi i1 [ false, %17 ], [ %26, %20 ]
br i1 %28, label %29, label %32
29: ; preds = %27
%30 = load i32, i32* %9
%31 = add nsw i32 %30, -1
store i32 %31, i32* %9
br label %17
32: ; preds = %27
%33 = load i32, i32* %9
%34 = icmp sgt i32 %33, 0
br i1 %34, label %35, label %48
35: ; preds = %32
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %38
%40 = call i32 @atoi(i8* %39)
%41 = load i32*, i32** %6
store i32 %40, i32* %41
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 %43
store i8 0, i8* %44
%45 = load i8*, i8** %5
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%47 = call i32 @strcpy(i8* %45, i8* %46)
br label %48
48: ; preds = %35, %32
%49 = load i8*, i8** %8
ret i8* %49
}

LLVM IR (-O2):
@.str = [4 x i8] c" \09\0A\00"
define i8* @ParseElement(i8* %0, i8* %1, i32* nocapture writeonly %2) {
%4 = alloca [100 x i8]
%5 = alloca i8*
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = bitcast i8** %5 to i8*
%8 = call i8* @strtok_r(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %5)
%9 = call i32 @strcpy(i8* %6, i8* %8)
%10 = call i32 @strlen(i8* %6)
%11 = zext i32 %10 to i64
br label %12
12: ; preds = %17, %3
%13 = phi i64 [ %14, %17 ], [ %11, %3 ]
%14 = add nsw i64 %13, -1
%15 = trunc i64 %13 to i32
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %31
17: ; preds = %12
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %14
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 45
br i1 %20, label %21, label %12
21: ; preds = %17
%22 = and i64 %13, 4294967294
%23 = icmp eq i64 %22, 0
br i1 %23, label %31, label %24
24: ; preds = %21
%25 = and i64 %13, 4294967295
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %2
%28 = and i64 %14, 4294967295
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %28
store i8 0, i8* %29
%30 = call i32 @strcpy(i8* %1, i8* %6)
br label %31
31: ; preds = %12, %24, %21
%32 = load i8*, i8** %5
ret i8* %32
}