#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*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ malloc(int);
int /*<<< orphan*/ stderr;
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strstr(char *, char const *);
int /*<<< orphan*/ zero_string(char *, int);
int extract_name_value(char *in_str, const char *start, const char *stop,
                       char **ptr_val) {
  int status = 0;
  char *val = NULL;
  char *cptr1, *cptr2, *cptr3;
  int len, in_str_len;
  if (in_str == NULL) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 346,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  if ((start == NULL) || (*start == '\0')) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 347,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  if ((stop == NULL) || (*stop == '\0')) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 348,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/"
                "master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  cptr1 = strstr(in_str, start);
  in_str_len = strlen(in_str);
  if ((cptr1 == NULL) || (*cptr1 == '\0')) {
  } else {
    cptr2 = cptr1 + strlen(start);
    cptr3 = strstr(cptr2, stop);
    if (cptr3 == cptr2) {
    } else {
      if (cptr3 == NULL) {
        len = in_str_len - (cptr2 - in_str);
      } else {
        len = cptr3 - cptr2;
      }
      len++;
      val = (char *)malloc(len * sizeof(char));
      {
        if (val == NULL) {
          fprintf(stderr, "Unable to allocate memory\n");
          {
            {
              fprintf(
                  stderr, "Line %3d of File %s \n", 370,
                  "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                  "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/"
                  "heads/master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c");
            };
            status = -1;
            goto BYE;
          };
        }
      };
      zero_string(val, len);
      strncpy(val, cptr2, len - 1);
    }
  }
  *ptr_val = val;
BYE:
  return status;
}


