#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 __VERIFIER_nondet_int();
scalar_t__ alloca(int);
int cstrnlen(char *, int);
int main() {
  int length1 = __VERIFIER_nondet_int();
  int n = __VERIFIER_nondet_int();
  if (length1 < 1) {
    length1 = 1;
  }
  if (n < 1) {
    n = 1;
  }
  char *nondetString1 = (char *)alloca(length1 * sizeof(char));
  nondetString1[length1 - 1] = '\0';
  return cstrnlen(nondetString1, n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    1164 <main+0x34>
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    1175 <main+0x45>
movl   $0x1,-0xc(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <cstrnlen@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <__VERIFIER_nondet_int@plt>
test   %ebx,%ebx
mov    $0x1,%ebp
cmovle %ebp,%ebx
test   %eax,%eax
cmovg  %eax,%ebp
mov    %ebx,%edi
call   1040 <alloca@plt>
add    $0xffffffff,%ebx
movb   $0x0,(%rax,%rbx,1)
mov    %rax,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <cstrnlen@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %2
%6 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 1
br i1 %8, label %9, label %10
9: ; preds = %0
store i32 1, i32* %2
br label %10
10: ; preds = %9, %0
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 1, i32* %3
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = mul i64 %16, 1
%18 = trunc i64 %17 to i32
%19 = call i64 @alloca(i32 %18)
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %4
%21 = load i8*, i8** %4
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %21, i64 %24
store i8 0, i8* %25
%26 = load i8*, i8** %4
%27 = load i32, i32* %3
%28 = call i32 @cstrnlen(i8* %26, i32 %27)
ret i32 %28
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = icmp sgt i32 %1, 1
%4 = select i1 %3, i32 %1, i32 1
%5 = icmp sgt i32 %2, 1
%6 = select i1 %5, i32 %2, i32 1
%7 = tail call i64 @alloca(i32 %4)
%8 = inttoptr i64 %7 to i8*
%9 = add nsw i32 %4, -1
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
store i8 0, i8* %11
%12 = tail call i32 @cstrnlen(i8* %8, i32 %6)
ret i32 %12
}