#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 */
char *cosm_lookup(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int print_usage(char **);
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  char *subpath;
  char *result;
  argc > 2 ? print_usage(argv), exit(-1) : 1;
  subpath = argv[1] ? argv[1] : "";
  result = cosm_lookup(subpath);
  if (result != NULL) {
    printf("%s\n", result);
    free(result);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1183 <main+0x33>
mov    -0x10(%rbp),%rdi
call   1060 <print_usage@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
jmp    1188 <main+0x38>
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
je     11a8 <main+0x58>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    11b8 <main+0x68>
lea    0xe54(%rip),%rax
mov    %rax,-0x28(%rbp)
jmp    11b8 <main+0x68>
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <cosm_lookup@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     11f1 <main+0xa1>
mov    -0x20(%rbp),%rsi
lea    0xe1d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3,%edi
jge    1190 <main+0x40>
mov    0x8(%rsi),%rax
test   %rax,%rax
lea    0xe9f(%rip),%rdi
cmovne %rax,%rdi
call   1070 <cosm_lookup@plt>
test   %rax,%rax
je     118c <main+0x3c>
mov    %rax,%rbx
lea    0xe84(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    %rsi,%rdi
call   1060 <print_usage@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = call i32 @print_usage(i8** %11)
%13 = call i32 @exit(i32 -1)
unreachable
14: ; No predecessors!
br label %16
15: ; preds = %2
br label %16
16: ; preds = %15, %14
%17 = phi i32 [ undef, %14 ], [ 1, %15 ]
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %26
22: ; preds = %16
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
br label %27
26: ; preds = %16
br label %27
27: ; preds = %26, %22
%28 = phi i8* [ %25, %22 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %26 ]
store i8* %28, i8** %6
%29 = load i8*, i8** %6
%30 = call i8* @cosm_lookup(i8* %29)
store i8* %30, i8** %7
%31 = load i8*, i8** %7
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %38
33: ; preds = %27
%34 = load i8*, i8** %7
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = load i8*, i8** %7
%37 = call i32 @free(i8* %36)
br label %38
38: ; preds = %33, %27
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @print_usage(i8** %1)
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = icmp eq i8* %9, null
%11 = select i1 %10, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %9
%12 = tail call i8* @cosm_lookup(i8* %11)
%13 = icmp eq i8* %12, null
br i1 %13, label %17, label %14
14: ; preds = %7
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%16 = tail call i32 @free(i8* %12)
br label %17
17: ; preds = %14, %7
ret i32 0
}