#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 *, int, char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int rs_mmap(char *, char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char const *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char const *);
int get_nn_data(const char *fld, int has_null_fld, char **ptr_nn_X,
                size_t *ptr_nn_nX) {
  int status = 0;
  char *nn_X = NULL;
  size_t nn_nX = 0;
  char *nn_fld = NULL;
  if (has_null_fld == 1) {
    int len = strlen(fld);
    nn_fld = malloc(len + strlen(".nn.") + 1);
    strcpy(nn_fld, ".nn.");
    strcat(nn_fld, fld);
    status = rs_mmap(nn_fld, &nn_X, &nn_nX, 0);
    {
      if ((status) < 0) {
        {
          {
            fprintf(stderr, "Line %3d of File %s \n", 68,
                    "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                    "outputs/2022-01-22/02-19-57/repos/NerdWalletOSS/Q/refs/"
                    "heads/master/DEPRECATED_Q2/AUX/dbauxil.c");
          };
          status = (status);
          goto BYE;
        }
      }
    };
  }
BYE:
  *ptr_nn_X = nn_X;
  *ptr_nn_nX = nn_nX;
  {
    if ((nn_fld) != NULL) {
      free((nn_fld));
      (nn_fld) = NULL;
    }
  };
  return status;
}


x86 assembly (clang, -O0):
<get_nn_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    124d <get_nn_data+0xdd>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    0xe37(%rip),%rdi
call   1050 <strlen@plt>
mov    -0x48(%rbp),%edi
add    %eax,%edi
add    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
lea    0xe16(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1090 <strcat@plt>
mov    -0x40(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
xor    %ecx,%ecx
call   1080 <rs_mmap@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1248 <get_nn_data+0xd8>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
lea    0xdd9(%rip),%rsi
mov    $0x44,%edx
lea    0xde3(%rip),%rcx
call   1060 <fprintf@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    1252 <get_nn_data+0xe2>
jmp    124d <get_nn_data+0xdd>
jmp    1252 <get_nn_data+0xe2>
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x38(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x40(%rbp)
je     1284 <get_nn_data+0x114>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x24(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_nn_data>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
movq   $0x0,0x8(%rsp)
movq   $0x0,(%rsp)
cmp    $0x1,%esi
jne    1230 <get_nn_data+0xc0>
mov    %rdi,%rbp
call   1050 <strlen@plt>
mov    %eax,%ebx
lea    0xe53(%rip),%r12
mov    %r12,%rdi
call   1050 <strlen@plt>
lea    (%rbx,%rax,1),%edi
add    $0x1,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <strcat@plt>
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
xor    %ecx,%ecx
call   1080 <rs_mmap@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1212 <get_nn_data+0xa2>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
lea    0xe13(%rip),%rcx
mov    $0x44,%edx
call   1060 <fprintf@plt>
mov    0x8(%rsp),%rax
mov    %rax,(%r15)
mov    (%rsp),%rax
mov    %rax,(%r14)
test   %rbx,%rbx
je     1240 <get_nn_data+0xd0>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    1240 <get_nn_data+0xd0>
movq   $0x0,(%r15)
movq   $0x0,(%r14)
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c".nn.\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.2 = [152 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/AUX/dbauxil.c\00"
define i32 @get_nn_data(i8* %0, i32 %1, i8** %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i64*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i64* %3, i64** %8
store i32 0, i32* %9
store i8* null, i8** %10
store i64 0, i64* %11
store i8* null, i8** %12
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %38
16: ; preds = %4
%17 = load i8*, i8** %5
%18 = call i32 @strlen(i8* %17)
store i32 %18, i32* %13
%19 = load i32, i32* %13
%20 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%21 = add nsw i32 %19, %20
%22 = add nsw i32 %21, 1
%23 = call i8* @malloc(i32 %22)
store i8* %23, i8** %12
%24 = load i8*, i8** %12
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%26 = load i8*, i8** %12
%27 = load i8*, i8** %5
%28 = call i32 @strcat(i8* %26, i8* %27)
%29 = load i8*, i8** %12
%30 = call i32 @rs_mmap(i8* %29, i8** %10, i64* %11, i32 0)
store i32 %30, i32* %9
%31 = load i32, i32* %9
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %37
33: ; preds = %16
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 68, i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.2, i64 0, i64 0))
%36 = load i32, i32* %9
store i32 %36, i32* %9
br label %39
37: ; preds = %16
br label %38
38: ; preds = %37, %4
br label %39
39: ; preds = %38, %33
%40 = load i8*, i8** %10
%41 = load i8**, i8*** %7
store i8* %40, i8** %41
%42 = load i64, i64* %11
%43 = load i64*, i64** %8
store i64 %42, i64* %43
%44 = load i8*, i8** %12
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %49
46: ; preds = %39
%47 = load i8*, i8** %12
%48 = call i32 @free(i8* %47)
store i8* null, i8** %12
br label %49
49: ; preds = %46, %39
%50 = load i32, i32* %9
ret i32 %50
}

LLVM IR (-O2):
@.str = [5 x i8] c".nn.\00"
@stderr = global i32 0
@.str.1 = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.2 = [152 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/AUX/dbauxil.c\00"
define i32 @get_nn_data(i8* %0, i32 %1, i8** nocapture writeonly %2, i64* nocapture writeonly %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%8 = bitcast i64* %6 to i8*
store i64 0, i64* %6
%9 = icmp eq i32 %1, 1
br i1 %9, label %11, label %10
10: ; preds = %4
store i8* null, i8** %2
store i64 0, i64* %3
br label %30
11: ; preds = %4
%12 = tail call i32 @strlen(i8* %0)
%13 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%14 = add i32 %12, 1
%15 = add i32 %14, %13
%16 = tail call i8* @malloc(i32 %15)
%17 = tail call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @strcat(i8* %16, i8* %0)
%19 = call i32 @rs_mmap(i8* %16, i8** %5, i64* %6, i32 0)
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %11
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 68, i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %21, %11
%25 = load i8*, i8** %5
store i8* %25, i8** %2
%26 = load i64, i64* %6
store i64 %26, i64* %3
%27 = icmp eq i8* %16, null
br i1 %27, label %30, label %28
28: ; preds = %24
%29 = call i32 @free(i8* %16)
br label %30
30: ; preds = %10, %24, %28
%31 = phi i32 [ 0, %10 ], [ %19, %24 ], [ %19, %28 ]
ret i32 %31
}