#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__ encoding_ascii(char *);
scalar_t__ encoding_utf16(char *);
scalar_t__ encoding_utf8(char *);
int encoding_equiv(char *encoding1, char *encoding2) {
  if (encoding_utf8(encoding1) || encoding_ascii(encoding1)) {
    if (encoding_utf8(encoding2) || encoding_ascii(encoding2))
      return 1;
  } else if (encoding_utf16(encoding1) && encoding_utf16(encoding2))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<encoding_equiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <encoding_utf8@plt>
cmp    $0x0,%rax
jne    1166 <encoding_equiv+0x36>
mov    -0x10(%rbp),%rdi
call   1030 <encoding_ascii@plt>
cmp    $0x0,%rax
je     119d <encoding_equiv+0x6d>
mov    -0x18(%rbp),%rdi
call   1050 <encoding_utf8@plt>
cmp    $0x0,%rax
jne    118c <encoding_equiv+0x5c>
mov    -0x18(%rbp),%rdi
call   1030 <encoding_ascii@plt>
cmp    $0x0,%rax
je     1198 <encoding_equiv+0x68>
movl   $0x1,-0x4(%rbp)
jmp    11db <encoding_equiv+0xab>
jmp    11d4 <encoding_equiv+0xa4>
mov    -0x10(%rbp),%rdi
call   1040 <encoding_utf16@plt>
cmp    $0x0,%rax
je     11cf <encoding_equiv+0x9f>
mov    -0x18(%rbp),%rdi
call   1040 <encoding_utf16@plt>
cmp    $0x0,%rax
je     11cf <encoding_equiv+0x9f>
movl   $0x1,-0x4(%rbp)
jmp    11db <encoding_equiv+0xab>
jmp    11d4 <encoding_equiv+0xa4>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encoding_equiv>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rbp
call   1050 <encoding_utf8@plt>
test   %rax,%rax
jne    1150 <encoding_equiv+0x20>
mov    %rbp,%rdi
call   1030 <encoding_ascii@plt>
test   %rax,%rax
je     1171 <encoding_equiv+0x41>
mov    %rbx,%rdi
call   1050 <encoding_utf8@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1192 <encoding_equiv+0x62>
mov    %rbx,%rdi
call   1030 <encoding_ascii@plt>
test   %rax,%rax
jne    1192 <encoding_equiv+0x62>
jmp    1190 <encoding_equiv+0x60>
mov    %rbp,%rdi
call   1040 <encoding_utf16@plt>
test   %rax,%rax
je     1190 <encoding_equiv+0x60>
mov    %rbx,%rdi
call   1040 <encoding_utf16@plt>
mov    $0x1,%ebp
test   %rax,%rax
jne    1192 <encoding_equiv+0x62>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @encoding_equiv(i8* %0, i8* %1) {
%3 = tail call i64 @encoding_utf8(i8* %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i64 @encoding_ascii(i8* %0)
%7 = icmp eq i64 %6, 0
br i1 %7, label %14, label %8
8: ; preds = %5, %2
%9 = tail call i64 @encoding_utf8(i8* %1)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = tail call i64 @encoding_ascii(i8* %1)
%13 = icmp eq i64 %12, 0
br i1 %13, label %20, label %21
14: ; preds = %5
%15 = tail call i64 @encoding_utf16(i8* %0)
%16 = icmp eq i64 %15, 0
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = tail call i64 @encoding_utf16(i8* %1)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %14, %17, %11
br label %21
21: ; preds = %17, %8, %11, %20
%22 = phi i32 [ 0, %20 ], [ 1, %11 ], [ 1, %8 ], [ 1, %17 ]
ret i32 %22
}