#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
int strlen(char *);
char *getIncludeFileName(char *p) {
  char *filename = (char *)malloc(sizeof(char) * (strlen(p) + 1));
  if (filename == NULL) {
    fprintf(stderr, "error: cannot alloc memory for includeFileName\n");
    exit(EXIT_FAILURE);
  }
  while (*p != '<' && *p != '"')
    ++p;
  ++p;
  char *q = filename;
  while ((*q++ = *p++))
    ;
  --q;
  while (*q != '>' && *q != '"')
    --q;
  *q = '\0';
  return filename;
}


x86 assembly (clang, -O0):
<getIncludeFileName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1197 <getIncludeFileName+0x57>
mov    0x2e65(%rip),%rax
mov    (%rax),%edi
lea    0xe7c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
jmp    119c <getIncludeFileName+0x5c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x3c,%ecx
mov    %al,-0x19(%rbp)
je     11c1 <getIncludeFileName+0x81>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11d1 <getIncludeFileName+0x91>
jmp    11e2 <getIncludeFileName+0xa2>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    119c <getIncludeFileName+0x5c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1225 <getIncludeFileName+0xe5>
jmp    11f6 <getIncludeFileName+0xb6>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x3e,%ecx
mov    %al,-0x1a(%rbp)
je     1256 <getIncludeFileName+0x116>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    1266 <getIncludeFileName+0x126>
jmp    1277 <getIncludeFileName+0x137>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1231 <getIncludeFileName+0xf1>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getIncludeFileName>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
test   %rax,%rax
je     11b7 <getIncludeFileName+0x77>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
movzbl -0x1(%rbx),%ecx
cmp    $0x3c,%cl
je     1172 <getIncludeFileName+0x32>
cmp    $0x22,%cl
jne    1160 <getIncludeFileName+0x20>
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl (%rbx,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1180 <getIncludeFileName+0x40>
add    %rax,%rcx
add    $0xffffffffffffffff,%rcx
xor    %edx,%edx
cmp    $0x22,%dl
je     11b2 <getIncludeFileName+0x72>
nopl   (%rax)
cmp    $0x3e,%dl
je     11b2 <getIncludeFileName+0x72>
movzbl -0x1(%rcx),%edx
add    $0xffffffffffffffff,%rcx
cmp    $0x22,%dl
jne    11a0 <getIncludeFileName+0x60>
movb   $0x0,(%rcx)
pop    %rbx
ret
mov    0x2e22(%rip),%rax
mov    (%rax),%edi
lea    0xe39(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e05(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [48 x i8] c"error: cannot alloc memory for includeFileName\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @getIncludeFileName(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = mul i64 1, %8
%10 = trunc i64 %9 to i32
%11 = call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %20
15: ; preds = %1
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %1
br label %21
21: ; preds = %33, %20
%22 = load i8*, i8** %2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 60
br i1 %25, label %26, label %31
26: ; preds = %21
%27 = load i8*, i8** %2
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 34
br label %31
31: ; preds = %26, %21
%32 = phi i1 [ false, %21 ], [ %30, %26 ]
br i1 %32, label %33, label %36
33: ; preds = %31
%34 = load i8*, i8** %2
%35 = getelementptr inbounds i8, i8* %34, i32 1
store i8* %35, i8** %2
br label %21
36: ; preds = %31
%37 = load i8*, i8** %2
%38 = getelementptr inbounds i8, i8* %37, i32 1
store i8* %38, i8** %2
%39 = load i8*, i8** %3
store i8* %39, i8** %4
br label %40
40: ; preds = %47, %36
%41 = load i8*, i8** %2
%42 = getelementptr inbounds i8, i8* %41, i32 1
store i8* %42, i8** %2
%43 = load i8, i8* %41
%44 = load i8*, i8** %4
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %4
store i8 %43, i8* %44
%46 = icmp ne i8 %43, 0
br i1 %46, label %47, label %48
47: ; preds = %40
br label %40
48: ; preds = %40
%49 = load i8*, i8** %4
%50 = getelementptr inbounds i8, i8* %49, i32 -1
store i8* %50, i8** %4
br label %51
51: ; preds = %63, %48
%52 = load i8*, i8** %4
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp ne i32 %54, 62
br i1 %55, label %56, label %61
56: ; preds = %51
%57 = load i8*, i8** %4
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp ne i32 %59, 34
br label %61
61: ; preds = %56, %51
%62 = phi i1 [ false, %51 ], [ %60, %56 ]
br i1 %62, label %63, label %66
63: ; preds = %61
%64 = load i8*, i8** %4
%65 = getelementptr inbounds i8, i8* %64, i32 -1
store i8* %65, i8** %4
br label %51
66: ; preds = %61
%67 = load i8*, i8** %4
store i8 0, i8* %67
%68 = load i8*, i8** %3
ret i8* %68
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [48 x i8] c"error: cannot alloc memory for includeFileName\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @getIncludeFileName(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %1, %16
%13 = phi i8* [ %17, %16 ], [ %0, %1 ]
%14 = load i8, i8* %13
switch i8 %14, label %16 [
i8 60, label %15
i8 34, label %15
]
15: ; preds = %12, %12
br label %18
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %13, i64 1
br label %12
18: ; preds = %15, %18
%19 = phi i8* [ %21, %18 ], [ %13, %15 ]
%20 = phi i8* [ %23, %18 ], [ %5, %15 ]
%21 = getelementptr inbounds i8, i8* %19, i64 1
%22 = load i8, i8* %21
%23 = getelementptr inbounds i8, i8* %20, i64 1
store i8 %22, i8* %20
%24 = icmp eq i8 %22, 0
br i1 %24, label %25, label %18
25: ; preds = %18, %28
%26 = phi i8 [ %30, %28 ], [ 0, %18 ]
%27 = phi i8* [ %29, %28 ], [ %20, %18 ]
switch i8 %26, label %28 [
i8 62, label %31
i8 34, label %31
]
28: ; preds = %25
%29 = getelementptr inbounds i8, i8* %27, i64 -1
%30 = load i8, i8* %29
br label %25
31: ; preds = %25, %25
store i8 0, i8* %27
ret i8* %5
}