#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 */
struct option {
  char *name;
  int val;
  scalar_t__ has_arg;
  int /*<<< orphan*/ flag;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_usage(struct option *long_option, const char *prog_name) {
  int opt_index;
  printf("Usage: %s", prog_name);
  for (opt_index = 0; opt_index < 7; opt_index++) {
    printf(" --%s", long_option[opt_index].name);
    if (!long_option[opt_index].flag && long_option[opt_index].val) {
      printf(" (-%c)", long_option[opt_index].val);
    }
    if (long_option[opt_index].has_arg)
      printf(" <value>");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    11f0 <print_usage+0xe0>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
mov    (%rax),%rsi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
cmpl   $0x0,0x18(%rax)
jne    11b5 <print_usage+0xa5>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
cmpl   $0x0,0x8(%rax)
je     11b5 <print_usage+0xa5>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
mov    0x8(%rax),%esi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
cmpq   $0x0,0x10(%rax)
je     11dd <print_usage+0xcd>
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e2 <print_usage+0xd2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1139 <print_usage+0x29>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdi,%r13
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x18,%ebx
lea    0xec4(%rip),%r14
lea    0xec3(%rip),%r15
lea    0xec3(%rip),%r12
jmp    116d <print_usage+0x4d>
cs nopw 0x0(%rax,%rax,1)
add    $0x20,%rbx
cmp    $0xf8,%rbx
je     11ab <print_usage+0x8b>
mov    -0x18(%r13,%rbx,1),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x0(%r13,%rbx,1)
jne    1197 <print_usage+0x77>
mov    -0x10(%r13,%rbx,1),%esi
test   %esi,%esi
je     1197 <print_usage+0x77>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpq   $0x0,-0x8(%r13,%rbx,1)
je     1160 <print_usage+0x40>
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1160 <print_usage+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

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