#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*/ sBuf;

/* Variables and functions */
int iTestStrZero(unsigned char *, int);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ vAnd(unsigned char *, unsigned char *, int);
int iTestStrZeroWithMark(unsigned char *psStr, unsigned char *psMark,
                         int iMarkLen) {
  unsigned char sBuf[100];
  int iRet;
  if (iMarkLen > sizeof(sBuf))
    return (1);
  memcpy(sBuf, psStr, iMarkLen);
  vAnd(sBuf, psMark, iMarkLen);
  iRet = iTestStrZero(sBuf, iMarkLen);
  return (iRet);
}


x86 assembly (clang, -O0):
<iTestStrZeroWithMark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    $0x64,%rax
jbe    1160 <iTestStrZeroWithMark+0x30>
movl   $0x1,-0x4(%rbp)
jmp    119b <iTestStrZeroWithMark+0x6b>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <memcpy@plt>
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1050 <vAnd@plt>
lea    -0x80(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1040 <iTestStrZero@plt>
mov    %eax,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iTestStrZeroWithMark>:
mov    $0x1,%eax
cmp    $0x64,%edx
ja     1176 <iTestStrZeroWithMark+0x46>
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1030 <memcpy@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <vAnd@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <iTestStrZero@plt>
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @iTestStrZeroWithMark(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca [100 x i8]
%9 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = icmp ugt i64 %11, 100
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 1, i32* %4
br label %27
14: ; preds = %3
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%16 = load i8*, i8** %5
%17 = load i32, i32* %7
%18 = call i32 @memcpy(i8* %15, i8* %16, i32 %17)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%20 = load i8*, i8** %6
%21 = load i32, i32* %7
%22 = call i32 @vAnd(i8* %19, i8* %20, i32 %21)
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%24 = load i32, i32* %7
%25 = call i32 @iTestStrZero(i8* %23, i32 %24)
store i32 %25, i32* %9
%26 = load i32, i32* %9
store i32 %26, i32* %4
br label %27
27: ; preds = %14, %13
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @iTestStrZeroWithMark(i8* %0, i8* %1, i32 %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = icmp ugt i32 %2, 100
br i1 %6, label %11, label %7
7: ; preds = %3
%8 = call i32 @memcpy(i8* %5, i8* %0, i32 %2)
%9 = call i32 @vAnd(i8* %5, i8* %1, i32 %2)
%10 = call i32 @iTestStrZero(i8* %5, i32 %2)
br label %11
11: ; preds = %3, %7
%12 = phi i32 [ %10, %7 ], [ 1, %3 ]
ret i32 %12
}