void usage(char *exec) {
  int length = (int)strlen(exec);
  printf("%s (<port>)\n", exec);
  printf("%*s (-t|--template <template.json>)\n", length, "");
  printf("%*s (-v|--verbose)\n", length, "");
  printf("%*s (-h|--help)\n", length, "");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xeb9(%rip),%rdi
lea    0xed6(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xec6(%rip),%rdi
lea    0xebe(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xec2(%rip),%rdi
lea    0xea6(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rax,%r14
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    0xee3(%rip),%rbx
mov    %r14d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%s (<port>)\0A\00"
@.str.1 = [37 x i8] c"%*s (-t|--template <template.json>)\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [20 x i8] c"%*s (-v|--verbose)\0A\00"
@.str.4 = [17 x i8] c"%*s (-h|--help)\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = trunc i64 %5 to i32
store i32 %6, i32* %3
%7 = load i8*, i8** %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %13, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s (<port>)\0A\00"
@.str.1 = [37 x i8] c"%*s (-t|--template <template.json>)\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [20 x i8] c"%*s (-v|--verbose)\0A\00"
@.str.4 = [17 x i8] c"%*s (-h|--help)\0A\00"
define void @usage(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = trunc i64 %2 to i32
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
ret void
}