#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(void) {
  int n1 = 0;
  do {
    printf("Digite um numero: \n");
    scanf("%d", &n1);
    if (n1 == 0)
      printf("\no quadrado do numero %d eh: %d\n", n1, (n1 + 1));
    else
      printf("\no quadrado do numero %d eh: %d\n", n1, (n1 * n1));
  } while (n1 != 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
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    117a <main+0x5a>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1192 <main+0x72>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
imul   -0x8(%rbp),%edx
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1197 <main+0x77>
cmpl   $0x0,-0x8(%rbp)
jne    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xedd(%rip),%r14
lea    0xeb2(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xea9(%rip),%rbx
jmp    1176 <main+0x46>
nopl   0x0(%rax)
mov    %esi,%edx
imul   %esi,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x4(%rsp)
je     119d <main+0x6d>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
test   %esi,%esi
jne    1160 <main+0x30>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x1,%edx
jmp    1168 <main+0x38>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Digite um numero: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"\0Ao quadrado do numero %d eh: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %20, %0
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 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)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i32, i32* %2
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %9, i32 %11)
br label %19
13: ; preds = %3
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = mul nsw i32 %15, %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %17)
br label %19
19: ; preds = %13, %8
br label %20
20: ; preds = %19
%21 = load i32, i32* %2
%22 = icmp ne i32 %21, 0
br i1 %22, label %3, label %23
23: ; preds = %20
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"\0Ao quadrado do numero %d eh: %d\0A\00"
@str = [19 x i8] c"Digite um numero: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
br label %3
3: ; preds = %13, %0
%4 = call i32 @puts(i8* dereferenceable(1) 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* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 0, i32 1)
br label %13
10: ; preds = %3
%11 = mul nsw i32 %6, %6
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %11)
br label %13
13: ; preds = %8, %10
%14 = load i32, i32* %1
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %3
16: ; preds = %13
ret i32 0
}