#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int validate_input(int nleft, int nright) {
  if (!nleft || !nright) {
    fprintf(stderr,
            "ERROR: At least one of the input files contains no records.\n");
    return (0);
  }
  if (nleft != nright) {
    fprintf(
        stderr,
        "ERROR: Number of records in the two input files does not match.\n");
    return (0);
  }
  return (1);
}


x86 assembly (clang, -O0):
<validate_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1132 <validate_input+0x22>
cmpl   $0x0,-0xc(%rbp)
jne    1153 <validate_input+0x43>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1187 <validate_input+0x77>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1180 <validate_input+0x70>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xece(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1187 <validate_input+0x77>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_input>:
mov    %esi,%ecx
lea    0xee7(%rip),%rsi
test   %edi,%edi
je     1131 <validate_input+0x21>
test   %ecx,%ecx
je     1131 <validate_input+0x21>
mov    $0x1,%eax
cmp    %ecx,%edi
je     1146 <validate_input+0x36>
lea    0xf0c(%rip),%rsi
push   %rax
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [61 x i8] c"ERROR: At least one of the input files contains no records.\0A\00"
@.str.1 = [65 x i8] c"ERROR: Number of records in the two input files does not match.\0A\00"
define i32 @validate_input(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8, %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %22
14: ; preds = %8
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %3
br label %22
21: ; preds = %14
store i32 1, i32* %3
br label %22
22: ; preds = %21, %18, %11
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [61 x i8] c"ERROR: At least one of the input files contains no records.\0A\00"
@.str.1 = [65 x i8] c"ERROR: Number of records in the two input files does not match.\0A\00"
define i32 @validate_input(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, 0
%4 = icmp ne i32 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = icmp eq i32 %0, %1
br i1 %7, label %12, label %8
8: ; preds = %6, %2
%9 = phi i8* [ getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), %6 ]
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* %9)
br label %12
12: ; preds = %8, %6
%13 = phi i32 [ 1, %6 ], [ 0, %8 ]
ret i32 %13
}