#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*/ sprintf(char *, char *, char, char *);
char *to_text(char *);
char *ExtractPtr(char *st, char fam_ind_type) {
  char buf[1024];
  char *beg;
  while (*st != '@')
    st++;
  st++;
  sprintf(buf, "%c%s", fam_ind_type, st);
  beg = buf;
  while (*beg != '@')
    beg++;
  (*beg) = '\0';
  return to_text(buf);
}


x86 assembly (clang, -O0):
<ExtractPtr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
je     1156 <ExtractPtr+0x36>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1135 <ExtractPtr+0x15>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x9(%rbp),%al
mov    -0x8(%rbp),%rcx
lea    0xe89(%rip),%rsi
movsbl %al,%edx
call   1030 <sprintf@plt>
lea    -0x410(%rbp),%rax
mov    %rax,-0x418(%rbp)
mov    -0x418(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
je     11b7 <ExtractPtr+0x97>
mov    -0x418(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x418(%rbp)
jmp    118d <ExtractPtr+0x6d>
mov    -0x418(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x410(%rbp),%rdi
call   1040 <to_text@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ExtractPtr>:
push   %rbx
sub    $0x400,%rsp
mov    %rdi,%rcx
nopl   0x0(%rax,%rax,1)
cmpb   $0x40,(%rcx)
lea    0x1(%rcx),%rcx
jne    1130 <ExtractPtr+0x10>
mov    %rsp,%rbx
movsbl %sil,%edx
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
nop
cmpb   $0x40,(%rbx)
lea    0x1(%rbx),%rbx
jne    1150 <ExtractPtr+0x30>
movb   $0x0,-0x1(%rbx)
mov    %rsp,%rdi
call   1040 <to_text@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%c%s\00"
define i8* @ExtractPtr(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca [1024 x i8]
%6 = alloca i8*
store i8* %0, i8** %3
store i8 %1, i8* %4
br label %7
7: ; preds = %12, %2
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 64
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %3
br label %7
15: ; preds = %7
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %3
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%19 = load i8, i8* %4
%20 = load i8*, i8** %3
%21 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %19, i8* %20)
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
store i8* %22, i8** %6
br label %23
23: ; preds = %28, %15
%24 = load i8*, i8** %6
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 64
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i8*, i8** %6
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %6
br label %23
31: ; preds = %23
%32 = load i8*, i8** %6
store i8 0, i8* %32
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%34 = call i8* @to_text(i8* %33)
ret i8* %34
}

LLVM IR (-O2):
@.str = [5 x i8] c"%c%s\00"
define i8* @ExtractPtr(i8* %0, i8 signext %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
br label %5
5: ; preds = %5, %2
%6 = phi i8* [ %0, %2 ], [ %9, %5 ]
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 64
%9 = getelementptr inbounds i8, i8* %6, i64 1
br i1 %8, label %10, label %5
10: ; preds = %5
%11 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8 signext %1, i8* %9)
br label %12
12: ; preds = %12, %10
%13 = phi i8* [ %4, %10 ], [ %16, %12 ]
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 64
%16 = getelementptr inbounds i8, i8* %13, i64 1
br i1 %15, label %17, label %12
17: ; preds = %12
store i8 0, i8* %13
%18 = call i8* @to_text(i8* %4)
ret i8* %18
}