#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*/ logGenericOptions();
int /*<<< orphan*/ logMsg(char *, ...);
void logCmdHelpEx(const char *aCmd, char *aArgs[], char *aArgDescs[]) {
  int i;
  logMsg("Usage: %s [options]", aCmd);
  for (i = 0; aArgs[i]; i++)
    logMsg(" %s", aArgs[i]);
  logMsg("\n");
  for (i = 0; aArgDescs[i]; i++)
    logMsg("%s\n", aArgDescs[i]);
  logGenericOptions();
}


x86 assembly (clang, -O0):
<logCmdHelpEx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <logMsg@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1188 <logCmdHelpEx+0x68>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <logMsg@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114d <logCmdHelpEx+0x2d>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1040 <logMsg@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     11d8 <logCmdHelpEx+0xb8>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <logMsg@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    119d <logCmdHelpEx+0x7d>
mov    $0x0,%al
call   1030 <logGenericOptions@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logCmdHelpEx>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rsi
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <logMsg@plt>
mov    (%rbx),%rsi
test   %rsi,%rsi
je     1166 <logCmdHelpEx+0x46>
add    $0x8,%rbx
lea    0xec5(%rip),%r15
nop
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <logMsg@plt>
mov    (%rbx),%rsi
add    $0x8,%rbx
test   %rsi,%rsi
jne    1150 <logCmdHelpEx+0x30>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1040 <logMsg@plt>
mov    (%r14),%rsi
test   %rsi,%rsi
je     11a6 <logCmdHelpEx+0x86>
add    $0x8,%r14
lea    0xe91(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <logMsg@plt>
mov    (%r14),%rsi
add    $0x8,%r14
test   %rsi,%rsi
jne    1190 <logCmdHelpEx+0x70>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <logGenericOptions@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Usage: %s [options]\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @logCmdHelpEx(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%8 = load i8*, i8** %4
%9 = call i32 (i8*, ...) @logMsg(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %8)
store i32 0, i32* %7
br label %10
10: ; preds = %24, %3
%11 = load i8**, i8*** %5
%12 = load i32, i32* %7
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %27
17: ; preds = %10
%18 = load i8**, i8*** %5
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 (i8*, ...) @logMsg(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %22)
br label %24
24: ; preds = %17
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %10
27: ; preds = %10
%28 = call i32 (i8*, ...) @logMsg(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %29
29: ; preds = %43, %27
%30 = load i8**, i8*** %6
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %46
36: ; preds = %29
%37 = load i8**, i8*** %6
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %37, i64 %39
%41 = load i8*, i8** %40
%42 = call i32 (i8*, ...) @logMsg(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %41)
br label %43
43: ; preds = %36
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
store i32 %45, i32* %7
br label %29
46: ; preds = %29
%47 = call i32 (...) @logGenericOptions()
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Usage: %s [options]\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [4 x i8] c"%s\0A\00"
define void @logCmdHelpEx(i8* %0, i8** nocapture %1, i8** nocapture %2) {
%4 = tail call i32 (i8*, ...) @logMsg(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = load i8*, i8** %1
%6 = icmp eq i8* %5, null
br i1 %6, label %15, label %7
7: ; preds = %3, %7
%8 = phi i64 [ %11, %7 ], [ 0, %3 ]
%9 = phi i8* [ %13, %7 ], [ %5, %3 ]
%10 = tail call i32 (i8*, ...) @logMsg(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = add nuw i64 %8, 1
%12 = getelementptr inbounds i8*, i8** %1, i64 %11
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = tail call i32 (i8*, ...) @logMsg(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = load i8*, i8** %2
%18 = icmp eq i8* %17, null
br i1 %18, label %27, label %19
19: ; preds = %15, %19
%20 = phi i64 [ %23, %19 ], [ 0, %15 ]
%21 = phi i8* [ %25, %19 ], [ %17, %15 ]
%22 = tail call i32 (i8*, ...) @logMsg(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %21)
%23 = add nuw i64 %20, 1
%24 = getelementptr inbounds i8*, i8** %2, i64 %23
%25 = load i8*, i8** %24
%26 = icmp eq i8* %25, null
br i1 %26, label %27, label %19
27: ; preds = %19, %15
%28 = tail call i32 (...) @logGenericOptions()
ret void
}