#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*/ cmd2;
typedef int /*<<< orphan*/ cmd1;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int read(int /*<<< orphan*/, unsigned int *, int);
int main(int argc, char *argv[], char *envp[]) {
  unsigned int cmd1, cmd2;
  unsigned int cmdChanged = 0;
  if (read(0, &cmd1, sizeof(cmd1)) != sizeof(cmd1)) {
    printf("Error reading stdin!");
    exit(-1);
  }
  if (read(0, &cmd2, sizeof(cmd2)) != sizeof(cmd2)) {
    printf("Error reading stdin!");
    exit(-1);
  }
  if (cmd1 > 0x41) {
    cmdChanged = cmd1 - 0x42;
  }
  if (cmd2 < 0x41) {
    cmdChanged = cmd2 + 0x42;
  }
  if (cmdChanged == 0)
    printf("equal\n");
  else
    printf("not equal\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
xor    %edi,%edi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
cltq
cmp    $0x4,%rax
je     1183 <main+0x53>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
xor    %edi,%edi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1040 <read@plt>
cltq
cmp    $0x4,%rax
je     11b5 <main+0x85>
lea    0xe5a(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
cmpl   $0x41,-0x1c(%rbp)
jbe    11c8 <main+0x98>
mov    -0x1c(%rbp),%eax
sub    $0x42,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x41,-0x20(%rbp)
jae    11db <main+0xab>
mov    -0x20(%rbp),%eax
add    $0x42,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11f6 <main+0xc6>
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
jmp    1202 <main+0xd2>
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1050 <read@plt>
cmp    $0x4,%eax
jne    11ae <main+0x6e>
xor    %ebx,%ebx
lea    0x8(%rsp),%rsi
xor    %edi,%edi
mov    $0x4,%edx
call   1050 <read@plt>
cmp    $0x4,%eax
jne    11ae <main+0x6e>
mov    0xc(%rsp),%eax
lea    -0x42(%rax),%ecx
cmp    $0x42,%eax
cmovb  %ebx,%ecx
mov    0x8(%rsp),%eax
lea    0x42(%rax),%edx
cmp    $0x41,%eax
cmovae %ecx,%edx
test   %edx,%edx
lea    0xe83(%rip),%rax
lea    0xe78(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Error reading stdin!\00"
@.str.1 = [7 x i8] c"equal\0A\00"
@.str.2 = [11 x i8] c"not equal\0A\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i32 0, i32* %10
%11 = call i32 @read(i32 0, i32* %8, i32 4)
%12 = sext i32 %11 to i64
%13 = icmp ne i64 %12, 4
br i1 %13, label %14, label %17
14: ; preds = %3
%15 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %3
%18 = call i32 @read(i32 0, i32* %9, i32 4)
%19 = sext i32 %18 to i64
%20 = icmp ne i64 %19, 4
br i1 %20, label %21, label %24
21: ; preds = %17
%22 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %17
%25 = load i32, i32* %8
%26 = icmp ugt i32 %25, 65
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %8
%29 = sub i32 %28, 66
store i32 %29, i32* %10
br label %30
30: ; preds = %27, %24
%31 = load i32, i32* %9
%32 = icmp ult i32 %31, 65
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %9
%35 = add i32 %34, 66
store i32 %35, i32* %10
br label %36
36: ; preds = %33, %30
%37 = load i32, i32* %10
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %43
41: ; preds = %36
%42 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Error reading stdin!\00"
@str = [10 x i8] c"not equal\00"
@str.3 = [6 x i8] c"equal\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = call i32 @read(i32 0, i32* %4, i32 4)
%9 = icmp eq i32 %8, 4
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 -1)
unreachable
13: ; preds = %3
%14 = call i32 @read(i32 0, i32* %5, i32 4)
%15 = icmp eq i32 %14, 4
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 @exit(i32 -1)
unreachable
19: ; preds = %13
%20 = load i32, i32* %4
%21 = icmp ugt i32 %20, 65
%22 = add i32 %20, -66
%23 = select i1 %21, i32 %22, i32 0
%24 = load i32, i32* %5
%25 = icmp ult i32 %24, 65
%26 = add i32 %24, 66
%27 = select i1 %25, i32 %26, i32 %23
%28 = icmp eq i32 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0)
%30 = tail call i32 @puts(i8* dereferenceable(1) %29)
ret i32 0
}