#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 *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char const *);
void ScopID(char cl[], char fold[], char sfam[], const char fam[]) {
  char *ptr;
  strcpy(cl, fam);
  ptr = strchr(cl, '.');
  if (ptr)
    ptr[0] = '\0';
  strcpy(fold, fam);
  ptr = strchr(fold, '.');
  if (ptr)
    ptr = strchr(ptr + 1, '.');
  if (ptr)
    ptr[0] = '\0';
  strcpy(sfam, fam);
  ptr = strchr(sfam, '.');
  if (ptr)
    ptr = strchr(ptr + 1, '.');
  if (ptr)
    ptr = strchr(ptr + 1, '.');
  if (ptr)
    ptr[0] = '\0';
  return;
}


x86 assembly (clang, -O0):
<ScopID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1169 <ScopID+0x49>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11a9 <ScopID+0x89>
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11bb <ScopID+0x9b>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11fb <ScopID+0xdb>
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     121c <ScopID+0xfc>
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     122e <ScopID+0x10e>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScopID>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rcx,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1151 <ScopID+0x31>
movb   $0x0,(%rax)
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r12,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1187 <ScopID+0x67>
add    $0x1,%rax
mov    %rax,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1187 <ScopID+0x67>
movb   $0x0,(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %r14,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11d3 <ScopID+0xb3>
add    $0x1,%rax
mov    %rax,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11d3 <ScopID+0xb3>
add    $0x1,%rax
mov    %rax,%rdi
mov    $0x2e,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11d3 <ScopID+0xb3>
movb   $0x0,(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @ScopID(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = load i8*, i8** %8
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %5
%14 = call i8* @strchr(i8* %13, i8 signext 46)
store i8* %14, i8** %9
%15 = load i8*, i8** %9
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %4
%18 = load i8*, i8** %9
%19 = getelementptr inbounds i8, i8* %18, i64 0
store i8 0, i8* %19
br label %20
20: ; preds = %17, %4
%21 = load i8*, i8** %6
%22 = load i8*, i8** %8
%23 = call i32 @strcpy(i8* %21, i8* %22)
%24 = load i8*, i8** %6
%25 = call i8* @strchr(i8* %24, i8 signext 46)
store i8* %25, i8** %9
%26 = load i8*, i8** %9
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %32
28: ; preds = %20
%29 = load i8*, i8** %9
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = call i8* @strchr(i8* %30, i8 signext 46)
store i8* %31, i8** %9
br label %32
32: ; preds = %28, %20
%33 = load i8*, i8** %9
%34 = icmp ne i8* %33, null
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i8*, i8** %9
%37 = getelementptr inbounds i8, i8* %36, i64 0
store i8 0, i8* %37
br label %38
38: ; preds = %35, %32
%39 = load i8*, i8** %7
%40 = load i8*, i8** %8
%41 = call i32 @strcpy(i8* %39, i8* %40)
%42 = load i8*, i8** %7
%43 = call i8* @strchr(i8* %42, i8 signext 46)
store i8* %43, i8** %9
%44 = load i8*, i8** %9
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %50
46: ; preds = %38
%47 = load i8*, i8** %9
%48 = getelementptr inbounds i8, i8* %47, i64 1
%49 = call i8* @strchr(i8* %48, i8 signext 46)
store i8* %49, i8** %9
br label %50
50: ; preds = %46, %38
%51 = load i8*, i8** %9
%52 = icmp ne i8* %51, null
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = load i8*, i8** %9
%55 = getelementptr inbounds i8, i8* %54, i64 1
%56 = call i8* @strchr(i8* %55, i8 signext 46)
store i8* %56, i8** %9
br label %57
57: ; preds = %53, %50
%58 = load i8*, i8** %9
%59 = icmp ne i8* %58, null
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i8*, i8** %9
%62 = getelementptr inbounds i8, i8* %61, i64 0
store i8 0, i8* %62
br label %63
63: ; preds = %60, %57
ret void
}

LLVM IR (-O2):
define void @ScopID(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = tail call i32 @strcpy(i8* %0, i8* %3)
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 46)
%7 = icmp eq i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %4
store i8 0, i8* %6
br label %9
9: ; preds = %8, %4
%10 = tail call i32 @strcpy(i8* %1, i8* %3)
%11 = tail call i8* @strchr(i8* dereferenceable(1) %1, i8 signext 46)
%12 = icmp eq i8* %11, null
br i1 %12, label %18, label %13
13: ; preds = %9
%14 = getelementptr inbounds i8, i8* %11, i64 1
%15 = tail call i8* @strchr(i8* %14, i8 signext 46)
%16 = icmp eq i8* %15, null
br i1 %16, label %18, label %17
17: ; preds = %13
store i8 0, i8* %15
br label %18
18: ; preds = %9, %17, %13
%19 = tail call i32 @strcpy(i8* %2, i8* %3)
%20 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 46)
%21 = icmp eq i8* %20, null
br i1 %21, label %31, label %22
22: ; preds = %18
%23 = getelementptr inbounds i8, i8* %20, i64 1
%24 = tail call i8* @strchr(i8* %23, i8 signext 46)
%25 = icmp eq i8* %24, null
br i1 %25, label %31, label %26
26: ; preds = %22
%27 = getelementptr inbounds i8, i8* %24, i64 1
%28 = tail call i8* @strchr(i8* %27, i8 signext 46)
%29 = icmp eq i8* %28, null
br i1 %29, label %31, label %30
30: ; preds = %26
store i8 0, i8* %28
br label %31
31: ; preds = %18, %22, %30, %26
ret void
}