#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 /*<<< orphan*/ system(char *);
main() {
  int r, c;
  int i, j;
  printf("digitare numero righe desiderate: ");
  scanf("%d", &r);
  printf("\n\ndigitare numero colonne desiderate: ");
  scanf("%d", &c);
  for (i = 1; i <= r; i++) {
    printf("\n*");
    for (j = 1; j <= c - 2; j++) {
      if (i == 1 || i == r)
        printf("*");
      else
        printf("Q");
    }
    printf("*");
  }
  printf("\n\n\n");
  system("PAUSE");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     120e <main+0xde>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     11f4 <main+0xc4>
cmpl   $0x1,-0x10(%rbp)
je     11c4 <main+0x94>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    11d5 <main+0xa5>
lea    0xe83(%rip),%rdi
call   1040 <printf@plt>
jmp    11e1 <main+0xb1>
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
jmp    11e6 <main+0xb6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119d <main+0x6d>
lea    0xe53(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117e <main+0x4e>
lea    0xe3d(%rip),%rdi
call   1040 <printf@plt>
lea    0xe35(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xea1(%rip),%rdi
call   1060 <printf@plt>
lea    0xeb8(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
lea    0xea7(%rip),%rdi
call   1060 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    1210 <main+0xc0>
mov    $0x1,%ebx
lea    0xea9(%rip),%r14
jmp    11c5 <main+0x75>
cs nopw 0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
cmp    0x8(%rsp),%ebx
mov    %eax,%ebx
jge    1210 <main+0xc0>
mov    %r14,%rdi
call   1060 <printf@plt>
cmpl   $0x3,0xc(%rsp)
jl     11b0 <main+0x60>
xor    %ebp,%ebp
jmp    11f9 <main+0xa9>
nopl   0x0(%rax,%rax,1)
cmp    $0x1,%ebx
cmove  %eax,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%eax
add    $0xfffffffe,%eax
add    $0x1,%ebp
cmp    %eax,%ebp
jge    11b0 <main+0x60>
mov    $0x2a,%eax
mov    $0x2a,%edi
cmp    0x8(%rsp),%ebx
je     11e0 <main+0x90>
mov    $0x51,%edi
jmp    11e0 <main+0x90>
lea    0xe3f(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2d(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"digitare numero righe desiderate: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"\0A\0Adigitare numero colonne desiderate: \00"
@.str.3 = [3 x i8] c"\0A*\00"
@.str.4 = [2 x i8] c"*\00"
@.str.5 = [2 x i8] c"Q\00"
@.str.6 = [4 x i8] c"\0A\0A\0A\00"
@.str.7 = [6 x i8] c"PAUSE\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 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* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 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* %3)
store i32 1, i32* %4
br label %10
10: ; preds = %38, %0
%11 = load i32, i32* %4
%12 = load i32, i32* %2
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %41
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %5
br label %16
16: ; preds = %33, %14
%17 = load i32, i32* %5
%18 = load i32, i32* %3
%19 = sub nsw i32 %18, 2
%20 = icmp sle i32 %17, %19
br i1 %20, label %21, label %36
21: ; preds = %16
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 1
br i1 %23, label %28, label %24
24: ; preds = %21
%25 = load i32, i32* %4
%26 = load i32, i32* %2
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %30
28: ; preds = %24, %21
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %32
30: ; preds = %24
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
br label %33
33: ; preds = %32
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %16
36: ; preds = %16
%37 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %10
41: ; preds = %10
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%43 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"digitare numero righe desiderate: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"\0A\0Adigitare numero colonne desiderate: \00"
@.str.3 = [3 x i8] c"\0A*\00"
@.str.7 = [6 x i8] c"PAUSE\00"
@str = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 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 @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 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 = icmp slt i32 %9, 1
br i1 %10, label %34, label %11
11: ; preds = %0, %29
%12 = phi i32 [ %31, %29 ], [ 1, %0 ]
%13 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 3
br i1 %15, label %29, label %16
16: ; preds = %11
%17 = icmp eq i32 %12, 1
br label %18
18: ; preds = %16, %18
%19 = phi i32 [ 1, %16 ], [ %25, %18 ]
%20 = load i32, i32* %1
%21 = icmp eq i32 %12, %20
%22 = select i1 %17, i1 true, i1 %21
%23 = select i1 %22, i32 42, i32 81
%24 = call i32 @putchar(i32 %23)
%25 = add nuw nsw i32 %19, 1
%26 = load i32, i32* %2
%27 = add nsw i32 %26, -2
%28 = icmp slt i32 %19, %27
br i1 %28, label %18, label %29
29: ; preds = %18, %11
%30 = call i32 @putchar(i32 42)
%31 = add nuw nsw i32 %12, 1
%32 = load i32, i32* %1
%33 = icmp slt i32 %12, %32
br i1 %33, label %11, label %34
34: ; preds = %29, %0
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%36 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
ret i32 0
}