#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*/ stderr;
int strlen(char const *);
int /*<<< orphan*/ strncpy(char *, char const *, int);
int xcat(const char *buf, char *Y, size_t nY, size_t *ptr_iY) {
  int status = 0;
  size_t iY = *ptr_iY;
  if ((buf == NULL) || (*buf == '\0')) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 760,
                "/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/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  int len = strlen(buf);
  if (iY + len > nY) {
    {
      {
        fprintf(stderr, "Line %3d of File %s \n", 762,
                "/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/auxil.c");
      };
      status = -1;
      goto BYE;
    };
  }
  strncpy(Y + iY, buf, len);
  iY += len;
  *ptr_iY = iY;
BYE:
  return status;
}


x86 assembly (clang, -O0):
<xcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1175 <xcat+0x45>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11a2 <xcat+0x72>
mov    0x2e64(%rip),%rax
mov    (%rax),%edi
lea    0xe7b(%rip),%rsi
mov    $0x2f8,%edx
lea    0xe85(%rip),%rcx
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    121b <xcat+0xeb>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
add    %rcx,%rax
cmp    -0x18(%rbp),%rax
jbe    11f0 <xcat+0xc0>
mov    0x2e16(%rip),%rax
mov    (%rax),%edi
lea    0xe2d(%rip),%rsi
mov    $0x2fa,%edx
lea    0xe37(%rip),%rcx
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x24(%rbp)
jmp    121b <xcat+0xeb>
mov    -0x10(%rbp),%rdi
add    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1030 <strncpy@plt>
movslq -0x34(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x24(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1185 <xcat+0x55>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1185 <xcat+0x55>
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    (%rcx),%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
movslq %eax,%r13
add    %rbp,%r13
cmp    %r12,%r13
jbe    11ad <xcat+0x7d>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
lea    0xe89(%rip),%rsi
lea    0xe98(%rip),%rcx
mov    $0x2fa,%edx
jmp    11a1 <xcat+0x71>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
lea    0xe7a(%rip),%rcx
mov    $0x2f8,%edx
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    11c2 <xcat+0x92>
add    %rbp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncpy@plt>
mov    %r13,(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Line %3d of File %s \0A\00"
@.str.1 = [150 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/auxil.c\00"
define i32 @xcat(i8* %0, i8* %1, i64 %2, i64* nocapture %3) {
%5 = load i64, i64* %3
%6 = icmp eq i8* %0, null
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7, %4
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 760, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.1, i64 0, i64 0))
br label %24
13: ; preds = %7
%14 = tail call i32 @strlen(i8* %0)
%15 = sext i32 %14 to i64
%16 = add i64 %5, %15
%17 = icmp ugt i64 %16, %2
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 762, i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str.1, i64 0, i64 0))
br label %24
21: ; preds = %13
%22 = getelementptr inbounds i8, i8* %1, i64 %5
%23 = tail call i32 @strncpy(i8* %22, i8* %0, i32 %14)
store i64 %16, i64* %3
br label %24
24: ; preds = %21, %18, %10
%25 = phi i32 [ -1, %10 ], [ -1, %18 ], [ 0, %21 ]
ret i32 %25
}