#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int numero = 0;
  printf("Digite um numero: ");
  scanf("%d", &numero);
  int i;
  for (i = 1; i * (i + 1) * (i + 2) <= numero; i++) {
    if (i * (i + 1) * (i + 2) == numero) {
      printf("eh triangular");
    }
  }
  if (i * (i + 1) * (i + 2) > numero || i * (i + 1) * (i + 2) != numero) {
    printf("Nao eh triangular");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
cmp    -0x8(%rbp),%eax
jg     11b4 <main+0x94>
mov    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
cmp    -0x8(%rbp),%eax
jne    11a1 <main+0x81>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
jmp    11a6 <main+0x86>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <main+0x39>
mov    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
cmp    -0x8(%rbp),%eax
jg     11f0 <main+0xd0>
mov    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0xc(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
cmp    -0x8(%rbp),%eax
je     11fc <main+0xdc>
lea    0xe1f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x6,%eax
jge    1168 <main+0x48>
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    $0x2,%ebx
mov    $0x6,%ecx
lea    0xea1(%rip),%r14
jmp    1196 <main+0x76>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%edx
mov    %edx,%ecx
imul   %ebx,%ecx
add    $0x2,%ebx
imul   %ecx,%ebx
mov    %ebx,%ecx
cmp    %eax,%ebx
mov    %edx,%ebx
jg     1152 <main+0x32>
cmp    %eax,%ecx
jne    1180 <main+0x60>
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
jmp    1180 <main+0x60>

LLVM IR (-O0):
@.str = [19 x i8] c"Digite um numero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"eh triangular\00"
@.str.3 = [18 x i8] c"Nao eh triangular\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %6
6: ; preds = %29, %0
%7 = load i32, i32* %3
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 1
%10 = mul nsw i32 %7, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 2
%13 = mul nsw i32 %10, %12
%14 = load i32, i32* %2
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %32
16: ; preds = %6
%17 = load i32, i32* %3
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
%20 = mul nsw i32 %17, %19
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 2
%23 = mul nsw i32 %20, %22
%24 = load i32, i32* %2
%25 = icmp eq i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %16
%27 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %28
28: ; preds = %26, %16
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %6
32: ; preds = %6
%33 = load i32, i32* %3
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
%36 = mul nsw i32 %33, %35
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 2
%39 = mul nsw i32 %36, %38
%40 = load i32, i32* %2
%41 = icmp sgt i32 %39, %40
br i1 %41, label %52, label %42
42: ; preds = %32
%43 = load i32, i32* %3
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 1
%46 = mul nsw i32 %43, %45
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 2
%49 = mul nsw i32 %46, %48
%50 = load i32, i32* %2
%51 = icmp ne i32 %49, %50
br i1 %51, label %52, label %54
52: ; preds = %42, %32
%53 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %52, %42
ret i32 0
}

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