void print_attr_name(const char *name, int indent) {
  int len;
  printf("%*s%s:", indent, "", name);
  len = strlen(name) + 1;
  printf("%*s", (len > 16) ? 0 : 16 - len, "");
}


x86 assembly (clang, -O0):
<print_attr_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rcx
lea    0xec3(%rip),%rdi
lea    0xec2(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%rax
mov    %eax,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jle    116f <print_attr_name+0x4f>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    117a <print_attr_name+0x5a>
mov    $0x10,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe83(%rip),%rdi
lea    0xe7b(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_attr_name>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
lea    0xed2(%rip),%rdi
lea    0xed1(%rip),%r14
xor    %ebp,%ebp
mov    %r14,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    $0xf,%esi
sub    %eax,%esi
add    $0x1,%eax
cmp    $0x11,%eax
cmovge %ebp,%esi
lea    0xea4(%rip),%rdi
mov    %r14,%rdx
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"%*s%s:\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [4 x i8] c"%*s\00"
define void @print_attr_name(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %3
%10 = call i64 @strlen(i8* %9)
%11 = add i64 %10, 1
%12 = trunc i64 %11 to i32
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 16
br i1 %14, label %15, label %16
15: ; preds = %2
br label %19
16: ; preds = %2
%17 = load i32, i32* %5
%18 = sub nsw i32 16, %17
br label %19
19: ; preds = %16, %15
%20 = phi i32 [ 0, %15 ], [ %18, %16 ]
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%*s%s:\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [4 x i8] c"%*s\00"
define void @print_attr_name(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%5 = trunc i64 %4 to i32
%6 = add i32 %5, 1
%7 = icmp sgt i32 %6, 16
%8 = sub i32 15, %5
%9 = select i1 %7, i32 0, i32 %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret void
}