#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *strclone(char *);
char *strstr(char *, char *);
scalar_t__ update_pepxml_buffer(char *, char *, int /*<<< orphan*/ *, int);
char *get_xml_tag_value(char *buffer, char **bufpos, FILE *file_handle,
                        int buffersize, long *offset) {
  char *tmpptr, *retval;
  unsigned char unupdated = 1;
loop:
  tmpptr = strstr(*bufpos, "<");
  if (tmpptr) {
    tmpptr[0] = '\0';
    retval = strclone(*bufpos);
    tmpptr[0] = "<"[0];
    *bufpos = tmpptr;
    return retval;
  } else if (file_handle && unupdated) {
    *offset += update_pepxml_buffer(buffer, *bufpos, file_handle, buffersize);
    *bufpos = buffer;
    unupdated = 0;
    goto loop;
  } else
    return NULL;
}


x86 assembly (clang, -O0):
<get_xml_tag_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
movb   $0x1,-0x41(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xea3(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     11ac <get_xml_tag_value+0x7c>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1040 <strclone@plt>
mov    %rax,-0x40(%rbp)
mov    0xe72(%rip),%cl
mov    -0x38(%rbp),%rax
mov    %cl,(%rax)
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1204 <get_xml_tag_value+0xd4>
cmpq   $0x0,-0x20(%rbp)
je     11fc <get_xml_tag_value+0xcc>
movzbl -0x41(%rbp),%eax
cmp    $0x0,%eax
je     11fc <get_xml_tag_value+0xcc>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <update_pepxml_buffer@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movb   $0x0,-0x41(%rbp)
jmp    114f <get_xml_tag_value+0x1f>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_xml_tag_value>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,(%rsp)
mov    %ecx,%r12d
mov    %rdx,%r13
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%r15
mov    %r15,%rdi
mov    $0x3c,%esi
call   1030 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1178 <get_xml_tag_value+0x48>
movb   $0x0,0x0(%rbp)
mov    (%rbx),%rdi
call   1050 <strclone@plt>
movb   $0x3c,0x0(%rbp)
mov    %rbp,(%rbx)
jmp    11af <get_xml_tag_value+0x7f>
test   %r13,%r13
je     11ad <get_xml_tag_value+0x7d>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
mov    %r12d,%ecx
call   1040 <update_pepxml_buffer@plt>
mov    (%rsp),%rcx
add    %rax,(%rcx)
mov    %r14,(%rbx)
mov    %r14,%rdi
mov    $0x3c,%esi
call   1030 <strchr@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1163 <get_xml_tag_value+0x33>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @get_xml_tag_value(i8* %0, i8** nocapture %1, i32* %2, i32 %3, i64* nocapture %4) {
%6 = load i8*, i8** %1
%7 = tail call i8* @strchr(i8* dereferenceable(1) %6, i32 60)
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %17
9: ; preds = %5
%10 = icmp eq i32* %2, null
br i1 %10, label %21, label %11
11: ; preds = %9
%12 = tail call i64 @update_pepxml_buffer(i8* %0, i8* %6, i32* %2, i32 %3)
%13 = load i64, i64* %4
%14 = add nsw i64 %13, %12
store i64 %14, i64* %4
store i8* %0, i8** %1
%15 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 60)
%16 = icmp eq i8* %15, null
br i1 %16, label %21, label %17
17: ; preds = %11, %5
%18 = phi i8* [ %7, %5 ], [ %15, %11 ]
store i8 0, i8* %18
%19 = load i8*, i8** %1
%20 = tail call i8* @strclone(i8* %19)
store i8 60, i8* %18
store i8* %18, i8** %1
br label %21
21: ; preds = %11, %9, %17
%22 = phi i8* [ %20, %17 ], [ null, %9 ], [ null, %11 ]
ret i8* %22
}