#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 strlen(char *);
void seatest_header_printer(char *s, int length, char f) {
  int l = strlen(s);
  int d = (length - (l + 2)) / 2;
  int i;
  for (i = 0; i < d; i++)
    printf("%c", f);
  printf(" %s ", s);
  for (i = (d + l + 2); i < length; i++)
    printf("%c", f);
  printf("\r\n");
}


x86 assembly (clang, -O0):
<seatest_header_printer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x2,%ecx
sub    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1189 <seatest_header_printer+0x69>
movsbl -0xd(%rbp),%esi
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115d <seatest_header_printer+0x3d>
mov    -0x8(%rbp),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d3 <seatest_header_printer+0xb3>
movsbl -0xd(%rbp),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a7 <seatest_header_printer+0x87>
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seatest_header_printer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%r13d
mov    %rdi,%r14
call   1050 <strlen@plt>
mov    %eax,%r15d
mov    %r13d,%eax
sub    %r15d,%eax
mov    %eax,%ecx
add    $0xfffffffe,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
lea    (%rax,%rdx,1),%r12d
add    $0xfffffffe,%r12d
sar    %r12d
movsbl %bpl,%ebp
cmp    $0x2,%ecx
jl     119c <seatest_header_printer+0x5c>
mov    %r12d,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1190 <seatest_header_printer+0x50>
lea    0xe5d(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
lea    (%r15,%r12,1),%ebx
add    $0x2,%ebx
cmp    %r13d,%ebx
jge    11cf <seatest_header_printer+0x8f>
nopl   0x0(%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    %r13d,%ebx
jl     11c0 <seatest_header_printer+0x80>
lea    0xe2f(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@.str.1 = [5 x i8] c" %s \00"
@.str.2 = [3 x i8] c"\0D\0A\00"
define void @seatest_header_printer(i8* %0, i32 %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = call i32 @strlen(i8* %10)
store i32 %11, i32* %7
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = add nsw i32 %13, 2
%15 = sub nsw i32 %12, %14
%16 = sdiv i32 %15, 2
store i32 %16, i32* %8
store i32 0, i32* %9
br label %17
17: ; preds = %25, %3
%18 = load i32, i32* %9
%19 = load i32, i32* %8
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i8, i8* %6
%23 = sext i8 %22 to i32
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %21
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %17
28: ; preds = %17
%29 = load i8*, i8** %4
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%31 = load i32, i32* %8
%32 = load i32, i32* %7
%33 = add nsw i32 %31, %32
%34 = add nsw i32 %33, 2
store i32 %34, i32* %9
br label %35
35: ; preds = %43, %28
%36 = load i32, i32* %9
%37 = load i32, i32* %5
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %46
39: ; preds = %35
%40 = load i8, i8* %6
%41 = sext i8 %40 to i32
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %39
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %9
br label %35
46: ; preds = %35
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c" %s \00"
@str = [2 x i8] c"\0D\00"
define void @seatest_header_printer(i8* %0, i32 %1, i8 signext %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = add i32 %1, -2
%6 = sub i32 %5, %4
%7 = sdiv i32 %6, 2
%8 = icmp sgt i32 %6, 1
br i1 %8, label %9, label %16
9: ; preds = %3
%10 = sext i8 %2 to i32
br label %11
11: ; preds = %9, %11
%12 = phi i32 [ 0, %9 ], [ %14, %11 ]
%13 = tail call i32 @putchar(i32 %10)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %7
br i1 %15, label %16, label %11
16: ; preds = %11, %3
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%18 = add i32 %4, 2
%19 = add i32 %18, %7
%20 = icmp slt i32 %19, %1
br i1 %20, label %21, label %28
21: ; preds = %16
%22 = sext i8 %2 to i32
br label %23
23: ; preds = %21, %23
%24 = phi i32 [ %19, %21 ], [ %26, %23 ]
%25 = tail call i32 @putchar(i32 %22)
%26 = add nsw i32 %24, 1
%27 = icmp slt i32 %26, %1
br i1 %27, label %23, label %28
28: ; preds = %23, %16
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}