int cmdline_help(int argc, char **argv) {
  int i;
  for (i = 1; i < argc; i++) {
    if (!strcmp(argv[i], "--help")) {
      printf("\n"
             "%s floorplan\n"
             "\n"
             "Usage: %s [--part=xc6slx9]\n"
             "       %*s [--package=tqg144|ftg256]\n"
             "       %*s [--help]\n",
             *argv, *argv, (int)strlen(*argv), "", (int)strlen(*argv), "");
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<cmdline_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ed <cmdline_help+0xbd>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe9b(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    11da <cmdline_help+0xaa>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%ecx
mov    %eax,%r9d
lea    0xe4e(%rip),%rdi
lea    0xeaa(%rip),%rax
mov    %rax,%r8
mov    %rax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f4 <cmdline_help+0xc4>
jmp    11df <cmdline_help+0xaf>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <cmdline_help+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdline_help>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
xor    %r14d,%r14d
cmp    $0x2,%edi
jl     11b1 <cmdline_help+0x81>
mov    %rsi,%r12
mov    %edi,%ebp
mov    $0x1,%ebx
lea    0xeab(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%rbx,8),%rdi
mov    %r15,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     117b <cmdline_help+0x4b>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <cmdline_help+0x30>
jmp    11b1 <cmdline_help+0x81>
mov    (%r12),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xedc(%rip),%r8
mov    %r8,(%rsp)
lea    0xe6e(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"--help\00"
@.str.1 = [100 x i8] c"\0A%s floorplan\0A\0AUsage: %s [--part=xc6slx9]\0A %*s [--package=tqg144|ftg256]\0A %*s [--help]\0A\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @cmdline_help(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
br label %7
7: ; preds = %34, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %37
11: ; preds = %7
%12 = load i8**, i8*** %5
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %12, i64 %14
%16 = load i8*, i8** %15
%17 = call i32 @strcmp(i8* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i32 %17, 0
br i1 %18, label %33, label %19
19: ; preds = %11
%20 = load i8**, i8*** %5
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = load i8*, i8** %24
%26 = call i64 @strlen(i8* %25)
%27 = trunc i64 %26 to i32
%28 = load i8**, i8*** %5
%29 = load i8*, i8** %28
%30 = call i64 @strlen(i8* %29)
%31 = trunc i64 %30 to i32
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %23, i32 %27, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 %31, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %38
33: ; preds = %11
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %7
37: ; preds = %7
store i32 0, i32* %3
br label %38
38: ; preds = %37, %19
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [7 x i8] c"--help\00"
@.str.1 = [100 x i8] c"\0A%s floorplan\0A\0AUsage: %s [--part=xc6slx9]\0A %*s [--package=tqg144|ftg256]\0A %*s [--help]\0A\00"
@.str.2 = [1 x i8] zeroinitializer
define i32 @cmdline_help(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %14, %5
br i1 %7, label %20, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 1, %4 ], [ %14, %6 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 @strcmp(i8* dereferenceable(1) %11, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32 %12, 0
%14 = add nuw nsw i64 %9, 1
br i1 %13, label %15, label %6
15: ; preds = %8
%16 = load i8*, i8** %1
%17 = tail call i64 @strlen(i8* dereferenceable(1) %16)
%18 = trunc i64 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([100 x i8], [100 x i8]* @.str.1, i64 0, i64 0), i8* %16, i8* %16, i32 %18, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i32 %18, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %6, %2, %15
%21 = phi i32 [ 1, %15 ], [ 0, %2 ], [ 0, %6 ]
ret i32 %21
}