#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 */
scalar_t__ is_pentagonal(int);
scalar_t__ is_triangular(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int h, n = 144;
  while (1) {
    h = n * (2 * n - 1);
    if (is_pentagonal(h) && is_triangular(h)) {
      printf("%d\n", h);
      break;
    }
    n++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x90,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <is_pentagonal@plt>
cmp    $0x0,%rax
je     1197 <main+0x67>
mov    -0x14(%rbp),%edi
call   1030 <is_triangular@plt>
cmp    $0x0,%rax
je     1197 <main+0x67>
mov    -0x14(%rbp),%esi
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
jmp    11a5 <main+0x75>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x90,%r14d
mov    $0x11f,%ebp
jmp    1157 <main+0x27>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r14d
add    $0x2,%ebp
mov    %ebp,%ebx
imul   %r14d,%ebx
mov    %ebx,%edi
call   1050 <is_pentagonal@plt>
test   %rax,%rax
je     1150 <main+0x20>
mov    %ebx,%edi
call   1030 <is_triangular@plt>
test   %rax,%rax
je     1150 <main+0x20>
lea    0xe84(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %15, %2
%4 = phi i32 [ 144, %2 ], [ %16, %15 ]
%5 = shl nuw nsw i32 %4, 1
%6 = add nsw i32 %5, -1
%7 = mul nsw i32 %6, %4
%8 = tail call i64 @is_pentagonal(i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %3
%11 = tail call i64 @is_triangular(i32 %7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
15: ; preds = %10, %3
%16 = add nuw nsw i32 %4, 1
br label %3
}