#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 evaluate_nand_node(int, int);
int /*<<< orphan*/ printf(char *, ...);
int evaluate_nand_node_test() {
  printf("evaluate_nand_node\n(input1, input2): result\n");
  int i1, i2, i3;
  for (i1 = -1; i1 <= 1; i1++) {
    for (i2 = -1; i2 <= 1; i2++) {
      printf("( %2d, %2d ):\t%2d\n", i1, i2, evaluate_nand_node(i1, i2));
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<evaluate_nand_node_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jg     11a6 <evaluate_nand_node_test+0x86>
movl   $0xffffffff,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1193 <evaluate_nand_node_test+0x73>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <evaluate_nand_node@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114e <evaluate_nand_node_test+0x2e>
jmp    1198 <evaluate_nand_node_test+0x78>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <evaluate_nand_node_test+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evaluate_nand_node_test>:
push   %rbx
lea    0xedb(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
mov    $0xffffffff,%esi
call   1040 <evaluate_nand_node@plt>
lea    0xead(%rip),%rbx
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0xffffffff,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <evaluate_nand_node@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
xor    %edx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1040 <evaluate_nand_node@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x1,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0xffffffff,%esi
call   1040 <evaluate_nand_node@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xffffffff,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1040 <evaluate_nand_node@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1040 <evaluate_nand_node@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0xffffffff,%esi
call   1040 <evaluate_nand_node@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0xffffffff,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <evaluate_nand_node@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %edx,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1040 <evaluate_nand_node@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"evaluate_nand_node\0A(input1, input2): result\0A\00"
@.str.1 = [19 x i8] c"( %2d, %2d ):\09%2d\0A\00"
define i32 @evaluate_nand_node_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %1
br label %5
5: ; preds = %23, %0
%6 = load i32, i32* %1
%7 = icmp sle i32 %6, 1
br i1 %7, label %8, label %26
8: ; preds = %5
store i32 -1, i32* %2
br label %9
9: ; preds = %19, %8
%10 = load i32, i32* %2
%11 = icmp sle i32 %10, 1
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 @evaluate_nand_node(i32 %15, i32 %16)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14, i32 %17)
br label %19
19: ; preds = %12
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %9
22: ; preds = %9
br label %23
23: ; preds = %22
%24 = load i32, i32* %1
%25 = add nsw i32 %24, 1
store i32 %25, i32* %1
br label %5
26: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"( %2d, %2d ):\09%2d\0A\00"
@str = [44 x i8] c"evaluate_nand_node\0A(input1, input2): result\00"
define i32 @evaluate_nand_node_test() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @evaluate_nand_node(i32 -1, i32 -1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 -1, i32 %2)
%4 = tail call i32 @evaluate_nand_node(i32 -1, i32 0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 0, i32 %4)
%6 = tail call i32 @evaluate_nand_node(i32 -1, i32 1)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 -1, i32 1, i32 %6)
%8 = tail call i32 @evaluate_nand_node(i32 0, i32 -1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 -1, i32 %8)
%10 = tail call i32 @evaluate_nand_node(i32 0, i32 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 %10)
%12 = tail call i32 @evaluate_nand_node(i32 0, i32 1)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 1, i32 %12)
%14 = tail call i32 @evaluate_nand_node(i32 1, i32 -1)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 -1, i32 %14)
%16 = tail call i32 @evaluate_nand_node(i32 1, i32 0)
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 0, i32 %16)
%18 = tail call i32 @evaluate_nand_node(i32 1, i32 1)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 1, i32 1, i32 %18)
ret i32 0
}