#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 */
scalar_t__ strnuppercmp(char const *, char *, size_t);
const unsigned char *skipPrefix(const unsigned char *name, int *scope) {
  const unsigned char *result = name;
  if (scope != NULL)
    *scope = '\0';
  if (name[1] == ':') {
    if (scope != NULL)
      *scope = *name;
    result = name + 2;
  } else if (strnuppercmp((const char *)name, "<SID>", (size_t)5) == 0) {
    if (scope != NULL)
      *scope = *name;
    result = name + 5;
  }
  return result;
}


x86 assembly (clang, -O0):
<skipPrefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     113d <skipPrefix+0x2d>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0x3a,%eax
jne    1177 <skipPrefix+0x67>
cmpq   $0x0,-0x10(%rbp)
je     1166 <skipPrefix+0x56>
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
jmp    11bf <skipPrefix+0xaf>
mov    -0x8(%rbp),%rdi
lea    0xe7e(%rip),%rsi
mov    $0x5,%edx
call   1030 <strnuppercmp@plt>
cmp    $0x0,%rax
jne    11ba <skipPrefix+0xaa>
cmpq   $0x0,-0x10(%rbp)
je     11ae <skipPrefix+0x9e>
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x18(%rbp)
jmp    11bf <skipPrefix+0xaf>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipPrefix>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
test   %rsi,%rsi
je     1133 <skipPrefix+0x23>
mov    %rsi,%r14
movl   $0x0,(%rsi)
cmpb   $0x3a,0x1(%rbx)
jne    113f <skipPrefix+0x2f>
movzbl (%rbx),%eax
mov    %eax,(%r14)
jmp    1139 <skipPrefix+0x29>
cmpb   $0x3a,0x1(%rbx)
jne    1160 <skipPrefix+0x50>
add    $0x2,%rbx
jmp    117d <skipPrefix+0x6d>
lea    0xeba(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <strnuppercmp@plt>
test   %rax,%rax
jne    117d <skipPrefix+0x6d>
movzbl (%rbx),%eax
mov    %eax,(%r14)
jmp    1179 <skipPrefix+0x69>
lea    0xe99(%rip),%rsi
mov    $0x5,%edx
mov    %rbx,%rdi
call   1030 <strnuppercmp@plt>
test   %rax,%rax
jne    117d <skipPrefix+0x6d>
add    $0x5,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"<SID>\00"
define i8* @skipPrefix(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i8*
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32*, i32** %4
store i32 0, i32* %10
br label %11
11: ; preds = %9, %2
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = icmp eq i32 %15, 58
br i1 %16, label %17, label %28
17: ; preds = %11
%18 = load i32*, i32** %4
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %25
20: ; preds = %17
%21 = load i8*, i8** %3
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = load i32*, i32** %4
store i32 %23, i32* %24
br label %25
25: ; preds = %20, %17
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 2
store i8* %27, i8** %5
br label %44
28: ; preds = %11
%29 = load i8*, i8** %3
%30 = call i64 @strnuppercmp(i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 5)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %43
32: ; preds = %28
%33 = load i32*, i32** %4
%34 = icmp ne i32* %33, null
br i1 %34, label %35, label %40
35: ; preds = %32
%36 = load i8*, i8** %3
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = load i32*, i32** %4
store i32 %38, i32* %39
br label %40
40: ; preds = %35, %32
%41 = load i8*, i8** %3
%42 = getelementptr inbounds i8, i8* %41, i64 5
store i8* %42, i8** %5
br label %43
43: ; preds = %40, %28
br label %44
44: ; preds = %43, %25
%45 = load i8*, i8** %5
ret i8* %45
}

LLVM IR (-O2):
@.str = [6 x i8] c"<SID>\00"
define i8* @skipPrefix(i8* %0, i32* writeonly %1) {
%3 = icmp eq i32* %1, null
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 58
br i1 %7, label %15, label %17
8: ; preds = %2
store i32 0, i32* %1
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 58
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load i8, i8* %0
%14 = zext i8 %13 to i32
store i32 %14, i32* %1
br label %15
15: ; preds = %4, %12
%16 = getelementptr inbounds i8, i8* %0, i64 2
br label %28
17: ; preds = %4
%18 = tail call i64 @strnuppercmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 5)
%19 = icmp eq i64 %18, 0
br i1 %19, label %26, label %28
20: ; preds = %8
%21 = tail call i64 @strnuppercmp(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 5)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8, i8* %0
%25 = zext i8 %24 to i32
store i32 %25, i32* %1
br label %26
26: ; preds = %17, %23
%27 = getelementptr inbounds i8, i8* %0, i64 5
br label %28
28: ; preds = %20, %17, %26, %15
%29 = phi i8* [ %16, %15 ], [ %27, %26 ], [ %0, %17 ], [ %0, %20 ]
ret i8* %29
}