main(argc, argv) int argc;
char *argv[];
{
  if (argc != 2) {
    printf("Usage:\n");
    printf("  help program\n");
    printf("where program is the name of a Vis5d utility\n");
    exit(0);
  }
  if (strcmp(argv[1], "vis5d") == 0) {
    printf("For help on vis5d usage just type vis5d\n");
    exit(0);
  }
  if (print_help("./util", argv[1], ".f"))
    exit(0);
  if (print_help("./util", argv[1], ".c"))
    exit(0);
  printf("no help for %s\n", argv[1]);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1191 <main+0x51>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xea6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c3 <main+0x83>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xea3(%rip),%rdi
lea    0xea3(%rip),%rdx
mov    $0x0,%al
call   1050 <print_help@plt>
cmp    $0x0,%eax
je     11f0 <main+0xb0>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe76(%rip),%rdi
lea    0xe79(%rip),%rdx
mov    $0x0,%al
call   1050 <print_help@plt>
cmp    $0x0,%eax
je     121d <main+0xdd>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jne    117c <main+0x2c>
mov    %rsi,%r14
mov    0x8(%rsi),%rbx
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    11a7 <main+0x57>
lea    0xea3(%rip),%rdi
jmp    119b <main+0x4b>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
lea    0xe52(%rip),%rdi
lea    0xe52(%rip),%rdx
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <print_help@plt>
test   %eax,%eax
jne    11f2 <main+0xa2>
mov    0x8(%r14),%rsi
lea    0xe32(%rip),%rdi
lea    0xe35(%rip),%rdx
xor    %eax,%eax
call   1060 <print_help@plt>
test   %eax,%eax
jne    11f2 <main+0xa2>
mov    0x8(%r14),%rsi
lea    0xe22(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [16 x i8] c" help program\0A\00"
@.str.2 = [46 x i8] c"where program is the name of a Vis5d utility\0A\00"
@.str.3 = [6 x i8] c"vis5d\00"
@.str.4 = [41 x i8] c"For help on vis5d usage just type vis5d\0A\00"
@.str.5 = [7 x i8] c"./util\00"
@.str.6 = [3 x i8] c".f\00"
@.str.7 = [3 x i8] c".c\00"
@.str.8 = [16 x i8] c"no help for %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @strcmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0))
unreachable
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @print_help to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %20
unreachable
27: ; preds = %20
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @print_help to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %34
33: ; preds = %27
unreachable
34: ; preds = %27
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 1
%37 = load i8*, i8** %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* %37)
unreachable
}

LLVM IR (-O2):
@.str.3 = [6 x i8] c"vis5d\00"
@.str.5 = [7 x i8] c"./util\00"
@.str.6 = [3 x i8] c".f\00"
@.str.7 = [3 x i8] c".c\00"
@.str.8 = [16 x i8] c"no help for %s\0A\00"
@str = [40 x i8] c"For help on vis5d usage just type vis5d\00"
@str.9 = [7 x i8] c"Usage:\00"
@str.10 = [15 x i8] c" help program\00"
@str.11 = [45 x i8] c"where program is the name of a Vis5d utility\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.10, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str.11, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %10, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
tail call void @exit(i32 0)
unreachable
15: ; preds = %8
%16 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @print_help to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %15
tail call void @exit(i32 0)
unreachable
19: ; preds = %15
%20 = load i8*, i8** %9
%21 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @print_help to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%22 = icmp eq i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %19
tail call void @exit(i32 0)
unreachable
24: ; preds = %19
%25 = load i8*, i8** %9
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* %25)
tail call void @exit(i32 0)
unreachable
}