#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);
void e_repete(int caractere, int vezes, int antes, int depois) {
  int i;
  if (antes != 0)
    printf("%c", antes);
  for (i = 1; i < vezes; i++)
    printf("%c", caractere);
  if (depois != 0)
    printf("%c", depois);
}


x86 assembly (clang, -O0):
<e_repete>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113d <e_repete+0x2d>
mov    -0xc(%rbp),%esi
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    116d <e_repete+0x5d>
mov    -0x4(%rbp),%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <e_repete+0x34>
cmpl   $0x0,-0x10(%rbp)
je     1186 <e_repete+0x76>
mov    -0x10(%rbp),%esi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_repete>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
test   %edx,%edx
je     1130 <e_repete+0x20>
lea    0xed7(%rip),%rdi
mov    %edx,%esi
call   1030 <printf@plt>
cmp    $0x2,%ebp
jl     114f <e_repete+0x3f>
add    $0xffffffff,%ebp
lea    0xec1(%rip),%r15
nop
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1140 <e_repete+0x30>
test   %r14d,%r14d
je     116d <e_repete+0x5d>
lea    0xea5(%rip),%rdi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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