#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 */
scalar_t__ is_palindrome(char *);
int /*<<< orphan*/ log_fail();
int /*<<< orphan*/ log_pass();
int /*<<< orphan*/ printf(char *);
int main() {
  char *ptr = "Vikiv";
  char *ptr2 = "VikiV";
  printf("Starting palindrome test 0.\n");
  if (is_palindrome(ptr)) {
    log_fail();
    return -1;
  } else {
    log_pass();
  }
  if (is_palindrome(ptr2)) {
    log_pass();
  } else {
    log_fail();
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xea5(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     1197 <main+0x57>
mov    $0x0,%al
call   1060 <log_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d7 <main+0x97>
mov    $0x0,%al
call   1050 <log_pass@plt>
mov    -0x18(%rbp),%rdi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     11bd <main+0x7d>
mov    $0x0,%al
call   1050 <log_pass@plt>
jmp    11d0 <main+0x90>
mov    $0x0,%al
call   1060 <log_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d7 <main+0x97>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
lea    0xeac(%rip),%rdi
call   1040 <is_palindrome@plt>
test   %rax,%rax
je     116c <main+0x2c>
xor    %eax,%eax
call   1060 <log_fail@plt>
mov    $0xffffffff,%ebx
jmp    118d <main+0x4d>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <log_pass@plt>
lea    0xe8a(%rip),%rdi
call   1040 <is_palindrome@plt>
test   %rax,%rax
je     115e <main+0x1e>
xor    %eax,%eax
call   1050 <log_pass@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"Vikiv\00"
@.str.1 = [6 x i8] c"VikiV\00"
@.str.2 = [29 x i8] c"Starting palindrome test 0.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %3
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i64 @is_palindrome(i8* %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (...) @log_fail()
store i32 -1, i32* %1
br label %21
10: ; preds = %0
%11 = call i32 (...) @log_pass()
br label %12
12: ; preds = %10
%13 = load i8*, i8** %3
%14 = call i64 @is_palindrome(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (...) @log_pass()
br label %20
18: ; preds = %12
%19 = call i32 (...) @log_fail()
store i32 -1, i32* %1
br label %21
20: ; preds = %16
store i32 0, i32* %1
br label %21
21: ; preds = %20, %18, %8
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [6 x i8] c"Vikiv\00"
@.str.1 = [6 x i8] c"VikiV\00"
@str = [28 x i8] c"Starting palindrome test 0.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 @is_palindrome(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 (...) @log_fail()
br label %14
6: ; preds = %0
%7 = tail call i32 (...) @log_pass()
%8 = tail call i64 @is_palindrome(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6
%11 = tail call i32 (...) @log_pass()
br label %14
12: ; preds = %6
%13 = tail call i32 (...) @log_fail()
br label %14
14: ; preds = %10, %12, %4
%15 = phi i32 [ -1, %4 ], [ 0, %10 ], [ -1, %12 ]
ret i32 %15
}