#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 /*<<< orphan*/ errAbort(char *, char *);
int /*<<< orphan*/ startsWith(char *, char *);
int strlen(char *);
char *txAccFromTempName(char *tempName) {
  char *s = tempName + strlen(tempName);
  int periodCount = 0;
  while (s > tempName && periodCount < 2) {
    char c = *(--s);
    if (c == '.')
      ++periodCount;
  }
  if (periodCount < 2)
    errAbort(
        "Can't extract accession.ver from %s, expecting at least two periods",
        tempName);
  s += 1;
  int len = strlen(s);
  if ((len < 8 && !startsWith("CCDS", s)) || len > 75) {
    errAbort("Accession seems a little too long or short in %s", tempName);
  }
  return s;
}


x86 assembly (clang, -O0):
<txAccFromTempName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmp    -0x8(%rbp),%rcx
mov    %al,-0x29(%rbp)
jbe    1181 <txAccFromTempName+0x51>
cmpl   $0x2,-0x14(%rbp)
setl   %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    1191 <txAccFromTempName+0x61>
jmp    11c1 <txAccFromTempName+0x91>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
mov    -0x1(%rax),%al
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x2e,%eax
jne    11bc <txAccFromTempName+0x8c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1164 <txAccFromTempName+0x34>
cmpl   $0x2,-0x14(%rbp)
jge    11db <txAccFromTempName+0xab>
mov    -0x8(%rbp),%rsi
lea    0xe2a(%rip),%rdi
call   1050 <errAbort@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x8,-0x1c(%rbp)
jge    1216 <txAccFromTempName+0xe6>
mov    -0x10(%rbp),%rsi
lea    0xe3c(%rip),%rdi
call   1030 <startsWith@plt>
cmp    $0x0,%eax
je     1220 <txAccFromTempName+0xf0>
cmpl   $0x4b,-0x1c(%rbp)
jle    1230 <txAccFromTempName+0x100>
mov    -0x8(%rbp),%rsi
lea    0xe1e(%rip),%rdi
call   1050 <errAbort@plt>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<txAccFromTempName>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
movslq %eax,%rbx
test   %ebx,%ebx
jle    1178 <txAccFromTempName+0x48>
add    %r14,%rbx
add    $0xffffffffffffffff,%rbx
xor    %eax,%eax
nopl   0x0(%rax)
mov    %eax,%ecx
mov    %rbx,%rdx
xor    %eax,%eax
cmpb   $0x2e,(%rbx)
sete   %al
add    %ecx,%eax
add    $0xffffffffffffffff,%rbx
cmp    %r14,%rdx
jbe    116d <txAccFromTempName+0x3d>
cmp    $0x2,%eax
jb     1150 <txAccFromTempName+0x20>
add    $0x1,%rbx
cmp    $0x1,%eax
jbe    117b <txAccFromTempName+0x4b>
jmp    118a <txAccFromTempName+0x5a>
add    %r14,%rbx
lea    0xe7e(%rip),%rdi
mov    %r14,%rsi
call   1050 <errAbort@plt>
add    $0x1,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x7,%eax
jg     11b0 <txAccFromTempName+0x80>
lea    0xea2(%rip),%rdi
mov    %rbx,%rsi
call   1030 <startsWith@plt>
test   %eax,%eax
jne    11c4 <txAccFromTempName+0x94>
jmp    11b5 <txAccFromTempName+0x85>
cmp    $0x4c,%eax
jb     11c4 <txAccFromTempName+0x94>
lea    0xe8d(%rip),%rdi
mov    %r14,%rsi
call   1050 <errAbort@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [68 x i8] c"Can't extract accession.ver from %s, expecting at least two periods\00"
@.str.1 = [5 x i8] c"CCDS\00"
@.str.2 = [49 x i8] c"Accession seems a little too long or short in %s\00"
define i8* @txAccFromTempName(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
%6 = alloca i32
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @strlen(i8* %8)
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %7, i64 %10
store i8* %11, i8** %3
store i32 0, i32* %4
br label %12
12: ; preds = %31, %1
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = icmp ugt i8* %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 2
br label %19
19: ; preds = %16, %12
%20 = phi i1 [ false, %12 ], [ %18, %16 ]
br i1 %20, label %21, label %32
21: ; preds = %19
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 -1
store i8* %23, i8** %3
%24 = load i8, i8* %23
store i8 %24, i8* %5
%25 = load i8, i8* %5
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 46
br i1 %27, label %28, label %31
28: ; preds = %21
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %31
31: ; preds = %28, %21
br label %12
32: ; preds = %19
%33 = load i32, i32* %4
%34 = icmp slt i32 %33, 2
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i8*, i8** %2
%37 = call i32 @errAbort(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %36)
br label %38
38: ; preds = %35, %32
%39 = load i8*, i8** %3
%40 = getelementptr inbounds i8, i8* %39, i64 1
store i8* %40, i8** %3
%41 = load i8*, i8** %3
%42 = call i32 @strlen(i8* %41)
store i32 %42, i32* %6
%43 = load i32, i32* %6
%44 = icmp slt i32 %43, 8
br i1 %44, label %45, label %49
45: ; preds = %38
%46 = load i8*, i8** %3
%47 = call i32 @startsWith(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %46)
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %45, %38
%50 = load i32, i32* %6
%51 = icmp sgt i32 %50, 75
br i1 %51, label %52, label %55
52: ; preds = %49, %45
%53 = load i8*, i8** %2
%54 = call i32 @errAbort(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i8* %53)
br label %55
55: ; preds = %52, %49
%56 = load i8*, i8** %3
ret i8* %56
}

LLVM IR (-O2):
@.str = [68 x i8] c"Can't extract accession.ver from %s, expecting at least two periods\00"
@.str.1 = [5 x i8] c"CCDS\00"
@.str.2 = [49 x i8] c"Accession seems a little too long or short in %s\00"
define i8* @txAccFromTempName(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sext i32 %2 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %18
6: ; preds = %1, %6
%7 = phi i8* [ %9, %6 ], [ %4, %1 ]
%8 = phi i32 [ %13, %6 ], [ 0, %1 ]
%9 = getelementptr inbounds i8, i8* %7, i64 -1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 46
%12 = zext i1 %11 to i32
%13 = add nuw nsw i32 %8, %12
%14 = icmp ugt i8* %9, %0
%15 = icmp ult i32 %13, 2
%16 = select i1 %14, i1 %15, i1 false
br i1 %16, label %6, label %17
17: ; preds = %6
br i1 %15, label %18, label %21
18: ; preds = %1, %17
%19 = phi i8* [ %9, %17 ], [ %4, %1 ]
%20 = tail call i32 @errAbort(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %21
21: ; preds = %18, %17
%22 = phi i8* [ %19, %18 ], [ %9, %17 ]
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = tail call i32 @strlen(i8* %23)
%25 = icmp slt i32 %24, 8
br i1 %25, label %26, label %29
26: ; preds = %21
%27 = tail call i32 @startsWith(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%28 = icmp eq i32 %27, 0
br i1 %28, label %31, label %33
29: ; preds = %21
%30 = icmp ugt i32 %24, 75
br i1 %30, label %31, label %33
31: ; preds = %29, %26
%32 = tail call i32 @errAbort(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %33
33: ; preds = %26, %31, %29
ret i8* %23
}