#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 */
typedef int /*<<< orphan*/ str_palin;
typedef int /*<<< orphan*/ str_nonpalin;

/* Variables and functions */
scalar_t__ is_palindrome(char *);
int /*<<< orphan*/ log_fail();
int /*<<< orphan*/ log_pass();
int main() {
  char *str_palin[] = {"abcba", "qwertytrewq", "zxcvbvcxz"};
  char *str_nonpalin[] = {"asdfghj", "poqwert"};
  for (int i = 0; i < (sizeof(str_palin) / sizeof(str_palin[0])); i++) {
    if (!is_palindrome(str_palin[i])) {
      log_fail();
      return -1;
    }
  }
  for (int i = 0; i < (sizeof(str_nonpalin) / sizeof(str_nonpalin[0])); i++) {
    if (is_palindrome(str_nonpalin[i])) {
      log_fail();
      return -1;
    }
  }
  log_pass();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2caa(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2ca7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0x2ca4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ca9(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2ca6(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x34(%rbp)
movslq -0x34(%rbp),%rax
cmp    $0x3,%rax
jae    11c9 <main+0x99>
movslq -0x34(%rbp),%rax
mov    -0x20(%rbp,%rax,8),%rdi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
jne    11b6 <main+0x86>
mov    $0x0,%al
call   1050 <log_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    122a <main+0xfa>
jmp    11bb <main+0x8b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117d <main+0x4d>
movl   $0x0,-0x38(%rbp)
movslq -0x38(%rbp),%rax
cmp    $0x2,%rax
jae    121c <main+0xec>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rdi
call   1030 <is_palindrome@plt>
cmp    $0x0,%rax
je     1209 <main+0xd9>
mov    $0x0,%al
call   1050 <log_fail@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    122a <main+0xfa>
jmp    120e <main+0xde>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    11d0 <main+0xa0>
mov    $0x0,%al
call   1040 <log_pass@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <is_palindrome@plt>
test   %rax,%rax
je     1186 <main+0x56>
lea    0xebd(%rip),%rdi
call   1030 <is_palindrome@plt>
test   %rax,%rax
je     1186 <main+0x56>
lea    0xeb8(%rip),%rdi
call   1030 <is_palindrome@plt>
test   %rax,%rax
je     1186 <main+0x56>
lea    0xeb1(%rip),%rdi
call   1030 <is_palindrome@plt>
test   %rax,%rax
jne    1186 <main+0x56>
lea    0xea8(%rip),%rdi
call   1030 <is_palindrome@plt>
test   %rax,%rax
je     1196 <main+0x66>
xor    %eax,%eax
call   1050 <log_fail@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <log_pass@plt>
jmp    1192 <main+0x62>

LLVM IR (-O0):
@.str = [6 x i8] c"abcba\00"
@.str.1 = [12 x i8] c"qwertytrewq\00"
@.str.2 = [10 x i8] c"zxcvbvcxz\00"
@__const.main.str_palin = [3 x i8*] [i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i32 0, i32 0)]
@.str.3 = [8 x i8] c"asdfghj\00"
@.str.4 = [8 x i8] c"poqwert\00"
@__const.main.str_nonpalin = [2 x i8*] [i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i32 0, i32 0)]
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8*]
%3 = alloca [2 x i8*]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [3 x i8*]* %2 to i8*
%7 = bitcast [2 x i8*]* %3 to i8*
store i32 0, i32* %4
br label %8
8: ; preds = %22, %0
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = icmp ult i64 %10, 3
br i1 %11, label %12, label %25
12: ; preds = %8
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [3 x i8*], [3 x i8*]* %2, i64 0, i64 %14
%16 = load i8*, i8** %15
%17 = call i64 @is_palindrome(i8* %16)
%18 = icmp ne i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %12
%20 = call i32 (...) @log_fail()
store i32 -1, i32* %1
br label %45
21: ; preds = %12
br label %22
22: ; preds = %21
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %8
25: ; preds = %8
store i32 0, i32* %5
br label %26
26: ; preds = %40, %25
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = icmp ult i64 %28, 2
br i1 %29, label %30, label %43
30: ; preds = %26
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [2 x i8*], [2 x i8*]* %3, i64 0, i64 %32
%34 = load i8*, i8** %33
%35 = call i64 @is_palindrome(i8* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %30
%38 = call i32 (...) @log_fail()
store i32 -1, i32* %1
br label %45
39: ; preds = %30
br label %40
40: ; preds = %39
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %26
43: ; preds = %26
%44 = call i32 (...) @log_pass()
store i32 0, i32* %1
br label %45
45: ; preds = %43, %37, %19
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [6 x i8] c"abcba\00"
@.str.1 = [12 x i8] c"qwertytrewq\00"
@.str.2 = [10 x i8] c"zxcvbvcxz\00"
@.str.3 = [8 x i8] c"asdfghj\00"
@.str.4 = [8 x i8] c"poqwert\00"
define i32 @main() {
%1 = tail call i64 @is_palindrome(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %12, label %3
3: ; preds = %0
%4 = tail call i64 @is_palindrome(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = tail call i64 @is_palindrome(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i64 @is_palindrome(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %14, label %19
12: ; preds = %6, %3, %0
%13 = tail call i32 (...) @log_fail()
br label %21
14: ; preds = %9
%15 = tail call i64 @is_palindrome(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 (...) @log_pass()
br label %21
19: ; preds = %14, %9
%20 = tail call i32 (...) @log_fail()
br label %21
21: ; preds = %19, %12, %17
%22 = phi i32 [ 0, %17 ], [ -1, %12 ], [ -1, %19 ]
ret i32 %22
}