#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 invhex(int);
int invpen(int);
int invtri(int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int is_n_answer(int n) {
  int T = invtri(n);
  int P = invpen(n);
  int H = invhex(n);
  if (H && P)
    printf("is_n_answer: n:%d T:%d P:%d H:%d\n", n, T, P, H);
  if (T && P && H) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<is_n_answer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <invtri@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <invpen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <invhex@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1199 <is_n_answer+0x59>
cmpl   $0x0,-0x10(%rbp)
je     1199 <is_n_answer+0x59>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe6c(%rip),%rdi
call   1050 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
je     11c3 <is_n_answer+0x83>
cmpl   $0x0,-0x10(%rbp)
je     11c3 <is_n_answer+0x83>
cmpl   $0x0,-0x14(%rbp)
je     11c3 <is_n_answer+0x83>
movl   $0x1,-0x4(%rbp)
jmp    11ca <is_n_answer+0x8a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_n_answer>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebp
call   1030 <invtri@plt>
mov    %eax,%r14d
mov    %ebp,%edi
call   1060 <invpen@plt>
mov    %eax,%r15d
mov    %ebp,%edi
call   1040 <invhex@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1184 <is_n_answer+0x44>
test   %r15d,%r15d
je     1184 <is_n_answer+0x44>
lea    0xe8c(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %r15d,%ecx
mov    %ebx,%r8d
call   1050 <printf@plt>
test   %r15d,%r15d
setne  %al
test   %ebx,%ebx
setne  %cl
test   %r14d,%r14d
setne  %dl
and    %al,%dl
and    %cl,%dl
movzbl %dl,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"is_n_answer: n:%d T:%d P:%d H:%d\0A\00"
define i32 @is_n_answer(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @invtri(i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = call i32 @invpen(i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %3
%12 = call i32 @invhex(i32 %11)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %24
15: ; preds = %1
%16 = load i32, i32* %5
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %15
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i32 %21, i32 %22)
br label %24
24: ; preds = %18, %15, %1
%25 = load i32, i32* %4
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %24
%28 = load i32, i32* %5
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i32, i32* %6
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %30
store i32 1, i32* %2
br label %35
34: ; preds = %30, %27, %24
store i32 0, i32* %2
br label %35
35: ; preds = %34, %33
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@.str = [34 x i8] c"is_n_answer: n:%d T:%d P:%d H:%d\0A\00"
define i32 @is_n_answer(i32 %0) {
%2 = tail call i32 @invtri(i32 %0)
%3 = tail call i32 @invpen(i32 %0)
%4 = tail call i32 @invhex(i32 %0)
%5 = icmp ne i32 %4, 0
%6 = icmp ne i32 %3, 0
%7 = select i1 %5, i1 %6, i1 false
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %2, i32 %3, i32 %4)
br label %10
10: ; preds = %8, %1
%11 = icmp ne i32 %2, 0
%12 = select i1 %11, i1 %6, i1 false
%13 = select i1 %12, i1 %5, i1 false
%14 = zext i1 %13 to i32
ret i32 %14
}