#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 indexOfNameBegin(char *);
int /*<<< orphan*/ strcpy(char *, char *);
void extractName(char *fullName, char *nameOnly) {
  char name[100] = {0};
  int i, j;
  int begin = indexOfNameBegin(fullName);
  for (i = begin, j = 0; i < 100; i++, j++) {
    if (fullName[i] == '.') {
      break;
    }
    name[j] = fullName[i];
  }
  strcpy(nameOnly, name);
}


x86 assembly (clang, -O0):
<extractName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
call   1050 <indexOfNameBegin@plt>
mov    %eax,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
mov    %eax,-0x84(%rbp)
movl   $0x0,-0x88(%rbp)
cmpl   $0x64,-0x84(%rbp)
jge    11de <extractName+0xae>
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
jne    11a2 <extractName+0x72>
jmp    11de <extractName+0xae>
mov    -0x8(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x88(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1178 <extractName+0x48>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractName>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
call   1040 <indexOfNameBegin@plt>
cmp    $0x63,%eax
jg     1185 <extractName+0x65>
movslq %eax,%rdx
mov    $0x64,%ecx
sub    %eax,%ecx
add    %rdx,%rbx
xor    %eax,%eax
xchg   %ax,%ax
movzbl (%rbx,%rax,1),%edx
cmp    $0x2e,%dl
je     1185 <extractName+0x65>
mov    %dl,(%rsp,%rax,1)
add    $0x1,%rax
cmp    %rax,%rcx
jne    1170 <extractName+0x50>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @extractName(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [100 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = bitcast [100 x i8]* %5 to i8*
%10 = load i8*, i8** %3
%11 = call i32 @indexOfNameBegin(i8* %10)
store i32 %11, i32* %8
%12 = load i32, i32* %8
store i32 %12, i32* %6
store i32 0, i32* %7
br label %13
13: ; preds = %34, %2
%14 = load i32, i32* %6
%15 = icmp slt i32 %14, 100
br i1 %15, label %16, label %39
16: ; preds = %13
%17 = load i8*, i8** %3
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 46
br i1 %23, label %24, label %25
24: ; preds = %16
br label %39
25: ; preds = %16
%26 = load i8*, i8** %3
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %32
store i8 %30, i8* %33
br label %34
34: ; preds = %25
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
br label %13
39: ; preds = %24, %13
%40 = load i8*, i8** %4
%41 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%42 = call i32 @strcpy(i8* %40, i8* %41)
ret void
}

LLVM IR (-O2):
define void @extractName(i8* %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @indexOfNameBegin(i8* %0)
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %22
7: ; preds = %2
%8 = sext i32 %5 to i64
%9 = sub i32 100, %5
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %7, %17
%12 = phi i64 [ 0, %7 ], [ %20, %17 ]
%13 = phi i64 [ %8, %7 ], [ %19, %17 ]
%14 = getelementptr inbounds i8, i8* %0, i64 %13
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 46
br i1 %16, label %22, label %17
17: ; preds = %11
%18 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %12
store i8 %15, i8* %18
%19 = add nsw i64 %13, 1
%20 = add nuw nsw i64 %12, 1
%21 = icmp eq i64 %20, %10
br i1 %21, label %22, label %11
22: ; preds = %17, %11, %2
%23 = call i32 @strcpy(i8* %1, i8* %4)
ret void
}