#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*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ stdout;
size_t strlen(char const *);
void fct_dotted_line_start(size_t maxwidth, char const *startwith) {
  char line[256];
  size_t len = 0;
  size_t line_len = 0;
  memset(line, '.', sizeof(char) * maxwidth);
  len = strlen(startwith);
  line_len = (maxwidth - 1 < len) ? (maxwidth - 1) : (len);
  memcpy(line, startwith, sizeof(char) * line_len);
  if (len < maxwidth - 1) {
    line[len] = ' ';
  }
  line[maxwidth - 1] = '\0';
  fputs(line, stdout);
}


x86 assembly (clang, -O0):
<fct_dotted_line_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x118(%rbp)
movq   $0x0,-0x120(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x8(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edx
mov    $0x2e,%esi
call   1050 <memset@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x118(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
cmp    -0x118(%rbp),%rax
jae    11bd <fct_dotted_line_start+0x7d>
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x128(%rbp)
jmp    11cb <fct_dotted_line_start+0x8b>
mov    -0x118(%rbp),%rax
mov    %rax,-0x128(%rbp)
mov    -0x128(%rbp),%rax
mov    %rax,-0x120(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x120(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0x118(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    121d <fct_dotted_line_start+0xdd>
mov    -0x118(%rbp),%rax
movb   $0x20,-0x110(%rbp,%rax,1)
20
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
mov    0x2da5(%rip),%rax
mov    (%rax),%esi
call   1040 <fputs@plt>
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fct_dotted_line_start>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rsp,%r12
mov    %r12,%rdi
mov    $0x2e,%esi
mov    %ebx,%edx
call   1050 <memset@plt>
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rax,%r14
add    $0xffffffffffffffff,%rbx
cmp    %rax,%rbx
mov    %r14d,%edx
cmovb  %ebx,%edx
mov    %r12,%rdi
mov    %r15,%rsi
call   1060 <memcpy@plt>
cmp    %rbx,%r14
jae    1193 <fct_dotted_line_start+0x53>
movb   $0x20,(%rsp,%r14,1)
movb   $0x0,(%rsp,%rbx,1)
mov    0x2e42(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdi
call   1040 <fputs@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdout = global i32 0
define void @fct_dotted_line_start(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca [256 x i8]
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %3
store i8* %1, i8** %4
store i64 0, i64* %6
store i64 0, i64* %7
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%9 = load i64, i64* %3
%10 = mul i64 1, %9
%11 = trunc i64 %10 to i32
%12 = call i32 @memset(i8* %8, i8 signext 46, i32 %11)
%13 = load i8*, i8** %4
%14 = call i64 @strlen(i8* %13)
store i64 %14, i64* %6
%15 = load i64, i64* %3
%16 = sub i64 %15, 1
%17 = load i64, i64* %6
%18 = icmp ult i64 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = load i64, i64* %3
%21 = sub i64 %20, 1
br label %24
22: ; preds = %2
%23 = load i64, i64* %6
br label %24
24: ; preds = %22, %19
%25 = phi i64 [ %21, %19 ], [ %23, %22 ]
store i64 %25, i64* %7
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%27 = load i8*, i8** %4
%28 = load i64, i64* %7
%29 = mul i64 1, %28
%30 = trunc i64 %29 to i32
%31 = call i32 @memcpy(i8* %26, i8* %27, i32 %30)
%32 = load i64, i64* %6
%33 = load i64, i64* %3
%34 = sub i64 %33, 1
%35 = icmp ult i64 %32, %34
br i1 %35, label %36, label %39
36: ; preds = %24
%37 = load i64, i64* %6
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %37
store i8 32, i8* %38
br label %39
39: ; preds = %36, %24
%40 = load i64, i64* %3
%41 = sub i64 %40, 1
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %41
store i8 0, i8* %42
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%44 = load i32, i32* @stdout
%45 = call i32 @fputs(i8* %43, i32 %44)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @fct_dotted_line_start(i64 %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = trunc i64 %0 to i32
%6 = call i32 @memset(i8* %4, i8 signext 46, i32 %5)
%7 = call i64 @strlen(i8* dereferenceable(1) %1)
%8 = add i64 %0, -1
%9 = icmp ult i64 %8, %7
%10 = select i1 %9, i64 %8, i64 %7
%11 = trunc i64 %10 to i32
%12 = call i32 @memcpy(i8* %4, i8* %1, i32 %11)
%13 = icmp ult i64 %7, %8
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %7
store i8 32, i8* %15
br label %16
16: ; preds = %14, %2
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 %8
store i8 0, i8* %17
%18 = load i32, i32* @stdout
%19 = call i32 @fputs(i8* %4, i32 %18)
ret void
}