#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*/ print_bar(char, int);
int /*<<< orphan*/ printf(char *, char const *);
size_t strlen(char const *);
int main(int argc, const char *argv[]) {
  char mark = argv[1][0];
  const char *msg = argv[2];
  size_t len = strlen(msg);
  int width = 80;
  int bar_width = (width - (len + 2)) / 2;
  print_bar(mark, bar_width);
  printf(" %s ", msg);
  print_bar(mark, bar_width + len % 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x28(%rbp)
movl   $0x50,-0x2c(%rbp)
movslq -0x2c(%rbp),%rax
mov    -0x28(%rbp),%rcx
add    $0x2,%rcx
sub    %rcx,%rax
shr    $0x1,%rax
mov    %eax,-0x30(%rbp)
mov    -0x11(%rbp),%al
mov    -0x30(%rbp),%esi
movsbl %al,%edi
call   1050 <print_bar@plt>
mov    -0x20(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x11(%rbp),%al
movslq -0x30(%rbp),%rcx
mov    -0x28(%rbp),%rdx
and    $0x1,%rdx
add    %rdx,%rcx
mov    %ecx,%esi
movsbl %al,%edi
call   1050 <print_bar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x8(%rsi),%rax
mov    0x10(%rsi),%r15
movsbl (%rax),%r14d
mov    %r15,%rdi
call   1030 <strlen@plt>
mov    %rax,%rbp
mov    $0x4e,%ebx
sub    %rax,%rbx
shr    %rbx
mov    %r14d,%edi
mov    %ebx,%esi
call   1050 <print_bar@plt>
lea    0xe96(%rip),%rdi
mov    %r15,%rsi
call   1040 <printf@plt>
and    $0x1,%ebp
add    %ebx,%ebp
mov    %r14d,%edi
mov    %ebp,%esi
call   1050 <print_bar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c" %s \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i64 0
%15 = load i8, i8* %14
store i8 %15, i8* %6
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 2
%18 = load i8*, i8** %17
store i8* %18, i8** %7
%19 = load i8*, i8** %7
%20 = call i64 @strlen(i8* %19)
store i64 %20, i64* %8
store i32 80, i32* %9
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = load i64, i64* %8
%24 = add i64 %23, 2
%25 = sub i64 %22, %24
%26 = udiv i64 %25, 2
%27 = trunc i64 %26 to i32
store i32 %27, i32* %10
%28 = load i8, i8* %6
%29 = load i32, i32* %10
%30 = call i32 @print_bar(i8 signext %28, i32 %29)
%31 = load i8*, i8** %7
%32 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = load i8, i8* %6
%34 = load i32, i32* %10
%35 = sext i32 %34 to i64
%36 = load i64, i64* %8
%37 = urem i64 %36, 2
%38 = add i64 %35, %37
%39 = trunc i64 %38 to i32
%40 = call i32 @print_bar(i8 signext %33, i32 %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c" %s \00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i64 @strlen(i8* dereferenceable(1) %7)
%9 = sub i64 78, %8
%10 = lshr i64 %9, 1
%11 = trunc i64 %10 to i32
%12 = tail call i32 @print_bar(i8 signext %5, i32 %11)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %7)
%14 = and i64 %8, 1
%15 = add nuw i64 %10, %14
%16 = trunc i64 %15 to i32
%17 = tail call i32 @print_bar(i8 signext %5, i32 %16)
ret i32 0
}