#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*/ chars_print(char, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int utf8_strlen(char *);
void item_print(char *s, int space, FILE *stream) {
  int len, white;
  len = utf8_strlen(s);
  white = (space - len) / 2;
  chars_print(' ', white, stream);
  fprintf(stream, "%s", s);
  chars_print(' ', space - (white + len), stream);
}


x86 assembly (clang, -O0):
<item_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <utf8_strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x20,%edi
call   1040 <chars_print@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe80(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%eax
add    -0x1c(%rbp),%eax
sub    %eax,%esi
mov    -0x18(%rbp),%rdx
mov    $0x20,%edi
call   1040 <chars_print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<item_print>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdx,%r12
mov    %esi,%ebp
mov    %rdi,%r14
call   1030 <utf8_strlen@plt>
mov    %eax,%r15d
mov    %ebp,%eax
sub    %r15d,%eax
mov    %eax,%ebx
shr    $0x1f,%ebx
add    %eax,%ebx
sar    %ebx
mov    $0x20,%edi
mov    %ebx,%esi
mov    %r12,%rdx
call   1040 <chars_print@plt>
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <fputs@plt>
add    %r15d,%ebx
sub    %ebx,%ebp
mov    $0x20,%edi
mov    %ebp,%esi
mov    %r12,%rdx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <chars_print@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @item_print(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%9 = load i8*, i8** %4
%10 = call i32 @utf8_strlen(i8* %9)
store i32 %10, i32* %7
%11 = load i32, i32* %5
%12 = load i32, i32* %7
%13 = sub nsw i32 %11, %12
%14 = sdiv i32 %13, 2
store i32 %14, i32* %8
%15 = load i32, i32* %8
%16 = load i32*, i32** %6
%17 = call i32 @chars_print(i8 signext 32, i32 %15, i32* %16)
%18 = load i32*, i32** %6
%19 = load i8*, i8** %4
%20 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = load i32, i32* %5
%22 = load i32, i32* %8
%23 = load i32, i32* %7
%24 = add nsw i32 %22, %23
%25 = sub nsw i32 %21, %24
%26 = load i32*, i32** %6
%27 = call i32 @chars_print(i8 signext 32, i32 %25, i32* %26)
ret void
}

LLVM IR (-O2):
define void @item_print(i8* %0, i32 %1, i32* %2) {
%4 = tail call i32 @utf8_strlen(i8* %0)
%5 = sub nsw i32 %1, %4
%6 = sdiv i32 %5, 2
%7 = tail call i32 @chars_print(i8 signext 32, i32 %6, i32* %2)
%8 = tail call i32 @fputs(i8* %0, i32* %2)
%9 = add i32 %4, %6
%10 = sub i32 %1, %9
%11 = tail call i32 @chars_print(i8 signext 32, i32 %10, i32* %2)
ret void
}