#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 strlen(char *);
int isReverse(char *src, char *dst) {
  int i;
  if (strlen(src) != strlen(dst))
    return 0;
  for (i = 1; i < strlen(dst); i++) {
    if (src[i - 1] != dst[strlen(dst) - i])
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isReverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
cmp    %ecx,%eax
je     114e <isReverse+0x3e>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <isReverse+0xc7>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    11d0 <isReverse+0xc0>
mov    -0x10(%rbp),%rax
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%rcx
mov    %eax,%edx
mov    -0x28(%rbp),%eax
sub    -0x1c(%rbp),%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     11bd <isReverse+0xad>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <isReverse+0xc7>
jmp    11c2 <isReverse+0xb2>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1155 <isReverse+0x45>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isReverse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %r12,%rdi
call   1030 <strlen@plt>
xor    %r15d,%r15d
cmp    %eax,%ebp
jne    1184 <isReverse+0x74>
mov    %r12,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     117e <isReverse+0x6e>
lea    -0x1(%r12),%rbp
mov    $0x1,%ebx
xchg   %ax,%ax
movzbl -0x1(%r14,%rbx,1),%r13d
mov    %r12,%rdi
call   1030 <strlen@plt>
cltq
cmp    0x0(%rbp,%rax,1),%r13b
jne    1184 <isReverse+0x74>
add    $0x1,%rbx
mov    %r12,%rdi
call   1030 <strlen@plt>
cltq
add    $0xffffffffffffffff,%rbp
cmp    %rax,%rbx
jl     1150 <isReverse+0x40>
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isReverse(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
%11 = icmp ne i32 %8, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 0, i32* %3
br label %43
13: ; preds = %2
store i32 1, i32* %6
br label %14
14: ; preds = %39, %13
%15 = load i32, i32* %6
%16 = load i8*, i8** %5
%17 = call i32 @strlen(i8* %16)
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %42
19: ; preds = %14
%20 = load i8*, i8** %4
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = load i8*, i8** %5
%28 = load i8*, i8** %5
%29 = call i32 @strlen(i8* %28)
%30 = load i32, i32* %6
%31 = sub nsw i32 %29, %30
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %27, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp ne i32 %26, %35
br i1 %36, label %37, label %38
37: ; preds = %19
store i32 0, i32* %3
br label %43
38: ; preds = %19
br label %39
39: ; preds = %38
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
br label %14
42: ; preds = %14
store i32 1, i32* %3
br label %43
43: ; preds = %42, %37, %12
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
define i32 @isReverse(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @strlen(i8* %1)
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %25
6: ; preds = %2
%7 = tail call i32 @strlen(i8* %1)
%8 = icmp sgt i32 %7, 1
br i1 %8, label %13, label %25
9: ; preds = %13
%10 = tail call i32 @strlen(i8* %1)
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %24, %11
br i1 %12, label %13, label %25
13: ; preds = %6, %9
%14 = phi i64 [ %24, %9 ], [ 1, %6 ]
%15 = add nsw i64 %14, -1
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = tail call i32 @strlen(i8* %1)
%19 = sext i32 %18 to i64
%20 = sub nsw i64 %19, %14
%21 = getelementptr inbounds i8, i8* %1, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %17, %22
%24 = add nuw nsw i64 %14, 1
br i1 %23, label %9, label %25
25: ; preds = %13, %9, %6, %2
%26 = phi i32 [ 0, %2 ], [ 1, %6 ], [ 0, %13 ], [ 1, %9 ]
ret i32 %26
}