#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*/ printw(char *, ...);
int strlen(char *);
void fillLine(char *text, int scrx) {
  int i;
  int textlen = strlen(text);
  for (i = 0; i != scrx;) {
    if (i == (scrx / 2) - textlen / 2) {
      printw("%s", text);
      i += textlen;
    }
    printw("-");
    ++i;
  }
}


x86 assembly (clang, -O0):
<fillLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     11b2 <fillLine+0x92>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
mov    $0x2,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x18(%rbp),%eax
sub    %edx,%ecx
cmp    %ecx,%eax
jne    1196 <fillLine+0x76>
mov    -0x8(%rbp),%rsi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printw@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printw@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1142 <fillLine+0x22>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fillLine>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %ebp,%ebp
je     118e <fillLine+0x6e>
mov    %eax,%r15d
mov    %ebp,%ebx
shr    $0x1f,%ebx
add    %ebp,%ebx
sar    %ebx
shr    $0x1f,%eax
add    %r15d,%eax
sar    %eax
sub    %eax,%ebx
add    %ebx,%r15d
lea    0xeaa(%rip),%r13
xor    %r12d,%r12d
jmp    1173 <fillLine+0x53>
xchg   %ax,%ax
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printw@plt>
add    $0x1,%r12d
cmp    %ebp,%r12d
je     118e <fillLine+0x6e>
cmp    %ebx,%r12d
jne    1160 <fillLine+0x40>
lea    0xe81(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printw@plt>
mov    %r15d,%r12d
jmp    1160 <fillLine+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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