#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;
char *StrNDup(char *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, ...);
int /*<<< orphan*/ stderr;
char *strchr(char const *, char);
char *targetName(const char *line) {
  char *p;
  char *b = strchr(line, '`');
  if (b == NULL)
    b = strchr(line, '\'');
  char *e = (b == NULL ? NULL : strchr(b + 1, '\''));
  if (b == NULL || e == NULL || b > e) {
    fprintf(stderr, "Cannot get target name in \"%s\".\n", line);
    exit(EXIT_FAILURE);
  }
  p = StrNDup(b + 1, (e - b) - 1);
  if (p == NULL)
    do {
      fprintf(stderr, "%s: %d : OUT_OF_MEMORY.\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/lindenb/makefile2graph/refs/heads/"
              "master/make2graph.c",
              170);
      exit(EXIT_FAILURE);
    } while (0);
  return p;
}


x86 assembly (clang, -O0):
<targetName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x60,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117b <targetName+0x3b>
mov    -0x8(%rbp),%rdi
mov    $0x27,%esi
call   1040 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1191 <targetName+0x51>
xor    %eax,%eax
mov    %rax,-0x28(%rbp)
jmp    11a7 <targetName+0x67>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    $0x27,%esi
call   1040 <strchr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11d3 <targetName+0x93>
cmpq   $0x0,-0x20(%rbp)
je     11d3 <targetName+0x93>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    11fc <targetName+0xbc>
mov    0x2e06(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe19(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
sub    $0x1,%rax
mov    %eax,%esi
call   1030 <StrNDup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    125f <targetName+0x11f>
jmp    122e <targetName+0xee>
mov    0x2dab(%rip),%rax
mov    (%rax),%edi
lea    0xde3(%rip),%rsi
lea    0xdf5(%rip),%rdx
mov    $0xaa,%ecx
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d80(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<targetName>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x60,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    116f <targetName+0x2f>
mov    %r14,%rdi
mov    $0x27,%esi
call   1040 <strchr@plt>
mov    %rax,%rbx
test   %rax,%rax
je     11a3 <targetName+0x63>
lea    0x1(%rbx),%r15
mov    %r15,%rdi
mov    $0x27,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11a3 <targetName+0x63>
cmp    %rax,%rbx
ja     11a3 <targetName+0x63>
not    %ebx
add    %ebx,%eax
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <StrNDup@plt>
test   %rax,%rax
je     11bf <targetName+0x7f>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11e2 <targetName+0xa2>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
lea    0xe52(%rip),%rsi
lea    0xe64(%rip),%rdx
mov    $0xaa,%ecx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x2def(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Cannot get target name in \22%s\22.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [25 x i8] c"%s: %d : OUT_OF_MEMORY.\0A\00"
@.str.2 = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lindenb/makefile2graph/refs/heads/master/make2graph.c\00"
define i8* @targetName(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @strchr(i8* %6, i8 signext 96)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i8* @strchr(i8* %11, i8 signext 39)
store i8* %12, i8** %4
br label %13
13: ; preds = %10, %1
%14 = load i8*, i8** %4
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %13
br label %21
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = call i8* @strchr(i8* %19, i8 signext 39)
br label %21
21: ; preds = %17, %16
%22 = phi i8* [ null, %16 ], [ %20, %17 ]
store i8* %22, i8** %5
%23 = load i8*, i8** %4
%24 = icmp eq i8* %23, null
br i1 %24, label %32, label %25
25: ; preds = %21
%26 = load i8*, i8** %5
%27 = icmp eq i8* %26, null
br i1 %27, label %32, label %28
28: ; preds = %25
%29 = load i8*, i8** %4
%30 = load i8*, i8** %5
%31 = icmp ugt i8* %29, %30
br i1 %31, label %32, label %38
32: ; preds = %28, %25, %21
%33 = load i32, i32* @stderr
%34 = load i8*, i8** %2
%35 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @EXIT_FAILURE
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %28
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i64 1
%41 = load i8*, i8** %5
%42 = load i8*, i8** %4
%43 = ptrtoint i8* %41 to i64
%44 = ptrtoint i8* %42 to i64
%45 = sub i64 %43, %44
%46 = sub nsw i64 %45, 1
%47 = trunc i64 %46 to i32
%48 = call i8* @StrNDup(i8* %40, i32 %47)
store i8* %48, i8** %3
%49 = load i8*, i8** %3
%50 = icmp eq i8* %49, null
br i1 %50, label %51, label %58
51: ; preds = %38
br label %52
52: ; preds = %51
%53 = load i32, i32* @stderr
%54 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.2, i64 0, i64 0), i32 170)
%55 = load i32, i32* @EXIT_FAILURE
%56 = call i32 @exit(i32 %55)
unreachable
57: ; No predecessors!
br label %58
58: ; preds = %57, %38
%59 = load i8*, i8** %3
ret i8* %59
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Cannot get target name in \22%s\22.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [25 x i8] c"%s: %d : OUT_OF_MEMORY.\0A\00"
@.str.2 = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lindenb/makefile2graph/refs/heads/master/make2graph.c\00"
define i8* @targetName(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 96)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 39)
%6 = icmp eq i8* %5, null
br i1 %6, label %14, label %7
7: ; preds = %1, %4
%8 = phi i8* [ %5, %4 ], [ %2, %1 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = tail call i8* @strchr(i8* %9, i8 signext 39)
%11 = icmp eq i8* %10, null
%12 = icmp ugt i8* %8, %10
%13 = select i1 %11, i1 true, i1 %12
br i1 %13, label %14, label %19
14: ; preds = %4, %7
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0)
%17 = load i32, i32* @EXIT_FAILURE
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %7
%20 = ptrtoint i8* %10 to i64
%21 = ptrtoint i8* %8 to i64
%22 = xor i64 %21, -1
%23 = add i64 %20, %22
%24 = trunc i64 %23 to i32
%25 = tail call i8* @StrNDup(i8* %9, i32 %24)
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %32
27: ; preds = %19
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.2, i64 0, i64 0), i32 170)
%30 = load i32, i32* @EXIT_FAILURE
%31 = tail call i32 @exit(i32 %30)
unreachable
32: ; preds = %19
ret i8* %25
}