#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char const);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ putc(char const, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
void data_fprintf_esc(FILE *f, unsigned int padd, const char *str) {
  while (padd-- > 0)
    fputc(' ', f);
  fputc('"', f);
  while (*str) {
    switch (*str) {
    case '\\':
      fputs("\\\\", f);
      break;
    case '"':
      fputs("\\\"", f);
      break;
    case '\t':
      fputs("        ", f);
      break;
    default:
      if (*str >= 0x20)
        putc(*str, f);
      else
        fprintf(stderr, "%s:%d: WARNING: invalid character for JSON: %x\n",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/linux-test-project/ltp/refs/"
                "heads/master/docparse/data_storage.h",
                284, *str);
      break;
    }
    str++;
  }
  fputc('"', f);
}


x86 assembly (clang, -O0):
<data_fprintf_esc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jbe    117a <data_fprintf_esc+0x3a>
mov    -0x8(%rbp),%rsi
mov    $0x20,%edi
call   1040 <fputc@plt>
jmp    1153 <data_fprintf_esc+0x13>
mov    -0x8(%rbp),%rsi
mov    $0x22,%edi
call   1040 <fputc@plt>
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1274 <data_fprintf_esc+0x134>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x9,%eax
je     11f9 <data_fprintf_esc+0xb9>
jmp    11ad <data_fprintf_esc+0x6d>
mov    -0x1c(%rbp),%eax
sub    $0x22,%eax
je     11e4 <data_fprintf_esc+0xa4>
jmp    11be <data_fprintf_esc+0x7e>
mov    -0x1c(%rbp),%eax
sub    $0x5c,%eax
jne    120e <data_fprintf_esc+0xce>
jmp    11cf <data_fprintf_esc+0x8f>
mov    -0x8(%rbp),%rsi
lea    0xe26(%rip),%rdi
call   1030 <fputs@plt>
jmp    1263 <data_fprintf_esc+0x123>
mov    -0x8(%rbp),%rsi
lea    0xe14(%rip),%rdi
call   1030 <fputs@plt>
jmp    1263 <data_fprintf_esc+0x123>
mov    -0x8(%rbp),%rsi
lea    0xe02(%rip),%rdi
call   1030 <fputs@plt>
jmp    1263 <data_fprintf_esc+0x123>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jl     1235 <data_fprintf_esc+0xf5>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rsi
movsbl %al,%edi
call   1050 <putc@plt>
jmp    125e <data_fprintf_esc+0x11e>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
lea    0xdc6(%rip),%rsi
lea    0xdef(%rip),%rdx
mov    $0x11c,%ecx
movsbl (%rax),%r8d
call   1060 <fprintf@plt>
jmp    1263 <data_fprintf_esc+0x123>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1188 <data_fprintf_esc+0x48>
mov    -0x8(%rbp),%rsi
mov    $0x22,%edi
call   1040 <fputc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_fprintf_esc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rdi,%r14
test   %esi,%esi
je     1172 <data_fprintf_esc+0x32>
mov    %esi,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
add    $0xffffffff,%ebp
jne    1160 <data_fprintf_esc+0x20>
mov    $0x22,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
mov    (%rbx),%al
test   %al,%al
je     1240 <data_fprintf_esc+0x100>
add    $0x1,%rbx
lea    0xe72(%rip),%r15
lea    0xe68(%rip),%r12
lea    0xe5e(%rip),%r13
lea    0xe96(%rip),%rbp
jmp    11d0 <data_fprintf_esc+0x90>
nopl   0x0(%rax,%rax,1)
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r12,%rdi
mov    %r14,%rcx
call   1060 <fwrite@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1240 <data_fprintf_esc+0x100>
movsbl %al,%r8d
cmp    $0x9,%r8d
je     1200 <data_fprintf_esc+0xc0>
cmp    $0x22,%r8d
je     11b0 <data_fprintf_esc+0x70>
cmp    $0x5c,%r8d
jne    1210 <data_fprintf_esc+0xd0>
mov    $0x2,%esi
mov    $0x1,%edx
mov    %r13,%rdi
jmp    11bd <data_fprintf_esc+0x7d>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x8,%esi
mov    $0x1,%edx
mov    %r15,%rdi
jmp    11bd <data_fprintf_esc+0x7d>
nop
cmp    $0x20,%al
jl     1221 <data_fprintf_esc+0xe1>
mov    %r8d,%edi
mov    %r14,%rsi
call   1040 <putc@plt>
jmp    11c5 <data_fprintf_esc+0x85>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
lea    0xdde(%rip),%rsi
mov    %rbp,%rdx
mov    $0x11c,%ecx
call   1050 <fprintf@plt>
jmp    11c5 <data_fprintf_esc+0x85>
mov    $0x22,%edi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [3 x i8] c"\\\22\00"
@.str.2 = [9 x i8] c" \00"
@stderr = global i32 0
@.str.3 = [48 x i8] c"%s:%d: WARNING: invalid character for JSON: %x\0A\00"
@.str.4 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/linux-test-project/ltp/refs/heads/master/docparse/data_storage.h\00"
define void @data_fprintf_esc(i32* %0, i32 %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
br label %7
7: ; preds = %11, %3
%8 = load i32, i32* %5
%9 = add i32 %8, -1
store i32 %9, i32* %5
%10 = icmp ugt i32 %8, 0
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32*, i32** %4
%13 = call i32 @fputc(i8 signext 32, i32* %12)
br label %7
14: ; preds = %7
%15 = load i32*, i32** %4
%16 = call i32 @fputc(i8 signext 34, i32* %15)
br label %17
17: ; preds = %50, %14
%18 = load i8*, i8** %6
%19 = load i8, i8* %18
%20 = icmp ne i8 %19, 0
br i1 %20, label %21, label %53
21: ; preds = %17
%22 = load i8*, i8** %6
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
switch i32 %24, label %34 [
i32 92, label %25
i32 34, label %28
i32 9, label %31
]
25: ; preds = %21
%26 = load i32*, i32** %4
%27 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %26)
br label %50
28: ; preds = %21
%29 = load i32*, i32** %4
%30 = call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %29)
br label %50
31: ; preds = %21
%32 = load i32*, i32** %4
%33 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %32)
br label %50
34: ; preds = %21
%35 = load i8*, i8** %6
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp sge i32 %37, 32
br i1 %38, label %39, label %44
39: ; preds = %34
%40 = load i8*, i8** %6
%41 = load i8, i8* %40
%42 = load i32*, i32** %4
%43 = call i32 @putc(i8 signext %41, i32* %42)
br label %49
44: ; preds = %34
%45 = load i32, i32* @stderr
%46 = load i8*, i8** %6
%47 = load i8, i8* %46
%48 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.4, i64 0, i64 0), i32 284, i8 signext %47)
br label %49
49: ; preds = %44, %39
br label %50
50: ; preds = %49, %31, %28, %25
%51 = load i8*, i8** %6
%52 = getelementptr inbounds i8, i8* %51, i32 1
store i8* %52, i8** %6
br label %17
53: ; preds = %17
%54 = load i32*, i32** %4
%55 = call i32 @fputc(i8 signext 34, i32* %54)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"\\\\\00"
@.str.1 = [3 x i8] c"\\\22\00"
@.str.2 = [9 x i8] c" \00"
@stderr = global i32 0
@.str.3 = [48 x i8] c"%s:%d: WARNING: invalid character for JSON: %x\0A\00"
@.str.4 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/linux-test-project/ltp/refs/heads/master/docparse/data_storage.h\00"
define void @data_fprintf_esc(i32* nocapture %0, i32 %1, i8* nocapture %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %10, label %5
5: ; preds = %3, %5
%6 = phi i32 [ %7, %5 ], [ %1, %3 ]
%7 = add i32 %6, -1
%8 = tail call i32 @fputc(i8 signext 32, i32* %0)
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %3
%11 = tail call i32 @fputc(i8 signext 34, i32* %0)
%12 = load i8, i8* %2
%13 = icmp eq i8 %12, 0
br i1 %13, label %35, label %14
14: ; preds = %10, %31
%15 = phi i8 [ %33, %31 ], [ %12, %10 ]
%16 = phi i8* [ %32, %31 ], [ %2, %10 ]
%17 = sext i8 %15 to i32
switch i32 %17, label %24 [
i32 92, label %18
i32 34, label %20
i32 9, label %22
]
18: ; preds = %14
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %31
20: ; preds = %14
%21 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %0)
br label %31
22: ; preds = %14
%23 = tail call i64 @fwrite(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i64 8, i64 1, i32* %0)
br label %31
24: ; preds = %14
%25 = icmp sgt i8 %15, 31
br i1 %25, label %26, label %28
26: ; preds = %24
%27 = tail call i32 @putc(i8 signext %15, i32* %0)
br label %31
28: ; preds = %24
%29 = load i32, i32* @stderr
%30 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.4, i64 0, i64 0), i32 284, i8 signext %15)
br label %31
31: ; preds = %26, %28, %22, %20, %18
%32 = getelementptr inbounds i8, i8* %16, i64 1
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 0
br i1 %34, label %35, label %14
35: ; preds = %31, %10
%36 = tail call i32 @fputc(i8 signext 34, i32* %0)
ret void
}