#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*/ _throw_arraybounds_fn(char const *, unsigned int);
int /*<<< orphan*/ _throw_null_fn(char const *, unsigned int);
char *_zero_arr_plus_char_fn(char *orig_x, unsigned int orig_sz, int orig_i,
                             const char *filename, unsigned lineno) {
  {
    char *__orig_x = (char *)(orig_x);
    unsigned int _czs_temp;
    if ((__orig_x) == 0)
      _throw_null_fn(filename, lineno);
    if (orig_i < 0 || orig_sz == 0)
      _throw_arraybounds_fn(filename, lineno);
    for (_czs_temp = orig_sz - 1; _czs_temp < orig_i; _czs_temp++)
      if (__orig_x[_czs_temp] == 0)
        _throw_arraybounds_fn(filename, lineno);
    return __orig_x + orig_i;
  };
}


x86 assembly (clang, -O0):
<_zero_arr_plus_char_fn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1159 <_zero_arr_plus_char_fn+0x39>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <_throw_null_fn@plt>
cmpl   $0x0,-0x10(%rbp)
jl     116d <_zero_arr_plus_char_fn+0x4d>
cmpl   $0x0,-0xc(%rbp)
jne    1179 <_zero_arr_plus_char_fn+0x59>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <_throw_arraybounds_fn@plt>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    11c1 <_zero_arr_plus_char_fn+0xa1>
mov    -0x28(%rbp),%rax
mov    -0x2c(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11ae <_zero_arr_plus_char_fn+0x8e>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <_throw_arraybounds_fn@plt>
jmp    11b3 <_zero_arr_plus_char_fn+0x93>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1182 <_zero_arr_plus_char_fn+0x62>
mov    -0x28(%rbp),%rax
movslq -0x10(%rbp),%rcx
add    %rcx,%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_zero_arr_plus_char_fn>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %rcx,%r12
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r13
test   %rdi,%rdi
je     1144 <_zero_arr_plus_char_fn+0x24>
test   %ebp,%ebp
jne    1153 <_zero_arr_plus_char_fn+0x33>
jmp    1158 <_zero_arr_plus_char_fn+0x38>
mov    %r12,%rdi
mov    %r15d,%esi
call   1030 <_throw_null_fn@plt>
test   %ebp,%ebp
je     1158 <_zero_arr_plus_char_fn+0x38>
test   %r14d,%r14d
jns    1163 <_zero_arr_plus_char_fn+0x43>
mov    %r12,%rdi
mov    %r15d,%esi
call   1040 <_throw_arraybounds_fn@plt>
add    $0xffffffff,%ebp
cmp    %r14d,%ebp
jae    119d <_zero_arr_plus_char_fn+0x7d>
mov    %ebp,%ebp
mov    %r14d,%ebx
jmp    1188 <_zero_arr_plus_char_fn+0x68>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    %ebp,%ebx
je     119d <_zero_arr_plus_char_fn+0x7d>
cmpb   $0x0,0x0(%r13,%rbp,1)
jne    1180 <_zero_arr_plus_char_fn+0x60>
mov    %r12,%rdi
mov    %r15d,%esi
call   1040 <_throw_arraybounds_fn@plt>
jmp    1180 <_zero_arr_plus_char_fn+0x60>
movslq %r14d,%rax
add    %rax,%r13
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i8* @_zero_arr_plus_char_fn(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%13 = load i8*, i8** %6
store i8* %13, i8** %11
%14 = load i8*, i8** %11
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %20
16: ; preds = %5
%17 = load i8*, i8** %9
%18 = load i32, i32* %10
%19 = call i32 @_throw_null_fn(i8* %17, i32 %18)
br label %20
20: ; preds = %16, %5
%21 = load i32, i32* %8
%22 = icmp slt i32 %21, 0
br i1 %22, label %26, label %23
23: ; preds = %20
%24 = load i32, i32* %7
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23, %20
%27 = load i8*, i8** %9
%28 = load i32, i32* %10
%29 = call i32 @_throw_arraybounds_fn(i8* %27, i32 %28)
br label %30
30: ; preds = %26, %23
%31 = load i32, i32* %7
%32 = sub i32 %31, 1
store i32 %32, i32* %12
br label %33
33: ; preds = %50, %30
%34 = load i32, i32* %12
%35 = load i32, i32* %8
%36 = icmp ult i32 %34, %35
br i1 %36, label %37, label %53
37: ; preds = %33
%38 = load i8*, i8** %11
%39 = load i32, i32* %12
%40 = zext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %49
45: ; preds = %37
%46 = load i8*, i8** %9
%47 = load i32, i32* %10
%48 = call i32 @_throw_arraybounds_fn(i8* %46, i32 %47)
br label %49
49: ; preds = %45, %37
br label %50
50: ; preds = %49
%51 = load i32, i32* %12
%52 = add i32 %51, 1
store i32 %52, i32* %12
br label %33
53: ; preds = %33
%54 = load i8*, i8** %11
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %54, i64 %56
ret i8* %57
}

LLVM IR (-O2):
define i8* @_zero_arr_plus_char_fn(i8* %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = icmp eq i8* %0, null
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @_throw_null_fn(i8* %3, i32 %4)
br label %9
9: ; preds = %7, %5
%10 = icmp slt i32 %2, 0
%11 = icmp eq i32 %1, 0
%12 = or i1 %11, %10
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @_throw_arraybounds_fn(i8* %3, i32 %4)
br label %15
15: ; preds = %9, %13
%16 = add i32 %1, -1
%17 = icmp ult i32 %16, %2
br i1 %17, label %18, label %31
18: ; preds = %15
%19 = zext i32 %16 to i64
br label %20
20: ; preds = %18, %27
%21 = phi i64 [ %19, %18 ], [ %28, %27 ]
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = tail call i32 @_throw_arraybounds_fn(i8* %3, i32 %4)
br label %27
27: ; preds = %20, %25
%28 = add nuw nsw i64 %21, 1
%29 = trunc i64 %28 to i32
%30 = icmp eq i32 %29, %2
br i1 %30, label %31, label %20
31: ; preds = %27, %15
%32 = sext i32 %2 to i64
%33 = getelementptr inbounds i8, i8* %0, i64 %32
ret i8* %33
}