#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*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n = 0, a = 0, b = 1, c = 2;
  scanf("%d", &n);
  while (a * b * c < n) {
    a++;
    b++;
    c++;
  }
  if (a * b * c == n) {
    printf("%d é triangular de %d.%d.%d\n", n, a, b, c);
  } else {
    printf("%d não é triangular\n", n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    118f <main+0x6f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <main+0x3b>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11c3 <main+0xa3>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d4 <main+0xb4>
mov    -0x8(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jle    1180 <main+0x60>
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edx,%ecx
lea    0x1(%rcx),%edx
lea    0x2(%rcx),%eax
add    $0x3,%ecx
imul   %edx,%eax
imul   %ecx,%eax
cmp    %esi,%eax
jl     1150 <main+0x30>
lea    0x2(%rdx),%r8d
lea    0x1(%rdx),%ecx
cmp    %esi,%eax
jne    1193 <main+0x73>
lea    0xe8c(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11a1 <main+0x81>
mov    $0x2,%r8d
mov    $0x1,%ecx
xor    %edx,%edx
xor    %eax,%eax
cmp    %esi,%eax
je     1170 <main+0x50>
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [30 x i8] c"%d \C3\A9 triangular de %d.%d.%d\0A\00"
@.str.2 = [23 x i8] c"%d n\C3\A3o \C3\A9 triangular\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 1, i32* %4
store i32 2, i32* %5
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = mul nsw i32 %8, %9
%11 = load i32, i32* %5
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %22
15: ; preds = %7
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %7
22: ; preds = %7
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = mul nsw i32 %23, %24
%26 = load i32, i32* %5
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %2
%29 = icmp eq i32 %27, %28
br i1 %29, label %30, label %36
30: ; preds = %22
%31 = load i32, i32* %2
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %31, i32 %32, i32 %33, i32 %34)
br label %39
36: ; preds = %22
%37 = load i32, i32* %2
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %36, %30
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [30 x i8] c"%d \C3\A9 triangular de %d.%d.%d\0A\00"
@.str.2 = [23 x i8] c"%d n\C3\A3o \C3\A9 triangular\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %0, %6
%7 = phi i32 [ %12, %6 ], [ 2, %0 ]
%8 = phi i32 [ %11, %6 ], [ 1, %0 ]
%9 = phi i32 [ %10, %6 ], [ 0, %0 ]
%10 = add nuw nsw i32 %9, 1
%11 = add nuw nsw i32 %8, 1
%12 = add nuw nsw i32 %7, 1
%13 = mul nsw i32 %11, %10
%14 = mul nsw i32 %13, %12
%15 = icmp slt i32 %14, %4
br i1 %15, label %6, label %16
16: ; preds = %6, %0
%17 = phi i32 [ 0, %0 ], [ %10, %6 ]
%18 = phi i32 [ 1, %0 ], [ %11, %6 ]
%19 = phi i32 [ 2, %0 ], [ %12, %6 ]
%20 = phi i32 [ 0, %0 ], [ %14, %6 ]
%21 = icmp eq i32 %20, %4
br i1 %21, label %22, label %24
22: ; preds = %16
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %4, i32 %17, i32 %18, i32 %19)
br label %26
24: ; preds = %16
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %4)
br label %26
26: ; preds = %24, %22
ret i32 0
}