#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*/ assert(int);
char nondet_char();
int main() {
  unsigned int max = 5;
  char str1[max], str2[max];
  int i, j;
  for (i = 0; i < max; i++) {
    str1[i] = nondet_char();
  }
  str1[max - 1] = '\0';
  j = 0;
  for (i = max - 1; i >= 0; i--) {
    str2[j] = str1[i];
    j++;
  }
  j = max - 1;
  for (i = 0; i < max; i++) {
    assert(str1[i] == str2[j]);
    j--;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-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,-0x38(%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,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    11b0 <main+0x90>
mov    $0x0,%al
call   1040 <nondet_char@plt>
mov    %al,%dl
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1182 <main+0x62>
mov    -0x38(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     1207 <main+0xe7>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x28(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1261 <main+0x141>
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%rax
movslq -0x24(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
movslq -0x28(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1217 <main+0xf7>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <nondet_char@plt>
xor    %eax,%eax
call   1040 <nondet_char@plt>
xor    %eax,%eax
call   1040 <nondet_char@plt>
xor    %eax,%eax
call   1040 <nondet_char@plt>
xor    %eax,%eax
call   1040 <nondet_char@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
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
store i32 0, i32* %1
store i32 5, i32* %2
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i8, i64 %9
store i64 %9, i64* %4
%12 = load i32, i32* %2
%13 = zext i32 %12 to i64
%14 = alloca i8, i64 %13
store i64 %13, i64* %5
store i32 0, i32* %6
br label %15
15: ; preds = %24, %0
%16 = load i32, i32* %6
%17 = load i32, i32* %2
%18 = icmp ult i32 %16, %17
br i1 %18, label %19, label %27
19: ; preds = %15
%20 = call signext i8 (...) @nondet_char()
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %11, i64 %22
store i8 %20, i8* %23
br label %24
24: ; preds = %19
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %15
27: ; preds = %15
%28 = load i32, i32* %2
%29 = sub i32 %28, 1
%30 = zext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %11, i64 %30
store i8 0, i8* %31
store i32 0, i32* %7
%32 = load i32, i32* %2
%33 = sub i32 %32, 1
store i32 %33, i32* %6
br label %34
34: ; preds = %47, %27
%35 = load i32, i32* %6
%36 = icmp sge i32 %35, 0
br i1 %36, label %37, label %50
37: ; preds = %34
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %11, i64 %39
%41 = load i8, i8* %40
%42 = load i32, i32* %7
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %14, i64 %43
store i8 %41, i8* %44
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %47
47: ; preds = %37
%48 = load i32, i32* %6
%49 = add nsw i32 %48, -1
store i32 %49, i32* %6
br label %34
50: ; preds = %34
%51 = load i32, i32* %2
%52 = sub i32 %51, 1
store i32 %52, i32* %7
store i32 0, i32* %6
br label %53
53: ; preds = %73, %50
%54 = load i32, i32* %6
%55 = load i32, i32* %2
%56 = icmp ult i32 %54, %55
br i1 %56, label %57, label %76
57: ; preds = %53
%58 = load i32, i32* %6
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %11, i64 %59
%61 = load i8, i8* %60
%62 = sext i8 %61 to i32
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8, i8* %14, 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 @assert(i32 %69)
%71 = load i32, i32* %7
%72 = add nsw i32 %71, -1
store i32 %72, i32* %7
br label %73
73: ; preds = %57
%74 = load i32, i32* %6
%75 = add nsw i32 %74, 1
store i32 %75, i32* %6
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 signext i8 (...) @nondet_char()
%2 = tail call signext i8 (...) @nondet_char()
%3 = tail call signext i8 (...) @nondet_char()
%4 = tail call signext i8 (...) @nondet_char()
%5 = tail call signext i8 (...) @nondet_char()
%6 = tail call i32 @assert(i32 1)
%7 = tail call i32 @assert(i32 1)
%8 = tail call i32 @assert(i32 1)
%9 = tail call i32 @assert(i32 1)
%10 = tail call i32 @assert(i32 1)
ret i32 0
}