#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 *);
void rectangle() {
  int length, width;
  int row, colume;
  printf("===============================================\n");
  printf("rectangle!\n Please input length and width:\n");
  printf("(Type-in format as:length,width)\n");
  scanf("%d, %d", &length, &width);
  for (row = 1; row <= width; row++) {
    for (colume = 1; colume <= length; colume++) {
      printf("*");
    }
    printf("\n");
  }
  printf("===============================================\n");
}


x86 assembly (clang, -O0):
<rectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
lea    0xf16(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2c(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ba <rectangle+0x9a>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11a0 <rectangle+0x80>
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    117a <rectangle+0x5a>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <rectangle+0x47>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rectangle>:
push   %rbp
push   %rbx
push   %rax
lea    0xf19(%rip),%rdi
call   1040 <puts@plt>
lea    0xec1(%rip),%rdi
call   1040 <puts@plt>
lea    0xee0(%rip),%rdi
call   1040 <puts@plt>
lea    0xea2(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    11b5 <rectangle+0x85>
mov    $0x1,%ebx
jmp    1194 <rectangle+0x64>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%rbx),%eax
cmp    (%rsp),%ebx
mov    %eax,%ebx
jge    11b5 <rectangle+0x85>
cmpl   $0x0,0x4(%rsp)
jle    1180 <rectangle+0x50>
xor    %ebp,%ebp
nopl   (%rax)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     11a0 <rectangle+0x70>
jmp    1180 <rectangle+0x50>
lea    0xe97(%rip),%rdi
call   1040 <puts@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [49 x i8] c"===============================================\0A\00"
@.str.1 = [44 x i8] c"rectangle!\0A Please input length and width:\0A\00"
@.str.2 = [34 x i8] c"(Type-in format as:length,width)\0A\00"
@.str.3 = [7 x i8] c"%d, %d\00"
@.str.4 = [2 x i8] c"*\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @rectangle() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
store i32 1, i32* %3
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = icmp sle i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
store i32 1, i32* %4
br label %14
14: ; preds = %20, %13
%15 = load i32, i32* %4
%16 = load i32, i32* %1
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %23
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %20
20: ; preds = %18
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %14
23: ; preds = %14
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %23
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %9
28: ; preds = %9
%29 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.3 = [7 x i8] c"%d, %d\00"
@str.6 = [43 x i8] c"rectangle!\0A Please input length and width:\00"
@str.7 = [33 x i8] c"(Type-in format as:length,width)\00"
@str.8 = [48 x i8] c"===============================================\00"
define void @rectangle() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.8, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.6, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.7, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 1
br i1 %10, label %26, label %11
11: ; preds = %0, %21
%12 = phi i32 [ %23, %21 ], [ 1, %0 ]
%13 = load i32, i32* %1
%14 = icmp slt i32 %13, 1
br i1 %14, label %21, label %15
15: ; preds = %11, %15
%16 = phi i32 [ %18, %15 ], [ 1, %11 ]
%17 = call i32 @putchar(i32 42)
%18 = add nuw nsw i32 %16, 1
%19 = load i32, i32* %1
%20 = icmp slt i32 %16, %19
br i1 %20, label %15, label %21
21: ; preds = %15, %11
%22 = call i32 @putchar(i32 10)
%23 = add nuw nsw i32 %12, 1
%24 = load i32, i32* %2
%25 = icmp slt i32 %12, %24
br i1 %25, label %11, label %26
26: ; preds = %21, %0
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.8, i64 0, i64 0))
ret void
}