#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*/ ATKprintf(char *, ...);
int strlen(char *);
void bar(char *s) {
  int i, len, n;
  len = strlen(s);
  n = (80 - len) / 2;
  ATKprintf("\n");
  for (i = 0; i < n; i++)
    ATKprintf("=");
  ATKprintf("%s", s);
  for (i = 0; i < n; i++)
    ATKprintf("=");
  ATKprintf("\n");
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    $0x50,%eax
sub    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <ATKprintf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1188 <bar+0x68>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <ATKprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <bar+0x40>
mov    -0x8(%rbp),%rsi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1040 <ATKprintf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11c9 <bar+0xa9>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <ATKprintf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a1 <bar+0x81>
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1040 <ATKprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %eax,%r15d
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <ATKprintf@plt>
cmp    $0x4f,%r15d
jge    11c1 <bar+0xa1>
mov    $0x50,%eax
sub    %r15d,%eax
mov    %eax,%r12d
shr    $0x1f,%r12d
add    %eax,%r12d
sar    %r12d
cmp    $0x2,%r12d
mov    $0x1,%ebp
cmovge %r12d,%ebp
lea    0xe92(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <ATKprintf@plt>
add    $0xffffffff,%ebp
jne    1170 <bar+0x50>
lea    0xe7e(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <ATKprintf@plt>
cmp    $0x4e,%r15d
jg     11d2 <bar+0xb2>
cmp    $0x2,%r12d
mov    $0x1,%ebp
cmovge %r12d,%ebp
lea    0xe58(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <ATKprintf@plt>
add    $0xffffffff,%ebp
jne    11b0 <bar+0x90>
jmp    11d2 <bar+0xb2>
lea    0xe3c(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <ATKprintf@plt>
lea    0xe27(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <ATKprintf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [2 x i8] c"=\00"
@.str.2 = [3 x i8] c"%s\00"
define void @bar(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = sub nsw i32 80, %8
%10 = sdiv i32 %9, 2
store i32 %10, i32* %5
%11 = call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %12
12: ; preds = %18, %1
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %12
21: ; preds = %12
%22 = load i8*, i8** %2
%23 = call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %22)
store i32 0, i32* %3
br label %24
24: ; preds = %30, %21
%25 = load i32, i32* %3
%26 = load i32, i32* %5
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %33
28: ; preds = %24
%29 = call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %24
33: ; preds = %24
%34 = call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [2 x i8] c"=\00"
@.str.2 = [3 x i8] c"%s\00"
define void @bar(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = sub nsw i32 80, %2
%4 = sdiv i32 %3, 2
%5 = tail call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp slt i32 %2, 79
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %25
9: ; preds = %1
%10 = call i32 @llvm.smax.i32(i32 %4, i32 1)
br label %11
11: ; preds = %9, %11
%12 = phi i32 [ %14, %11 ], [ 0, %9 ]
%13 = tail call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %10
br i1 %15, label %16, label %11
16: ; preds = %11
%17 = tail call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br i1 %6, label %18, label %25
18: ; preds = %16
%19 = call i32 @llvm.smax.i32(i32 %4, i32 1)
br label %20
20: ; preds = %18, %20
%21 = phi i32 [ %23, %20 ], [ 0, %18 ]
%22 = tail call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = add nuw nsw i32 %21, 1
%24 = icmp eq i32 %23, %19
br i1 %24, label %25, label %20
25: ; preds = %20, %7, %16
%26 = tail call i32 (i8*, ...) @ATKprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}