#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 const *, char);
scalar_t__ strncmp(char const *, char *, int);
const char *Msg_StripMSGID(const char *idString) {
  if (idString != NULL && (strncmp(idString,
                                   "@&!*@*@"
                                   "X",
                                   7) == 0)) {
    idString += 7;
    idString++;
    idString = strchr(idString, ')');
    idString++;
  }
  return idString;
}


x86 assembly (clang, -O0):
<Msg_StripMSGID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118c <Msg_StripMSGID+0x6c>
mov    -0x8(%rbp),%rdi
lea    0xebe(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    118c <Msg_StripMSGID+0x6c>
mov    -0x8(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x29,%esi
call   1040 <strchr@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Msg_StripMSGID>:
push   %rbx
test   %rdi,%rdi
je     1159 <Msg_StripMSGID+0x39>
mov    %rdi,%rbx
lea    0xed0(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    115b <Msg_StripMSGID+0x3b>
add    $0x8,%rbx
mov    %rbx,%rdi
mov    $0x29,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
add    $0x1,%rbx
jmp    115b <Msg_StripMSGID+0x3b>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"@&!*@*@X\00"
define i8* @Msg_StripMSGID(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %18
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = call i64 @strncmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 7)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 7
store i8* %11, i8** %2
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %2
%14 = load i8*, i8** %2
%15 = call i8* @strchr(i8* %14, i8 signext 41)
store i8* %15, i8** %2
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %18
18: ; preds = %9, %5, %1
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
@.str = [9 x i8] c"@&!*@*@X\00"
define i8* @Msg_StripMSGID(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 7)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %0, i64 8
%8 = tail call i8* @strchr(i8* %7, i8 signext 41)
%9 = getelementptr inbounds i8, i8* %8, i64 1
br label %10
10: ; preds = %6, %3, %1
%11 = phi i8* [ %9, %6 ], [ %0, %3 ], [ null, %1 ]
ret i8* %11
}