x86 assembly (clang, -O0):
<extract_name_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11c1 <extract_name_value+0x61>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
mov    $0x15a,%edx
lea    0xe68(%rip),%rcx
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    13a6 <extract_name_value+0x246>
cmpq   $0x0,-0x10(%rbp)
je     11dc <extract_name_value+0x7c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    120b <extract_name_value+0xab>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
lea    0xe14(%rip),%rsi
mov    $0x15b,%edx
lea    0xe1e(%rip),%rcx
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    13a6 <extract_name_value+0x246>
cmpq   $0x0,-0x18(%rbp)
je     1226 <extract_name_value+0xc6>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1255 <extract_name_value+0xf5>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
lea    0xdca(%rip),%rsi
mov    $0x15c,%edx
lea    0xdd4(%rip),%rcx
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    13a6 <extract_name_value+0x246>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strstr@plt>
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x50(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     128d <extract_name_value+0x12d>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1292 <extract_name_value+0x132>
jmp    139b <extract_name_value+0x23b>
mov    -0x38(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strstr@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
jne    12d7 <extract_name_value+0x177>
jmp    1396 <extract_name_value+0x236>
cmpq   $0x0,-0x48(%rbp)
jne    12fc <extract_name_value+0x19c>
movslq -0x50(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    -0x8(%rbp),%rdx
sub    %rdx,%rcx
sub    %rcx,%rax
mov    %eax,-0x4c(%rbp)
jmp    130a <extract_name_value+0x1aa>
mov    -0x48(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
movslq -0x4c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    1377 <extract_name_value+0x217>
mov    0x2ca8(%rip),%rax
mov    (%rax),%edi
lea    0xd7c(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2c91(%rip),%rax
mov    (%rax),%edi
lea    0xca8(%rip),%rsi
mov    $0x172,%edx
lea    0xcb2(%rip),%rcx
mov    $0x0,%al
call   1060 <fprintf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    13a6 <extract_name_value+0x246>
mov    -0x30(%rbp),%rdi
mov    -0x4c(%rbp),%esi
call   1040 <zero_string@plt>
mov    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    -0x4c(%rbp),%edx
sub    $0x1,%edx
call   1030 <strncpy@plt>
jmp    139b <extract_name_value+0x23b>
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_name_value>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1254 <extract_name_value+0xf4>
mov    %rsi,%r13
test   %rsi,%rsi
je     1236 <extract_name_value+0xd6>
cmpb   $0x0,0x0(%r13)
je     1236 <extract_name_value+0xd6>
mov    %rdx,%rbp
test   %rdx,%rdx
je     1272 <extract_name_value+0x112>
cmpb   $0x0,0x0(%rbp)
je     1272 <extract_name_value+0x112>
mov    %rcx,%r14
mov    %rdi,%rbx
mov    %r13,%rsi
call   1080 <strstr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   1050 <strlen@plt>
xor    %r12d,%r12d
test   %r15,%r15
je     12ad <extract_name_value+0x14d>
cmpb   $0x0,(%r15)
je     12ad <extract_name_value+0x14d>
mov    %rax,(%rsp)
mov    %r13,%rdi
call   1050 <strlen@plt>
cltq
add    %rax,%r15
mov    %r15,%rdi
mov    %rbp,%rsi
call   1080 <strstr@plt>
cmp    %r15,%rax
je     12ad <extract_name_value+0x14d>
mov    (%rsp),%rbp
add    %ebx,%ebp
test   %rax,%rax
cmovne %eax,%ebp
sub    %r15d,%ebp
lea    0x1(%rbp),%r13d
mov    %r13d,%edi
call   1070 <malloc@plt>
test   %rax,%rax
je     12b4 <extract_name_value+0x154>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r13d,%esi
call   1040 <zero_string@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1030 <strncpy@plt>
jmp    12af <extract_name_value+0x14f>
mov    0x2da3(%rip),%rax
mov    (%rax),%edi
lea    0xdba(%rip),%rsi
lea    0xdc9(%rip),%rcx
mov    $0x15b,%edx
jmp    128e <extract_name_value+0x12e>
mov    0x2d85(%rip),%rax
mov    (%rax),%edi
lea    0xd9c(%rip),%rsi
lea    0xdab(%rip),%rcx
mov    $0x15a,%edx
jmp    128e <extract_name_value+0x12e>
mov    0x2d67(%rip),%rax
mov    (%rax),%edi
lea    0xd7e(%rip),%rsi
lea    0xd8d(%rip),%rcx
mov    $0x15c,%edx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xffffffff,%r12d
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
mov    %rbx,(%r14)
jmp    129b <extract_name_value+0x13b>
mov    0x2d25(%rip),%rbx
mov    (%rbx),%edi
lea    0xdf9(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%rbx),%edi
lea    0xd2c(%rip),%rsi
lea    0xd3b(%rip),%rcx
mov    $0x172,%edx
jmp    128e <extract_name_value+0x12e>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [167 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c\00"
@.str.2 = [27 x i8] c"Unable to allocate memory\0A\00"
define i32 @extract_name_value(i8* %0, i8* %1, i8* %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8** %3, i8*** %8
store i32 0, i32* %9
store i8* null, i8** %10
%16 = load i8*, i8** %5
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %4
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 346, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %9
br label %119
21: ; preds = %4
%22 = load i8*, i8** %6
%23 = icmp eq i8* %22, null
br i1 %23, label %29, label %24
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %24, %21
%30 = load i32, i32* @stderr
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 347, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %9
br label %119
32: ; preds = %24
%33 = load i8*, i8** %7
%34 = icmp eq i8* %33, null
br i1 %34, label %40, label %35
35: ; preds = %32
%36 = load i8*, i8** %7
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %35, %32
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 348, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %9
br label %119
43: ; preds = %35
%44 = load i8*, i8** %5
%45 = load i8*, i8** %6
%46 = call i8* @strstr(i8* %44, i8* %45)
store i8* %46, i8** %11
%47 = load i8*, i8** %5
%48 = call i32 @strlen(i8* %47)
store i32 %48, i32* %15
%49 = load i8*, i8** %11
%50 = icmp eq i8* %49, null
br i1 %50, label %56, label %51
51: ; preds = %43
%52 = load i8*, i8** %11
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %57
56: ; preds = %51, %43
br label %116
57: ; preds = %51
%58 = load i8*, i8** %11
%59 = load i8*, i8** %6
%60 = call i32 @strlen(i8* %59)
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %58, i64 %61
store i8* %62, i8** %12
%63 = load i8*, i8** %12
%64 = load i8*, i8** %7
%65 = call i8* @strstr(i8* %63, i8* %64)
store i8* %65, i8** %13
%66 = load i8*, i8** %13
%67 = load i8*, i8** %12
%68 = icmp eq i8* %66, %67
br i1 %68, label %69, label %70
69: ; preds = %57
br label %115
70: ; preds = %57
%71 = load i8*, i8** %13
%72 = icmp eq i8* %71, null
br i1 %72, label %73, label %83
73: ; preds = %70
%74 = load i32, i32* %15
%75 = sext i32 %74 to i64
%76 = load i8*, i8** %12
%77 = load i8*, i8** %5
%78 = ptrtoint i8* %76 to i64
%79 = ptrtoint i8* %77 to i64
%80 = sub i64 %78, %79
%81 = sub nsw i64 %75, %80
%82 = trunc i64 %81 to i32
store i32 %82, i32* %14
br label %90
83: ; preds = %70
%84 = load i8*, i8** %13
%85 = load i8*, i8** %12
%86 = ptrtoint i8* %84 to i64
%87 = ptrtoint i8* %85 to i64
%88 = sub i64 %86, %87
%89 = trunc i64 %88 to i32
store i32 %89, i32* %14
br label %90
90: ; preds = %83, %73
%91 = load i32, i32* %14
%92 = add nsw i32 %91, 1
store i32 %92, i32* %14
%93 = load i32, i32* %14
%94 = sext i32 %93 to i64
%95 = mul i64 %94, 1
%96 = trunc i64 %95 to i32
%97 = call i64 @malloc(i32 %96)
%98 = inttoptr i64 %97 to i8*
store i8* %98, i8** %10
%99 = load i8*, i8** %10
%100 = icmp eq i8* %99, null
br i1 %100, label %101, label %106
101: ; preds = %90
%102 = load i32, i32* @stderr
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %102, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%104 = load i32, i32* @stderr
%105 = call i32 (i32, i8*, ...) @fprintf(i32 %104, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 370, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %9
br label %119
106: ; preds = %90
%107 = load i8*, i8** %10
%108 = load i32, i32* %14
%109 = call i32 @zero_string(i8* %107, i32 %108)
%110 = load i8*, i8** %10
%111 = load i8*, i8** %12
%112 = load i32, i32* %14
%113 = sub nsw i32 %112, 1
%114 = call i32 @strncpy(i8* %110, i8* %111, i32 %113)
br label %115
115: ; preds = %106, %69
br label %116
116: ; preds = %115, %56
%117 = load i8*, i8** %10
%118 = load i8**, i8*** %8
store i8* %117, i8** %118
br label %119
119: ; preds = %116, %101, %40, %29, %18
%120 = load i32, i32* %9
ret i32 %120
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [167 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/heads/master/DEPRECATED_Q2/BAK.4.23.2015.PARSER/auxil.c\00"
@.str.2 = [27 x i8] c"Unable to allocate memory\0A\00"
define i32 @extract_name_value(i8* %0, i8* %1, i8* %2, i8** nocapture writeonly %3) {
%5 = icmp eq i8* %0, null
br i1 %5, label %6, label %9
6: ; preds = %4
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 346, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %62
9: ; preds = %4
%10 = icmp eq i8* %1, null
br i1 %10, label %14, label %11
11: ; preds = %9
%12 = load i8, i8* %1
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11, %9
%15 = load i32, i32* @stderr
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 347, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %62
17: ; preds = %11
%18 = icmp eq i8* %2, null
br i1 %18, label %22, label %19
19: ; preds = %17
%20 = load i8, i8* %2
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %19, %17
%23 = load i32, i32* @stderr
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 348, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %62
25: ; preds = %19
%26 = tail call i8* @strstr(i8* %0, i8* %1)
%27 = tail call i32 @strlen(i8* %0)
%28 = icmp eq i8* %26, null
br i1 %28, label %60, label %29
29: ; preds = %25
%30 = load i8, i8* %26
%31 = icmp eq i8 %30, 0
br i1 %31, label %60, label %32
32: ; preds = %29
%33 = tail call i32 @strlen(i8* %1)
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %26, i64 %34
%36 = tail call i8* @strstr(i8* %35, i8* %2)
%37 = icmp eq i8* %36, %35
br i1 %37, label %60, label %38
38: ; preds = %32
%39 = icmp eq i8* %36, null
%40 = zext i32 %27 to i64
%41 = ptrtoint i8* %35 to i64
%42 = ptrtoint i8* %0 to i64
%43 = add i64 %40, %42
%44 = ptrtoint i8* %36 to i64
%45 = select i1 %39, i64 %43, i64 %44
%46 = sub i64 %45, %41
%47 = trunc i64 %46 to i32
%48 = add nsw i32 %47, 1
%49 = tail call i64 @malloc(i32 %48)
%50 = inttoptr i64 %49 to i8*
%51 = icmp eq i64 %49, 0
br i1 %51, label %52, label %57
52: ; preds = %38
%53 = load i32, i32* @stderr
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%55 = load i32, i32* @stderr
%56 = tail call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 370, i8* getelementptr inbounds ([167 x i8], [167 x i8]* @.str.1, i64 0, i64 0))
br label %62
57: ; preds = %38
%58 = tail call i32 @zero_string(i8* %50, i32 %48)
%59 = tail call i32 @strncpy(i8* %50, i8* %35, i32 %47)
br label %60
60: ; preds = %57, %32, %25, %29
%61 = phi i8* [ null, %25 ], [ null, %29 ], [ null, %32 ], [ %50, %57 ]
store i8* %61, i8** %3
br label %62
62: ; preds = %60, %52, %22, %14, %6
%63 = phi i32 [ -1, %6 ], [ -1, %14 ], [ -1, %22 ], [ 0, %60 ], [ -1, %52 ]
ret i32 %63
}