#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 /*<<< orphan*/ putchar(char);
int strlen(char *);
void PrintBar(int offset, int width, char c, char *title) {
  int i, k, tlen;
  tlen = strlen(title);
  if (tlen > 0)
    tlen += 2;
  k = (width - tlen) / 2;
  for (i = 1; i <= offset; i++)
    putchar(' ');
  for (i = 1; i <= k; i++)
    putchar(c);
  if (tlen > 0)
    printf(" %s ", title);
  for (i = k + tlen; i <= width; i++)
    putchar(c);
  printf("\n");
}


x86 assembly (clang, -O0):
<PrintBar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jle    1166 <PrintBar+0x36>
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11a2 <PrintBar+0x72>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    117e <PrintBar+0x4e>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     11cc <PrintBar+0x9c>
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a9 <PrintBar+0x79>
cmpl   $0x0,-0x24(%rbp)
jle    11e8 <PrintBar+0xb8>
mov    -0x18(%rbp),%rsi
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1214 <PrintBar+0xe4>
movsbl -0x9(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f1 <PrintBar+0xc1>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintBar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %edx,0x4(%rsp)
mov    %esi,%ebx
mov    %edi,%ebp
mov    %rcx,%rdi
call   1040 <strlen@plt>
lea    0x2(%rax),%r13d
test   %eax,%eax
cmovle %eax,%r13d
mov    %ebx,%r14d
sub    %r13d,%r14d
mov    %r14d,%r12d
shr    $0x1f,%r12d
add    %r14d,%r12d
test   %ebp,%ebp
jle    117f <PrintBar+0x4f>
nopl   0x0(%rax)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1170 <PrintBar+0x40>
sar    %r12d
cmp    $0x2,%r14d
jl     11ad <PrintBar+0x7d>
movsbl 0x4(%rsp),%r14d
mov    %r12d,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14d,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    11a0 <PrintBar+0x70>
test   %r13d,%r13d
jle    11c3 <PrintBar+0x93>
lea    0xe47(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
add    %r13d,%r12d
cmp    %ebx,%r12d
jg     11eb <PrintBar+0xbb>
not    %ebx
add    %r12d,%ebx
movsbl 0x4(%rsp),%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%edi
call   1030 <putchar@plt>
inc    %ebx
jne    11e0 <PrintBar+0xb0>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" %s \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @PrintBar(i32 %0, i32 %1, i8 signext %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8 %2, i8* %7
store i8* %3, i8** %8
%12 = load i8*, i8** %8
%13 = call i32 @strlen(i8* %12)
store i32 %13, i32* %11
%14 = load i32, i32* %11
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %4
%17 = load i32, i32* %11
%18 = add nsw i32 %17, 2
store i32 %18, i32* %11
br label %19
19: ; preds = %16, %4
%20 = load i32, i32* %6
%21 = load i32, i32* %11
%22 = sub nsw i32 %20, %21
%23 = sdiv i32 %22, 2
store i32 %23, i32* %10
store i32 1, i32* %9
br label %24
24: ; preds = %30, %19
%25 = load i32, i32* %9
%26 = load i32, i32* %5
%27 = icmp sle i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 @putchar(i8 signext 32)
br label %30
30: ; preds = %28
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
br label %24
33: ; preds = %24
store i32 1, i32* %9
br label %34
34: ; preds = %41, %33
%35 = load i32, i32* %9
%36 = load i32, i32* %10
%37 = icmp sle i32 %35, %36
br i1 %37, label %38, label %44
38: ; preds = %34
%39 = load i8, i8* %7
%40 = call i32 @putchar(i8 signext %39)
br label %41
41: ; preds = %38
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
store i32 %43, i32* %9
br label %34
44: ; preds = %34
%45 = load i32, i32* %11
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = load i8*, i8** %8
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %47, %44
%51 = load i32, i32* %10
%52 = load i32, i32* %11
%53 = add nsw i32 %51, %52
store i32 %53, i32* %9
br label %54
54: ; preds = %61, %50
%55 = load i32, i32* %9
%56 = load i32, i32* %6
%57 = icmp sle i32 %55, %56
br i1 %57, label %58, label %64
58: ; preds = %54
%59 = load i8, i8* %7
%60 = call i32 @putchar(i8 signext %59)
br label %61
61: ; preds = %58
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 1
store i32 %63, i32* %9
br label %54
64: ; preds = %54
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

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