#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int strlen(char *);
void bx_center_print(FILE *file, char *line, int maxwidth) {
  int imax;
  int i;
  imax = (maxwidth - strlen(line)) >> 1;
  for (i = 0; i < imax; i++)
    fputc(' ', file);
  fputs(line, file);
}


x86 assembly (clang, -O0):
<bx_center_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    %ecx,%eax
sar    $0x1,%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    118e <bx_center_print+0x5e>
mov    -0x8(%rbp),%rsi
mov    $0x20,%edi
call   1050 <fputc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1166 <bx_center_print+0x36>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <fputs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bx_center_print>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <strlen@plt>
sub    %eax,%ebp
cmp    $0x2,%ebp
jl     1162 <bx_center_print+0x32>
shr    %ebp
nopl   (%rax)
mov    $0x20,%edi
mov    %rbx,%rsi
call   1050 <fputc@plt>
add    $0xffffffff,%ebp
jne    1150 <bx_center_print+0x20>
mov    %r14,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fputs@plt>

LLVM IR (-O0):
define void @bx_center_print(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = load i8*, i8** %5
%11 = call i32 @strlen(i8* %10)
%12 = sub nsw i32 %9, %11
%13 = ashr i32 %12, 1
store i32 %13, i32* %7
store i32 0, i32* %8
br label %14
14: ; preds = %21, %3
%15 = load i32, i32* %8
%16 = load i32, i32* %7
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %24
18: ; preds = %14
%19 = load i32*, i32** %4
%20 = call i32 @fputc(i8 signext 32, i32* %19)
br label %21
21: ; preds = %18
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %14
24: ; preds = %14
%25 = load i8*, i8** %5
%26 = load i32*, i32** %4
%27 = call i32 @fputs(i8* %25, i32* %26)
ret void
}

LLVM IR (-O2):
define void @bx_center_print(i32* nocapture %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = sub nsw i32 %2, %4
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = lshr i32 %5, 1
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ %12, %9 ], [ 0, %7 ]
%11 = tail call i32 @fputc(i8 signext 32, i32* %0)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %8
br i1 %13, label %14, label %9
14: ; preds = %9, %3
%15 = tail call i32 @fputs(i8* %1, i32* %0)
ret void
}