#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*/ strncmp(char *, char *, int);
char toupper(char);
int test_placement(char up, char down, char left, char right) {
  if (!strncmp(&up, &down, 1) || !strncmp(&left, &right, 1))
    return 1;
  up = toupper(up);
  down = toupper(down);
  left = toupper(left);
  right = toupper(right);
  if (!strncmp(&up, &down, 1) && !strncmp(&left, &right, 1))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<test_placement>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x5(%rbp)
mov    %dl,-0x6(%rbp)
mov    %cl,-0x7(%rbp)
mov    %al,-0x8(%rbp)
lea    -0x5(%rbp),%rdi
lea    -0x6(%rbp),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
je     1175 <test_placement+0x55>
lea    -0x7(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1181 <test_placement+0x61>
movl   $0x1,-0x4(%rbp)
jmp    11fa <test_placement+0xda>
movsbl -0x5(%rbp),%edi
call   1040 <toupper@plt>
mov    %al,-0x5(%rbp)
movsbl -0x6(%rbp),%edi
call   1040 <toupper@plt>
mov    %al,-0x6(%rbp)
movsbl -0x7(%rbp),%edi
call   1040 <toupper@plt>
mov    %al,-0x7(%rbp)
movsbl -0x8(%rbp),%edi
call   1040 <toupper@plt>
mov    %al,-0x8(%rbp)
lea    -0x5(%rbp),%rdi
lea    -0x6(%rbp),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11f3 <test_placement+0xd3>
lea    -0x7(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    11f3 <test_placement+0xd3>
movl   $0x0,-0x4(%rbp)
jmp    11fa <test_placement+0xda>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_placement>:
push   %rbx
sub    $0x10,%rsp
mov    %dil,0xf(%rsp)
mov    %sil,0xe(%rsp)
mov    %dl,0xd(%rsp)
mov    %cl,0xc(%rsp)
lea    0xf(%rsp),%rdi
lea    0xe(%rsp),%rsi
mov    $0x1,%ebx
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11e4 <test_placement+0xc4>
lea    0xd(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x1,%ebx
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     11e4 <test_placement+0xc4>
movsbl 0xf(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0xf(%rsp)
movsbl 0xe(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0xe(%rsp)
movsbl 0xd(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0xd(%rsp)
movsbl 0xc(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0xc(%rsp)
lea    0xf(%rsp),%rdi
lea    0xe(%rsp),%rsi
mov    $0x1,%ebx
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    11e4 <test_placement+0xc4>
lea    0xd(%rsp),%rdi
lea    0xc(%rsp),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    11e4 <test_placement+0xc4>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @test_placement(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = alloca i32
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8 %0, i8* %6
store i8 %1, i8* %7
store i8 %2, i8* %8
store i8 %3, i8* %9
%10 = call i32 @strncmp(i8* %6, i8* %7, i32 1)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = call i32 @strncmp(i8* %8, i8* %9, i32 1)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %12, %4
store i32 1, i32* %5
br label %32
16: ; preds = %12
%17 = load i8, i8* %6
%18 = call signext i8 @toupper(i8 signext %17)
store i8 %18, i8* %6
%19 = load i8, i8* %7
%20 = call signext i8 @toupper(i8 signext %19)
store i8 %20, i8* %7
%21 = load i8, i8* %8
%22 = call signext i8 @toupper(i8 signext %21)
store i8 %22, i8* %8
%23 = load i8, i8* %9
%24 = call signext i8 @toupper(i8 signext %23)
store i8 %24, i8* %9
%25 = call i32 @strncmp(i8* %6, i8* %7, i32 1)
%26 = icmp ne i32 %25, 0
br i1 %26, label %31, label %27
27: ; preds = %16
%28 = call i32 @strncmp(i8* %8, i8* %9, i32 1)
%29 = icmp ne i32 %28, 0
br i1 %29, label %31, label %30
30: ; preds = %27
store i32 0, i32* %5
br label %32
31: ; preds = %27, %16
store i32 1, i32* %5
br label %32
32: ; preds = %31, %30, %15
%33 = load i32, i32* %5
ret i32 %33
}

LLVM IR (-O2):
define i32 @test_placement(i8 signext %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8 %3, i8* %8
%9 = call i32 @strncmp(i8* %5, i8* %6, i32 1)
%10 = icmp eq i32 %9, 0
br i1 %10, label %29, label %11
11: ; preds = %4
%12 = call i32 @strncmp(i8* %7, i8* %8, i32 1)
%13 = icmp eq i32 %12, 0
br i1 %13, label %29, label %14
14: ; preds = %11
%15 = load i8, i8* %5
%16 = call signext i8 @toupper(i8 signext %15)
store i8 %16, i8* %5
%17 = load i8, i8* %6
%18 = call signext i8 @toupper(i8 signext %17)
store i8 %18, i8* %6
%19 = load i8, i8* %7
%20 = call signext i8 @toupper(i8 signext %19)
store i8 %20, i8* %7
%21 = load i8, i8* %8
%22 = call signext i8 @toupper(i8 signext %21)
store i8 %22, i8* %8
%23 = call i32 @strncmp(i8* %5, i8* %6, i32 1)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %14
%26 = call i32 @strncmp(i8* %7, i8* %8, i32 1)
%27 = icmp eq i32 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %25, %14
br label %29
29: ; preds = %25, %4, %11, %28
%30 = phi i32 [ 1, %28 ], [ 1, %11 ], [ 1, %4 ], [ 0, %25 ]
ret i32 %30
}