#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 *strdup(char *);
char *extract_vertex(char *subcmd, int *done_nothing) {
  *done_nothing = 0;
  int i;
  char vertex[512];
  subcmd += 2;
  if (subcmd[0] != '\0') {
    subcmd++;
    i = 0;
    if (*subcmd == '\0' || *subcmd == '-') {
      return NULL;
    } else {
      while (subcmd[i] != '\0' && subcmd[i] != '-') {
        vertex[i] = subcmd[i];
        i++;
      }
      if (vertex[i - 1] == ' ')
        vertex[i - 1] = '\0';
      vertex[i] = '\0';
    }
  } else {
    return NULL;
  }
  return strdup(vertex);
}


x86 assembly (clang, -O0):
<extract_vertex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1234 <extract_vertex+0x124>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117c <extract_vertex+0x6c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1189 <extract_vertex+0x79>
movq   $0x0,-0x8(%rbp)
jmp    1251 <extract_vertex+0x141>
jmp    118e <extract_vertex+0x7e>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x221(%rbp)
je     11c3 <extract_vertex+0xb3>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
setne  %al
mov    %al,-0x221(%rbp)
mov    -0x221(%rbp),%al
test   $0x1,%al
jne    11d6 <extract_vertex+0xc6>
jmp    11fa <extract_vertex+0xea>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x1c(%rbp),%rax
mov    %cl,-0x220(%rbp,%rax,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118e <extract_vertex+0x7e>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x220(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    1223 <extract_vertex+0x113>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
cltq
movb   $0x0,-0x220(%rbp,%rax,1)
movslq -0x1c(%rbp),%rax
movb   $0x0,-0x220(%rbp,%rax,1)
jmp    1241 <extract_vertex+0x131>
movq   $0x0,-0x8(%rbp)
jmp    1251 <extract_vertex+0x141>
lea    -0x220(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_vertex>:
sub    $0x208,%rsp
movl   $0x0,(%rsi)
cmpb   $0x0,0x2(%rdi)
je     1139 <extract_vertex+0x29>
mov    0x3(%rdi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1131 <extract_vertex+0x21>
cmp    $0x2d,%cl
jne    1143 <extract_vertex+0x33>
add    $0x208,%rsp
ret
xor    %eax,%eax
add    $0x208,%rsp
ret
movabs $0xffffffff00000000,%rax
ff ff ff
xor    %edx,%edx
movabs $0x100000000,%rsi
test   %cl,%cl
je     1178 <extract_vertex+0x68>
nopl   (%rax)
cmp    $0x2d,%cl
je     1178 <extract_vertex+0x68>
mov    %cl,(%rsp,%rdx,1)
movzbl 0x4(%rdi,%rdx,1),%ecx
add    $0x1,%rdx
add    %rsi,%rax
test   %cl,%cl
jne    1160 <extract_vertex+0x50>
mov    %edx,%ecx
sar    $0x20,%rax
movzbl (%rsp,%rax,1),%edx
xor    %esi,%esi
cmp    $0x20,%dl
cmovne %edx,%esi
mov    %sil,(%rsp,%rax,1)
movb   $0x0,(%rsp,%rcx,1)
mov    %rsp,%rdi
call   1030 <strdup@plt>
add    $0x208,%rsp
ret

LLVM IR (-O0):
define i8* @extract_vertex(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca [512 x i8]
store i8* %0, i8** %4
store i32* %1, i32** %5
%8 = load i32*, i32** %5
store i32 0, i32* %8
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 2
store i8* %10, i8** %4
%11 = load i8*, i8** %4
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %77
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %4
store i32 0, i32* %6
%19 = load i8*, i8** %4
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %28, label %23
23: ; preds = %16
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 45
br i1 %27, label %28, label %29
28: ; preds = %23, %16
store i8* null, i8** %3
br label %81
29: ; preds = %23
br label %30
30: ; preds = %48, %29
%31 = load i8*, i8** %4
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %46
38: ; preds = %30
%39 = load i8*, i8** %4
%40 = load i32, i32* %6
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8, i8* %39, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp ne i32 %44, 45
br label %46
46: ; preds = %38, %30
%47 = phi i1 [ false, %30 ], [ %45, %38 ]
br i1 %47, label %48, label %59
48: ; preds = %46
%49 = load i8*, i8** %4
%50 = load i32, i32* %6
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i8, i8* %52
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 %55
store i8 %53, i8* %56
%57 = load i32, i32* %6
%58 = add nsw i32 %57, 1
store i32 %58, i32* %6
br label %30
59: ; preds = %46
%60 = load i32, i32* %6
%61 = sub nsw i32 %60, 1
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 %62
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = icmp eq i32 %65, 32
br i1 %66, label %67, label %72
67: ; preds = %59
%68 = load i32, i32* %6
%69 = sub nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 %70
store i8 0, i8* %71
br label %72
72: ; preds = %67, %59
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 %74
store i8 0, i8* %75
br label %76
76: ; preds = %72
br label %78
77: ; preds = %2
store i8* null, i8** %3
br label %81
78: ; preds = %76
%79 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%80 = call i8* @strdup(i8* %79)
store i8* %80, i8** %3
br label %81
81: ; preds = %78, %77, %28
%82 = load i8*, i8** %3
ret i8* %82
}

LLVM IR (-O2):
define noalias i8* @extract_vertex(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = alloca [512 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %30, label %8
8: ; preds = %2
%9 = getelementptr inbounds i8, i8* %0, i64 3
%10 = load i8, i8* %9
switch i8 %10, label %11 [
i8 0, label %30
i8 45, label %30
]
11: ; preds = %8, %14
%12 = phi i8 [ %18, %14 ], [ %10, %8 ]
%13 = phi i64 [ %16, %14 ], [ 0, %8 ]
switch i8 %12, label %14 [
i8 0, label %19
i8 45, label %19
]
14: ; preds = %11
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %13
store i8 %12, i8* %15
%16 = add nuw i64 %13, 1
%17 = getelementptr inbounds i8, i8* %9, i64 %16
%18 = load i8, i8* %17
br label %11
19: ; preds = %11, %11
%20 = and i64 %13, 4294967295
%21 = shl i64 %13, 32
%22 = add i64 %21, -4294967296
%23 = ashr exact i64 %22, 32
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 32
%27 = select i1 %26, i8 0, i8 %25
store i8 %27, i8* %24
%28 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 %20
store i8 0, i8* %28
%29 = call i8* @strdup(i8* %4)
br label %30
30: ; preds = %2, %8, %8, %19
%31 = phi i8* [ %29, %19 ], [ null, %8 ], [ null, %8 ], [ null, %2 ]
ret i8* %31
}