#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*/ __VERIFIER_assert(int);
char __VERIFIER_nondet_char();
int __VERIFIER_nondet_uint();
int main() {
  int MAX = __VERIFIER_nondet_uint();
  char str1[MAX], str2[MAX];
  int cont, i, j;
  cont = 0;
  for (i = 0; i < MAX; i++) {
    str1[i] = __VERIFIER_nondet_char();
  }
  str1[MAX - 1] = '\0';
  j = 0;
  for (i = MAX - 1; i >= 0; i--) {
    str2[j] = str1[0];
    j++;
  }
  j = MAX - 1;
  for (i = 0; i < MAX; i++) {
    __VERIFIER_assert(str1[i] == str2[j]);
    j--;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1050 <__VERIFIER_nondet_uint@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
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    -0x8(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ca <main+0x9a>
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_char@plt>
mov    %al,%dl
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119c <main+0x6c>
mov    -0x40(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     121d <main+0xed>
mov    -0x38(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rcx),%dl
movslq -0x2c(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    11eb <main+0xbb>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1277 <main+0x147>
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%rax
movslq -0x28(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
movslq -0x2c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    122d <main+0xfd>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1060 <__VERIFIER_nondet_uint@plt>
mov    %eax,%r15d
mov    %rsp,%r12
lea    0xf(%r15),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r12
mov    %r12,%rsp
mov    %rsp,%r14
sub    %rcx,%r14
mov    %r14,%rsp
test   %eax,%eax
jle    11e1 <main+0xa1>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_char@plt>
mov    %al,(%r12,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1180 <main+0x40>
movslq %r15d,%rax
movb   $0x0,-0x1(%rax,%r12,1)
test   %r15d,%r15d
jle    11ea <main+0xaa>
mov    (%r12),%esi
mov    %r14,%rdi
mov    %r15,%rdx
call   1040 <memset@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl (%r12),%eax
xor    %edi,%edi
cmp    -0x1(%r14,%r15,1),%al
sete   %dil
call   1050 <__VERIFIER_assert@plt>
add    $0x1,%r12
add    $0xffffffffffffffff,%r15
jne    11c0 <main+0x80>
jmp    11ea <main+0xaa>
movslq %r15d,%rax
movb   $0x0,-0x1(%rax,%r12,1)
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (...) @__VERIFIER_nondet_uint()
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = alloca i8, i64 %11
store i64 %11, i64* %4
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
%16 = alloca i8, i64 %15
store i64 %15, i64* %5
store i32 0, i32* %6
store i32 0, i32* %7
br label %17
17: ; preds = %26, %0
%18 = load i32, i32* %7
%19 = load i32, i32* %2
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = call signext i8 (...) @__VERIFIER_nondet_char()
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %13, i64 %24
store i8 %22, i8* %25
br label %26
26: ; preds = %21
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %17
29: ; preds = %17
%30 = load i32, i32* %2
%31 = sub nsw i32 %30, 1
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %13, i64 %32
store i8 0, i8* %33
store i32 0, i32* %8
%34 = load i32, i32* %2
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %7
br label %36
36: ; preds = %47, %29
%37 = load i32, i32* %7
%38 = icmp sge i32 %37, 0
br i1 %38, label %39, label %50
39: ; preds = %36
%40 = getelementptr inbounds i8, i8* %13, i64 0
%41 = load i8, i8* %40
%42 = load i32, i32* %8
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %16, i64 %43
store i8 %41, i8* %44
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %47
47: ; preds = %39
%48 = load i32, i32* %7
%49 = add nsw i32 %48, -1
store i32 %49, i32* %7
br label %36
50: ; preds = %36
%51 = load i32, i32* %2
%52 = sub nsw i32 %51, 1
store i32 %52, i32* %8
store i32 0, i32* %7
br label %53
53: ; preds = %73, %50
%54 = load i32, i32* %7
%55 = load i32, i32* %2
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %76
57: ; preds = %53
%58 = load i32, i32* %7
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %13, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = load i32, i32* %8
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %16, i64 %64
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp eq i32 %62, %67
%69 = zext i1 %68 to i32
%70 = call i32 @__VERIFIER_assert(i32 %69)
%71 = load i32, i32* %8
%72 = add nsw i32 %71, -1
store i32 %72, i32* %8
br label %73
73: ; preds = %57
%74 = load i32, i32* %7
%75 = add nsw i32 %74, 1
store i32 %75, i32* %7
br label %53
76: ; preds = %53
%77 = load i8*, i8** %3
%78 = load i32, i32* %1
ret i32 %78
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_uint()
%2 = zext i32 %1 to i64
%3 = alloca i8, i64 %2
%4 = alloca i8, i64 %2
%5 = icmp sgt i32 %1, 0
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = add nsw i32 %1, -1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %3, i64 %8
store i8 0, i8* %9
br label %36
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = tail call signext i8 (...) @__VERIFIER_nondet_char()
%13 = getelementptr inbounds i8, i8* %3, i64 %11
store i8 %12, i8* %13
%14 = add nuw nsw i64 %11, 1
%15 = icmp eq i64 %14, %2
br i1 %15, label %16, label %10
16: ; preds = %10
%17 = add nsw i32 %1, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %3, i64 %18
store i8 0, i8* %19
br i1 %5, label %20, label %36
20: ; preds = %16
%21 = load i8, i8* %3
%22 = zext i32 %1 to i64
br label %23
23: ; preds = %20, %23
%24 = phi i64 [ 0, %20 ], [ %34, %23 ]
%25 = phi i64 [ %22, %20 ], [ %26, %23 ]
%26 = add nsw i64 %25, -1
%27 = getelementptr inbounds i8, i8* %3, i64 %24
%28 = load i8, i8* %27
%29 = getelementptr inbounds i8, i8* %4, i64 %26
%30 = load i8, i8* %29
%31 = icmp eq i8 %28, %30
%32 = zext i1 %31 to i32
%33 = tail call i32 @__VERIFIER_assert(i32 %32)
%34 = add nuw nsw i64 %24, 1
%35 = icmp eq i64 %34, %2
br i1 %35, label %36, label %23
36: ; preds = %23, %16, %6
ret i32 0
}