#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 its_a_rectangle(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int i, j;
  int width, heigth;
  int area;
  printf("put de width :");
  scanf("%d", &width);
  printf("put de heigth :");
  scanf("%d", &heigth);
  if (its_a_rectangle(width, heigth) == 1) {
    area = width * heigth;
  } else {
    printf("its a square\n");
    return;
  }
  printf("------------------------------\n\n");
  for (i = 0; i < heigth; ++i) {
    for (j = 0; j < width; j++) {
      printf(" * ");
    }
    printf("\n");
  }
  printf("\n\nThe area is %d\n", area);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1050 <its_a_rectangle@plt>
cmp    $0x1,%eax
jne    1197 <main+0x67>
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11aa <main+0x7a>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1227 <main+0xf7>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1216 <main+0xe6>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fa <main+0xca>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d2 <main+0xa2>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11bf <main+0x8f>
mov    -0x14(%rbp),%esi
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xea3(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1070 <its_a_rectangle@plt>
cmp    $0x1,%eax
jne    1205 <main+0xb5>
mov    (%rsp),%r14d
imul   0x4(%rsp),%r14d
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
cmpl   $0x0,(%rsp)
jle    1213 <main+0xc3>
lea    0xe5c(%rip),%rbx
xor    %r15d,%r15d
jmp    11e4 <main+0x94>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r15d
cmp    (%rsp),%r15d
jge    1213 <main+0xc3>
cmpl   $0x0,0x4(%rsp)
jle    11d0 <main+0x80>
xor    %ebp,%ebp
nopl   (%rax)
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11f0 <main+0xa0>
jmp    11d0 <main+0x80>
lea    0xe2c(%rip),%rdi
call   1040 <puts@plt>
jmp    1224 <main+0xd4>
lea    0xe0c(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"put de width :\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"put de heigth :\00"
@.str.5 = [4 x i8] c" * \00"
@.str.7 = [18 x i8] c"\0A\0AThe area is %d\0A\00"
@str = [13 x i8] c"its a square\00"
@str.8 = [32 x i8] c"------------------------------\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = call i32 @its_a_rectangle(i32 %9, i32 %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %20
13: ; preds = %0
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = mul nsw i32 %15, %14
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.8, i64 0, i64 0))
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 0
br i1 %19, label %22, label %37
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %39
22: ; preds = %13, %32
%23 = phi i32 [ %34, %32 ], [ 0, %13 ]
%24 = load i32, i32* %1
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %32
26: ; preds = %22, %26
%27 = phi i32 [ %29, %26 ], [ 0, %22 ]
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%29 = add nuw nsw i32 %27, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %29, %30
br i1 %31, label %26, label %32
32: ; preds = %26, %22
%33 = call i32 @putchar(i32 10)
%34 = add nuw nsw i32 %23, 1
%35 = load i32, i32* %2
%36 = icmp slt i32 %34, %35
br i1 %36, label %22, label %37
37: ; preds = %32, %13
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %16)
br label %39
39: ; preds = %37, %20
ret void
}