#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ pintar_rombo(int, char);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  int n;
  char c;
  do {
    fprintf(stdout, "De que lado (impar) quieres el rombo? ");
    fscanf(stdin, "%d", &n);
    if (n <= 0 || n % 2 == 0)
      fprintf(stdout, "El lado debe ser un valor impar positivo\n");
  } while (n <= 0 || n % 2 == 0);
  fprintf(stdout, "Con que caracter quieres dibujar el rombo? ");
  fscanf(stdin, "\n%c", &c);
  pintar_rombo(n, c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1030 <fscanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    118d <main+0x5d>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a2 <main+0x72>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11a7 <main+0x77>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xa(%rbp)
jle    11ca <main+0x9a>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    113f <main+0xf>
mov    0x2dfc(%rip),%rax
mov    (%rax),%edi
lea    0xe6f(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2df7(%rip),%rax
mov    (%rax),%edi
lea    0xe86(%rip),%rsi
lea    -0x9(%rbp),%rdx
mov    $0x0,%al
call   1030 <fscanf@plt>
mov    -0x8(%rbp),%edi
movsbl -0x9(%rbp),%esi
call   1050 <pintar_rombo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    0x2e96(%rip),%rbp
lea    0xeb7(%rip),%r14
mov    0x2e98(%rip),%r13
lea    0xed0(%rip),%r15
lea    0x4(%rsp),%rbx
lea    0xec7(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%edi
mov    %r14,%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fscanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    11b0 <main+0x80>
mov    %eax,%edx
mov    $0x1,%ecx
and    $0x1,%edx
je     11b0 <main+0x80>
test   %eax,%eax
jle    1170 <main+0x40>
test   %ecx,%ecx
je     1170 <main+0x40>
jmp    11ca <main+0x9a>
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
mov    %r12,%rsi
call   1040 <fprintf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ecx
and    $0x1,%ecx
test   %eax,%eax
jg     11a4 <main+0x74>
jmp    1170 <main+0x40>
mov    0x0(%rbp),%edi
lea    0xe80(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x0(%r13),%edi
lea    0xe9c(%rip),%rsi
lea    0x3(%rsp),%rdx
xor    %eax,%eax
call   1030 <fscanf@plt>
mov    0x4(%rsp),%edi
movsbl 0x3(%rsp),%esi
call   1050 <pintar_rombo@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [39 x i8] c"De que lado (impar) quieres el rombo? \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"El lado debe ser un valor impar positivo\0A\00"
@.str.3 = [44 x i8] c"Con que caracter quieres dibujar el rombo? \00"
@.str.4 = [4 x i8] c"\0A%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
br label %4
4: ; preds = %26, %0
%5 = load i32, i32* @stdout
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdin
%8 = call i32 (i32, i8*, ...) @fscanf(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %4
%12 = load i32, i32* %2
%13 = srem i32 %12, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %11, %4
%16 = load i32, i32* @stdout
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %15, %11
br label %19
19: ; preds = %18
%20 = load i32, i32* %2
%21 = icmp sle i32 %20, 0
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = load i32, i32* %2
%24 = srem i32 %23, 2
%25 = icmp eq i32 %24, 0
br label %26
26: ; preds = %22, %19
%27 = phi i1 [ true, %19 ], [ %25, %22 ]
br i1 %27, label %4, label %28
28: ; preds = %26
%29 = load i32, i32* @stdout
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%31 = load i32, i32* @stdin
%32 = call i32 (i32, i8*, ...) @fscanf(i32 %31, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%33 = load i32, i32* %2
%34 = load i8, i8* %3
%35 = call i32 @pintar_rombo(i32 %33, i8 signext %34)
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [39 x i8] c"De que lado (impar) quieres el rombo? \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [42 x i8] c"El lado debe ser un valor impar positivo\0A\00"
@.str.3 = [44 x i8] c"Con que caracter quieres dibujar el rombo? \00"
@.str.4 = [4 x i8] c"\0A%c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
br label %4
4: ; preds = %19, %0
%5 = load i32, i32* @stdout
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @stdin
%8 = call i32 (i32, i8*, ...) @fscanf(i32 %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 1
%11 = and i32 %9, 1
%12 = icmp eq i32 %11, 0
%13 = or i1 %10, %12
br i1 %13, label %14, label %19
14: ; preds = %4
%15 = load i32, i32* @stdout
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %1
%18 = and i32 %17, 1
br label %19
19: ; preds = %4, %14
%20 = phi i32 [ 1, %4 ], [ %18, %14 ]
%21 = phi i32 [ %9, %4 ], [ %17, %14 ]
%22 = icmp slt i32 %21, 1
%23 = icmp eq i32 %20, 0
%24 = or i1 %22, %23
br i1 %24, label %4, label %25
25: ; preds = %19
%26 = load i32, i32* @stdout
%27 = call i32 @fprintf(i32 %26, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0))
%28 = load i32, i32* @stdin
%29 = call i32 (i32, i8*, ...) @fscanf(i32 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%30 = load i32, i32* %1
%31 = load i8, i8* %2
%32 = call i32 @pintar_rombo(i32 %30, i8 signext %31)
ret i32 0
}