#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 */
char toupper(char);
int check_watson_crick(char a, char b) {
  a = toupper(a);
  b = toupper(b);
  if (a == 'A')
    if (b == 'T')
      return 1;
    else
      return 0;
  else if (a == 'T')
    if (b == 'A')
      return 1;
    else
      return 0;
  else if (a == 'G')
    if (b == 'C')
      return 1;
    else
      return 0;
  else if (a == 'C')
    if (b == 'G')
      return 1;
    else
      return 0;
  else
    return 0;
}


x86 assembly (clang, -O0):
<check_watson_crick>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x5(%rbp)
movsbl -0x6(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x41,%eax
jne    116e <check_watson_crick+0x5e>
movsbl -0x6(%rbp),%eax
cmp    $0x54,%eax
jne    1162 <check_watson_crick+0x52>
movl   $0x1,-0x4(%rbp)
jmp    120b <check_watson_crick+0xfb>
movl   $0x0,-0x4(%rbp)
jmp    120b <check_watson_crick+0xfb>
movsbl -0x5(%rbp),%eax
cmp    $0x54,%eax
jne    11a0 <check_watson_crick+0x90>
movsbl -0x6(%rbp),%eax
cmp    $0x41,%eax
jne    1194 <check_watson_crick+0x84>
movl   $0x1,-0x4(%rbp)
jmp    120b <check_watson_crick+0xfb>
movl   $0x0,-0x4(%rbp)
jmp    120b <check_watson_crick+0xfb>
movsbl -0x5(%rbp),%eax
cmp    $0x47,%eax
jne    11d2 <check_watson_crick+0xc2>
movsbl -0x6(%rbp),%eax
cmp    $0x43,%eax
jne    11c6 <check_watson_crick+0xb6>
movl   $0x1,-0x4(%rbp)
jmp    120b <check_watson_crick+0xfb>
movl   $0x0,-0x4(%rbp)
jmp    120b <check_watson_crick+0xfb>
movsbl -0x5(%rbp),%eax
cmp    $0x43,%eax
jne    1204 <check_watson_crick+0xf4>
movsbl -0x6(%rbp),%eax
cmp    $0x47,%eax
jne    11f8 <check_watson_crick+0xe8>
movl   $0x1,-0x4(%rbp)
jmp    120b <check_watson_crick+0xfb>
movl   $0x0,-0x4(%rbp)
jmp    120b <check_watson_crick+0xfb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_watson_crick>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <toupper@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1030 <toupper@plt>
xor    %ecx,%ecx
add    $0xbf,%bl
cmp    $0x13,%bl
ja     1151 <check_watson_crick+0x41>
movzbl %bl,%edx
lea    0xec9(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
cmp    $0x54,%al
jmp    114e <check_watson_crick+0x3e>
cmp    $0x47,%al
jmp    114e <check_watson_crick+0x3e>
cmp    $0x43,%al
jmp    114e <check_watson_crick+0x3e>
cmp    $0x41,%al
sete   %cl
movzbl %cl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @check_watson_crick(i8 signext %0, i8 signext %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 signext i8 @toupper(i8 signext %6)
store i8 %7, i8* %4
%8 = load i8, i8* %5
%9 = call signext i8 @toupper(i8 signext %8)
store i8 %9, i8* %5
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 65
br i1 %12, label %13, label %19
13: ; preds = %2
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 84
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 1, i32* %3
br label %50
18: ; preds = %13
store i32 0, i32* %3
br label %50
19: ; preds = %2
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 84
br i1 %22, label %23, label %29
23: ; preds = %19
%24 = load i8, i8* %5
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 65
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 1, i32* %3
br label %50
28: ; preds = %23
store i32 0, i32* %3
br label %50
29: ; preds = %19
%30 = load i8, i8* %4
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 71
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = load i8, i8* %5
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 67
br i1 %36, label %37, label %38
37: ; preds = %33
store i32 1, i32* %3
br label %50
38: ; preds = %33
store i32 0, i32* %3
br label %50
39: ; preds = %29
%40 = load i8, i8* %4
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 67
br i1 %42, label %43, label %49
43: ; preds = %39
%44 = load i8, i8* %5
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 71
br i1 %46, label %47, label %48
47: ; preds = %43
store i32 1, i32* %3
br label %50
48: ; preds = %43
store i32 0, i32* %3
br label %50
49: ; preds = %39
store i32 0, i32* %3
br label %50
50: ; preds = %49, %48, %47, %38, %37, %28, %27, %18, %17
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
define i32 @check_watson_crick(i8 signext %0, i8 signext %1) {
%3 = tail call signext i8 @toupper(i8 signext %0)
%4 = tail call signext i8 @toupper(i8 signext %1)
switch i8 %3, label %13 [
i8 65, label %5
i8 84, label %7
i8 71, label %9
i8 67, label %11
]
5: ; preds = %2
%6 = icmp eq i8 %4, 84
br label %13
7: ; preds = %2
%8 = icmp eq i8 %4, 65
br label %13
9: ; preds = %2
%10 = icmp eq i8 %4, 67
br label %13
11: ; preds = %2
%12 = icmp eq i8 %4, 71
br label %13
13: ; preds = %2, %11, %9, %7, %5
%14 = phi i1 [ %6, %5 ], [ %8, %7 ], [ %10, %9 ], [ %12, %11 ], [ false, %2 ]
%15 = zext i1 %14 to i32
ret i32 %15
}