#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 *, char);
void stampaRiga(char bordo, char dentro, int n) {
  int i;
  printf("%c", bordo);
  for (i = 0; i < n - 2; i++) {
    printf("%c", dentro);
  }
  if (n != 1)
    printf("%c", bordo);
}


x86 assembly (clang, -O0):
<stampaRiga>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    %edx,-0x8(%rbp)
lea    0xed2(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    116d <stampaRiga+0x5d>
lea    0xeaa(%rip),%rdi
movsbl -0x2(%rbp),%esi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113e <stampaRiga+0x2e>
cmpl   $0x1,-0x8(%rbp)
je     1187 <stampaRiga+0x77>
lea    0xe82(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stampaRiga>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r12d
mov    %esi,%r14d
mov    %edi,%r15d
lea    0xed8(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
cmp    $0x3,%r12d
jl     115f <stampaRiga+0x4f>
lea    -0x2(%r12),%ebx
movsbl %r14b,%ebp
lea    0xeba(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebx
jne    1150 <stampaRiga+0x40>
cmp    $0x1,%r12d
jne    116e <stampaRiga+0x5e>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
movsbl %r15b,%esi
lea    0xe87(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @stampaRiga(i8 signext %0, i8 signext %1, i32 %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %4
store i8 %1, i8* %5
store i32 %2, i32* %6
%8 = load i8, i8* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %8)
store i32 0, i32* %7
br label %10
10: ; preds = %18, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = sub nsw i32 %12, 2
%14 = icmp slt i32 %11, %13
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load i8, i8* %5
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %16)
br label %18
18: ; preds = %15
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
br label %10
21: ; preds = %10
%22 = load i32, i32* %6
%23 = icmp ne i32 %22, 1
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i8, i8* %4
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %25)
br label %27
27: ; preds = %24, %21
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @stampaRiga(i8 signext %0, i8 signext %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%5 = add i32 %2, -2
%6 = icmp sgt i32 %2, 2
br i1 %6, label %7, label %12
7: ; preds = %3, %7
%8 = phi i32 [ %10, %7 ], [ 0, %3 ]
%9 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %1)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, %5
br i1 %11, label %12, label %7
12: ; preds = %7, %3
%13 = icmp eq i32 %2, 1
br i1 %13, label %16, label %14
14: ; preds = %12
%15 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %0)
br label %16
16: ; preds = %14, %12
ret void
}