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

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ index_nrchr(char *, char, int, size_t);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char, int,
                            size_t);
size_t test_check_format(char *, char *, char, int, size_t);
int TEST_index_nrchr(void) {
  char call[BUFSIZ];
  size_t ret;
  char buf[] = " a a a";
  ret = (test_check_format(("\"%s\", '%c', %zu, %zu"), buf, 'a',
                           sizeof(buf) - 1, (size_t)0),
         snprintf((call), (sizeof(call)),
                  ("%s("
                   "\"%s\", '%c', %zu, %zu"
                   ")"),
                  "index_nrchr", buf, 'a', sizeof(buf) - 1, (size_t)0),
         index_nrchr(buf, 'a', sizeof(buf) - 1, (size_t)0));
  do {
    if (!((ret) == ((size_t)1))) {
      printf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/hadrianw/werf/refs/heads/master/block.c"
             ":%d ",
             1506);
      printf("%s", call);
      printf("\n\t"
             "ret"
             " "
             "=="
             " "
             "(size_t)1"
             "\n"
             "\treceived: "
             "%zu"
             "\n"
             "\texpected: "
             "%zu"
             "\n",
             (ret), ((size_t)1));
      return -1;
    }
  } while (0);
  ret = (test_check_format(("\"%s\", '%c', %zu, %zu"), buf, 'a',
                           sizeof(buf) - 1, (size_t)2),
         snprintf((call), (sizeof(call)),
                  ("%s("
                   "\"%s\", '%c', %zu, %zu"
                   ")"),
                  "index_nrchr", buf, 'a', sizeof(buf) - 1, (size_t)2),
         index_nrchr(buf, 'a', sizeof(buf) - 1, (size_t)2));
  do {
    if (!((ret) == ((size_t)5))) {
      printf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/hadrianw/werf/refs/heads/master/block.c"
             ":%d ",
             1510);
      printf("%s", call);
      printf("\n\t"
             "ret"
             " "
             "=="
             " "
             "(size_t)5"
             "\n"
             "\treceived: "
             "%zu"
             "\n"
             "\texpected: "
             "%zu"
             "\n",
             (ret), ((size_t)5));
      return -1;
    }
  } while (0);
  ret = (test_check_format(("\"%s\", '%c', %zu, %zu"), buf + 1, 'a',
                           sizeof(buf) - 2, (size_t)0),
         snprintf((call), (sizeof(call)),
                  ("%s("
                   "\"%s\", '%c', %zu, %zu"
                   ")"),
                  "index_nrchr", buf + 1, 'a', sizeof(buf) - 2, (size_t)0),
         index_nrchr(buf + 1, 'a', sizeof(buf) - 2, (size_t)0));
  do {
    if (!((ret) == ((size_t)0))) {
      printf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/hadrianw/werf/refs/heads/master/block.c"
             ":%d ",
             1514);
      printf("%s", call);
      printf("\n\t"
             "ret"
             " "
             "=="
             " "
             "(size_t)0"
             "\n"
             "\treceived: "
             "%zu"
             "\n"
             "\texpected: "
             "%zu"
             "\n",
             (ret), ((size_t)0));
      return -1;
    }
  } while (0);
  ret = (test_check_format(("\"%s\", '%c', %zu, %zu"), buf + 1, 'a',
                           sizeof(buf) - 2, (size_t)2),
         snprintf((call), (sizeof(call)),
                  ("%s("
                   "\"%s\", '%c', %zu, %zu"
                   ")"),
                  "index_nrchr", buf + 1, 'a', sizeof(buf) - 2, (size_t)2),
         index_nrchr(buf + 1, 'a', sizeof(buf) - 2, (size_t)2));
  do {
    if (!((ret) == ((size_t)4))) {
      printf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/hadrianw/werf/refs/heads/master/block.c"
             ":%d ",
             1518);
      printf("%s", call);
      printf("\n\t"
             "ret"
             " "
             "=="
             " "
             "(size_t)4"
             "\n"
             "\treceived: "
             "%zu"
             "\n"
             "\texpected: "
             "%zu"
             "\n",
             (ret), ((size_t)4));
      return -1;
    }
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<TEST_index_nrchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x2e91(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x38(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    0xe82(%rip),%eax
mov    %eax,-0x27(%rbp)
mov    0xe7c(%rip),%ax
mov    %ax,-0x23(%rbp)
mov    0xe74(%rip),%al
mov    %al,-0x21(%rbp)
lea    -0x27(%rbp),%rsi
lea    0xe67(%rip),%rdi
mov    $0x61,%edx
mov    $0x6,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1060 <test_check_format@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    %eax,%esi
lea    -0x27(%rbp),%r8
lea    0xe53(%rip),%rdx
lea    0xe65(%rip),%rcx
mov    $0x61,%r9d
xor    %eax,%eax
sub    $0x10,%rsp
movl   $0x6,(%rsp)
movq   $0x0,0x8(%rsp)
call   1040 <snprintf@plt>
add    $0x10,%rsp
lea    -0x27(%rbp),%rdi
mov    $0x61,%esi
mov    $0x6,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <index_nrchr@plt>
cltq
mov    %rax,-0x20(%rbp)
cmpq   $0x1,-0x20(%rbp)
je     126c <TEST_index_nrchr+0x12c>
lea    0xe1d(%rip),%rdi
mov    $0x5e2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xe7d(%rip),%rdi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    153e <TEST_index_nrchr+0x3fe>
jmp    1271 <TEST_index_nrchr+0x131>
jmp    1276 <TEST_index_nrchr+0x136>
lea    -0x27(%rbp),%rsi
lea    0xd86(%rip),%rdi
mov    $0x61,%edx
mov    $0x6,%ecx
mov    $0x2,%r8d
call   1060 <test_check_format@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    %eax,%esi
lea    -0x27(%rbp),%r8
lea    0xd71(%rip),%rdx
lea    0xd83(%rip),%rcx
mov    $0x61,%r9d
sub    $0x10,%rsp
movl   $0x6,(%rsp)
movq   $0x2,0x8(%rsp)
call   1040 <snprintf@plt>
add    $0x10,%rsp
lea    -0x27(%rbp),%rdi
mov    $0x61,%esi
mov    $0x6,%edx
mov    $0x2,%ecx
call   1050 <index_nrchr@plt>
cltq
mov    %rax,-0x20(%rbp)
cmpq   $0x5,-0x20(%rbp)
je     134d <TEST_index_nrchr+0x20d>
lea    0xd3c(%rip),%rdi
mov    $0x5e6,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xdce(%rip),%rdi
mov    $0x5,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    153e <TEST_index_nrchr+0x3fe>
jmp    1352 <TEST_index_nrchr+0x212>
jmp    1357 <TEST_index_nrchr+0x217>
lea    -0x27(%rbp),%rsi
add    $0x1,%rsi
lea    0xca1(%rip),%rdi
mov    $0x61,%edx
mov    $0x5,%ecx
xor    %eax,%eax
mov    %eax,%r8d
call   1060 <test_check_format@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    %eax,%esi
lea    -0x27(%rbp),%r8
add    $0x1,%r8
lea    0xc89(%rip),%rdx
lea    0xc9b(%rip),%rcx
mov    $0x61,%r9d
xor    %eax,%eax
sub    $0x10,%rsp
movl   $0x5,(%rsp)
movq   $0x0,0x8(%rsp)
call   1040 <snprintf@plt>
add    $0x10,%rsp
lea    -0x27(%rbp),%rdi
add    $0x1,%rdi
mov    $0x61,%esi
mov    $0x5,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1050 <index_nrchr@plt>
cltq
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1439 <TEST_index_nrchr+0x2f9>
lea    0xc4f(%rip),%rdi
mov    $0x5ea,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xcbe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xd13(%rip),%rdi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    153e <TEST_index_nrchr+0x3fe>
jmp    143e <TEST_index_nrchr+0x2fe>
jmp    1443 <TEST_index_nrchr+0x303>
lea    -0x27(%rbp),%rsi
add    $0x1,%rsi
lea    0xbb5(%rip),%rdi
mov    $0x61,%edx
mov    $0x5,%ecx
mov    $0x2,%r8d
call   1060 <test_check_format@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    %eax,%esi
lea    -0x27(%rbp),%r8
add    $0x1,%r8
lea    0xb9c(%rip),%rdx
lea    0xbae(%rip),%rcx
mov    $0x61,%r9d
sub    $0x10,%rsp
movl   $0x5,(%rsp)
movq   $0x2,0x8(%rsp)
call   1040 <snprintf@plt>
add    $0x10,%rsp
lea    -0x27(%rbp),%rdi
add    $0x1,%rdi
mov    $0x61,%esi
mov    $0x5,%edx
mov    $0x2,%ecx
call   1050 <index_nrchr@plt>
cltq
mov    %rax,-0x20(%rbp)
cmpq   $0x4,-0x20(%rbp)
je     1526 <TEST_index_nrchr+0x3e6>
lea    0xb63(%rip),%rdi
mov    $0x5ee,%esi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xbd2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xc59(%rip),%rdi
mov    $0x4,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    153e <TEST_index_nrchr+0x3fe>
jmp    152b <TEST_index_nrchr+0x3eb>
jmp    1530 <TEST_index_nrchr+0x3f0>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<TEST_index_nrchr>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e8b(%rip),%rax
mov    (%rax),%r14d
mov    %rsp,%r13
mov    %r14,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
movl   $0x612061,-0x2d(%rbp)
movl   $0x61206120,-0x30(%rbp)
lea    0xe86(%rip),%rdi
lea    -0x30(%rbp),%rbx
mov    %rbx,%rsi
mov    $0x61,%edx
mov    $0x6,%ecx
xor    %r8d,%r8d
call   1060 <test_check_format@plt>
lea    0xe7b(%rip),%rdx
lea    0xe8d(%rip),%rcx
mov    %r13,%rdi
mov    %r14d,%esi
mov    %rbx,%r8
mov    $0x61,%r9d
push   $0x0
push   $0x6
call   1040 <snprintf@plt>
add    $0x10,%rsp
mov    %rbx,%rdi
mov    $0x61,%esi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1050 <index_nrchr@plt>
cmp    $0x1,%eax
jne    12ec <TEST_index_nrchr+0x1ac>
lea    0xe1f(%rip),%rdi
lea    -0x30(%rbp),%rbx
mov    $0x2,%r8d
mov    %rbx,%rsi
mov    $0x61,%edx
mov    $0x6,%ecx
call   1060 <test_check_format@plt>
lea    0xe11(%rip),%rdx
lea    0xe23(%rip),%rcx
mov    %r13,%rdi
mov    %r14d,%esi
mov    %rbx,%r8
mov    $0x61,%r9d
push   $0x2
push   $0x6
call   1040 <snprintf@plt>
add    $0x10,%rsp
mov    $0x2,%ecx
mov    %rbx,%rdi
mov    $0x61,%esi
mov    $0x6,%edx
call   1050 <index_nrchr@plt>
cmp    $0x5,%eax
jne    1321 <TEST_index_nrchr+0x1e1>
lea    -0x2f(%rbp),%r12
lea    0xdae(%rip),%rdi
xor    %r15d,%r15d
mov    %r12,%rsi
mov    $0x61,%edx
mov    $0x5,%ecx
xor    %r8d,%r8d
call   1060 <test_check_format@plt>
lea    0xda4(%rip),%rdx
lea    0xdb6(%rip),%rcx
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r12,%r8
mov    $0x61,%r9d
push   $0x0
push   $0x5
call   1040 <snprintf@plt>
add    $0x10,%rsp
mov    %r12,%rdi
mov    $0x61,%esi
mov    $0x5,%edx
xor    %ecx,%ecx
call   1050 <index_nrchr@plt>
test   %eax,%eax
je     1376 <TEST_index_nrchr+0x236>
movslq %eax,%rbx
lea    0xd80(%rip),%rdi
mov    $0x5ea,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdf3(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
mov    %rbx,%rsi
xor    %edx,%edx
jmp    1357 <TEST_index_nrchr+0x217>
movslq %eax,%rbx
lea    0xd4b(%rip),%rdi
mov    $0x5e2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdbe(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdb0(%rip),%rdi
mov    $0x1,%edx
jmp    1354 <TEST_index_nrchr+0x214>
movslq %eax,%rbx
lea    0xd16(%rip),%rdi
mov    $0x5e6,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd89(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdad(%rip),%rdi
mov    $0x5,%edx
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%r15d
mov    %r15d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc8a(%rip),%rdi
mov    $0x2,%r8d
mov    %r12,%rsi
mov    $0x61,%edx
mov    $0x5,%ecx
call   1060 <test_check_format@plt>
lea    0xc80(%rip),%rdx
lea    0xc92(%rip),%rcx
mov    %r13,%rdi
mov    %r14d,%esi
mov    %r12,%r8
mov    $0x61,%r9d
push   $0x2
push   $0x5
call   1040 <snprintf@plt>
add    $0x10,%rsp
mov    $0x2,%ecx
mov    %r12,%rdi
mov    $0x61,%esi
mov    $0x5,%edx
call   1050 <index_nrchr@plt>
cmp    $0x4,%eax
je     1364 <TEST_index_nrchr+0x224>
movslq %eax,%rbx
lea    0xc5c(%rip),%rdi
mov    $0x5ee,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xccf(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd57(%rip),%rdi
mov    $0x4,%edx
jmp    1354 <TEST_index_nrchr+0x214>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@__const.TEST_index_nrchr.buf = [7 x i8] c" a a a\00"
@.str = [21 x i8] c"\22%s\22, '%c', %zu, %zu\00"
@.str.1 = [25 x i8] c"%s(\22%s\22, '%c', %zu, %zu)\00"
@.str.2 = [12 x i8] c"index_nrchr\00"
@.str.3 = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hadrianw/werf/refs/heads/master/block.c:%d \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [50 x i8] c"\0A\09ret == (size_t)1\0A\09received: %zu\0A\09expected: %zu\0A\00"
@.str.6 = [50 x i8] c"\0A\09ret == (size_t)5\0A\09received: %zu\0A\09expected: %zu\0A\00"
@.str.7 = [50 x i8] c"\0A\09ret == (size_t)0\0A\09received: %zu\0A\09expected: %zu\0A\00"
@.str.8 = [50 x i8] c"\0A\09ret == (size_t)4\0A\09received: %zu\0A\09expected: %zu\0A\00"
define i32 @TEST_index_nrchr() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca [7 x i8]
%6 = alloca i32
%7 = load i32, i32* @BUFSIZ
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %2
%10 = alloca i8, i64 %8
store i64 %8, i64* %3
%11 = bitcast [7 x i8]* %5 to i8*
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%13 = call i64 @test_check_format(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %12, i8 signext 97, i32 6, i64 0)
%14 = trunc i64 %8 to i32
%15 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%16 = call i32 @snprintf(i8* %10, i32 %14, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %15, i8 signext 97, i32 6, i64 0)
%17 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%18 = call i32 @index_nrchr(i8* %17, i8 signext 97, i32 6, i64 0)
%19 = sext i32 %18 to i64
store i64 %19, i64* %4
br label %20
20: ; preds = %0
%21 = load i64, i64* %4
%22 = icmp eq i64 %21, 1
br i1 %22, label %28, label %23
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.3, i64 0, i64 0), i32 1506)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%26 = load i64, i64* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i64 %26, i64 1)
store i32 -1, i32* %1
store i32 1, i32* %6
br label %94
28: ; preds = %20
br label %29
29: ; preds = %28
br label %30
30: ; preds = %29
%31 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%32 = call i64 @test_check_format(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %31, i8 signext 97, i32 6, i64 2)
%33 = trunc i64 %8 to i32
%34 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%35 = call i32 @snprintf(i8* %10, i32 %33, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %34, i8 signext 97, i32 6, i64 2)
%36 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%37 = call i32 @index_nrchr(i8* %36, i8 signext 97, i32 6, i64 2)
%38 = sext i32 %37 to i64
store i64 %38, i64* %4
br label %39
39: ; preds = %30
%40 = load i64, i64* %4
%41 = icmp eq i64 %40, 5
br i1 %41, label %47, label %42
42: ; preds = %39
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.3, i64 0, i64 0), i32 1510)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%45 = load i64, i64* %4
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i64 %45, i64 5)
store i32 -1, i32* %1
store i32 1, i32* %6
br label %94
47: ; preds = %39
br label %48
48: ; preds = %47
br label %49
49: ; preds = %48
%50 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%51 = getelementptr inbounds i8, i8* %50, i64 1
%52 = call i64 @test_check_format(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %51, i8 signext 97, i32 5, i64 0)
%53 = trunc i64 %8 to i32
%54 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%55 = getelementptr inbounds i8, i8* %54, i64 1
%56 = call i32 @snprintf(i8* %10, i32 %53, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %55, i8 signext 97, i32 5, i64 0)
%57 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = call i32 @index_nrchr(i8* %58, i8 signext 97, i32 5, i64 0)
%60 = sext i32 %59 to i64
store i64 %60, i64* %4
br label %61
61: ; preds = %49
%62 = load i64, i64* %4
%63 = icmp eq i64 %62, 0
br i1 %63, label %69, label %64
64: ; preds = %61
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.3, i64 0, i64 0), i32 1514)
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%67 = load i64, i64* %4
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i64 %67, i64 0)
store i32 -1, i32* %1
store i32 1, i32* %6
br label %94
69: ; preds = %61
br label %70
70: ; preds = %69
br label %71
71: ; preds = %70
%72 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%73 = getelementptr inbounds i8, i8* %72, i64 1
%74 = call i64 @test_check_format(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %73, i8 signext 97, i32 5, i64 2)
%75 = trunc i64 %8 to i32
%76 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%77 = getelementptr inbounds i8, i8* %76, i64 1
%78 = call i32 @snprintf(i8* %10, i32 %75, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %77, i8 signext 97, i32 5, i64 2)
%79 = getelementptr inbounds [7 x i8], [7 x i8]* %5, i64 0, i64 0
%80 = getelementptr inbounds i8, i8* %79, i64 1
%81 = call i32 @index_nrchr(i8* %80, i8 signext 97, i32 5, i64 2)
%82 = sext i32 %81 to i64
store i64 %82, i64* %4
br label %83
83: ; preds = %71
%84 = load i64, i64* %4
%85 = icmp eq i64 %84, 4
br i1 %85, label %91, label %86
86: ; preds = %83
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([134 x i8], [134 x i8]* @.str.3, i64 0, i64 0), i32 1518)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %10)
%89 = load i64, i64* %4
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0), i64 %89, i64 4)
store i32 -1, i32* %1
store i32 1, i32* %6
br label %94
91: ; preds = %83
br label %92
92: ; preds = %91
br label %93
93: ; preds = %92
store i32 0, i32* %1
store i32 1, i32* %6
br label %94
94: ; preds = %93, %86, %64, %42, %23
%95 = load i8*, i8** %2
%96 = load i32, i32* %1
ret i32 %96
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@__const.TEST_index_nrchr.buf = [7 x i8] c" a a a\00"
@.str = [21 x i8] c"\22%s\22, '%c', %zu, %zu\00"
@.str.1 = [25 x i8] c"%s(\22%s\22, '%c', %zu, %zu)\00"
@.str.2 = [12 x i8] c"index_nrchr\00"
@.str.3 = [134 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/hadrianw/werf/refs/heads/master/block.c:%d \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [50 x i8] c"\0A\09ret == (size_t)1\0A\09received: %zu\0A\09expected: %zu\0A\00"
@.str.6 = [50 x i8] c"\0A\09ret == (size_t)5\0A\09received: %zu\0A\09expected: %zu\0A\00"
@.str.7 = [50 x i8] c"\0A\09ret == (size_t)0\0A\09received: %zu\0A\09expected: %zu\0A\00"
@.str.8 = [50 x i8] c"\0A\09ret == (size_t)4\0A\09received: %zu\0A\09expected: %zu\0A\00"
define i32 @TEST_index_nrchr() {
%1 = alloca [7 x i8]
%2 = load i32, i32* @BUFSIZ
%3 = zext i32 %2 to i64
%4 = alloca i8, i64 %3
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%6 = call i64 @test_check_format(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext 97, i32 6, i64 0)
%7 = call i32 @snprintf(i8* %4, i32 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %5, i8 signext 97, i32 6, i64 0)
%8 = call i32 @index_nrchr(i8* %5, i8 signext 97, i32 6, i64 0)
%9 = icmp eq i32 %8, 1
br i1 %9, label %15, label %10
10: ; preds = %0
%11 = sext i32 %8 to i64
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([134 x i8], [134 x i8]* @.str.3, i64 0, i64 0), i32 1506)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.5, i64 0, i64 0), i64 %11, i64 1)
br label %46
15: ; preds = %0
%16 = call i64 @test_check_format(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %5, i8 signext 97, i32 6, i64 2)
%17 = call i32 @snprintf(i8* %4, i32 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %5, i8 signext 97, i32 6, i64 2)
%18 = call i32 @index_nrchr(i8* %5, i8 signext 97, i32 6, i64 2)
%19 = icmp eq i32 %18, 5
br i1 %19, label %25, label %20
20: ; preds = %15
%21 = sext i32 %18 to i64
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([134 x i8], [134 x i8]* @.str.3, i64 0, i64 0), i32 1510)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0), i64 %21, i64 5)
br label %46
25: ; preds = %15
%26 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 1
%27 = call i64 @test_check_format(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %26, i8 signext 97, i32 5, i64 0)
%28 = call i32 @snprintf(i8* %4, i32 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %26, i8 signext 97, i32 5, i64 0)
%29 = call i32 @index_nrchr(i8* %26, i8 signext 97, i32 5, i64 0)
%30 = icmp eq i32 %29, 0
br i1 %30, label %36, label %31
31: ; preds = %25
%32 = sext i32 %29 to i64
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([134 x i8], [134 x i8]* @.str.3, i64 0, i64 0), i32 1514)
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i64 %32, i64 0)
br label %46
36: ; preds = %25
%37 = call i64 @test_check_format(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %26, i8 signext 97, i32 5, i64 2)
%38 = call i32 @snprintf(i8* %4, i32 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %26, i8 signext 97, i32 5, i64 2)
%39 = call i32 @index_nrchr(i8* %26, i8 signext 97, i32 5, i64 2)
%40 = icmp eq i32 %39, 4
br i1 %40, label %46, label %41
41: ; preds = %36
%42 = sext i32 %39 to i64
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([134 x i8], [134 x i8]* @.str.3, i64 0, i64 0), i32 1518)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.8, i64 0, i64 0), i64 %42, i64 4)
br label %46
46: ; preds = %36, %41, %31, %20, %10
%47 = phi i32 [ -1, %41 ], [ -1, %31 ], [ -1, %20 ], [ -1, %10 ], [ 0, %36 ]
ret i32 %47
}