#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 /*<<< orphan*/ cmemrchr(char *, int, int);
int main() {
  int length = __VERIFIER_nondet_int();
  int n = __VERIFIER_nondet_int();
  int c = __VERIFIER_nondet_int();
  if (length < 1) {
    length = 1;
  }
  if (n < 1) {
    n = 1;
  }
  char *nondetArea = (char *)alloca(n * sizeof(char));
  cmemrchr(nondetArea, c, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    116e <main+0x3e>
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0xc(%rbp)
jge    117f <main+0x4f>
movl   $0x1,-0xc(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1050 <cmemrchr@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%r14d
test   %ebx,%ebx
mov    $0x1,%ebp
cmovg  %ebx,%ebp
mov    %ebp,%edi
call   1030 <alloca@plt>
mov    %rax,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
call   1050 <cmemrchr@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = tail call i32 (...) @__VERIFIER_nondet_int()
%4 = icmp sgt i32 %2, 1
%5 = select i1 %4, i32 %2, i32 1
%6 = tail call i64 @alloca(i32 %5)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @cmemrchr(i8* %7, i32 %3, i32 %5)
ret i32 0
}