#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*/ ldd(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ readelf(char *);
int main(int argc, char **argv) {
  if (argc == 2) {
    ldd(argv[1]);
    printf("\n\n********************************************************TABLE "
           "VIEW OF LIBRARY "
           "DEPENDENCY*********************************************************"
           "****\n");
    readelf(argv[1]);
    printf("*******************************************************************"
           "*END***************************************************************"
           "***************\n");
  }
  if ((argc < 2) || (argc > 2))
    printf("Invalid Input\n");
  return 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)
jne    1182 <main+0x52>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <ldd@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <readelf@plt>
lea    0xf1c(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
jl     1196 <main+0x66>
cmpl   $0x2,-0x8(%rbp)
jle    11a2 <main+0x72>
lea    0xf93(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    1160 <main+0x30>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1040 <ldd@plt>
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
call   1050 <readelf@plt>
lea    0xf48(%rip),%rdi
jmp    1167 <main+0x37>
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [153 x i8] c"\0A\0A********************************************************TABLE VIEW OF LIBRARY DEPENDENCY*************************************************************\0A\00"
@.str.1 = [151 x i8] c"********************************************************************END******************************************************************************\0A\00"
@.str.2 = [15 x i8] c"Invalid Input\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 eq i32 %6, 2
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @ldd(i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([153 x i8], [153 x i8]* @.str, i64 0, i64 0))
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @readelf(i8* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.1, i64 0, i64 0))
br label %19
19: ; preds = %8, %2
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 2
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp sgt i32 %23, 2
br i1 %24, label %25, label %27
25: ; preds = %22, %19
%26 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %27
27: ; preds = %25, %22
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"Invalid Input\00"
@str.3 = [152 x i8] c"\0A\0A********************************************************TABLE VIEW OF LIBRARY DEPENDENCY*************************************************************\00"
@str.4 = [150 x i8] c"********************************************************************END******************************************************************************\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @ldd(i8* %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([152 x i8], [152 x i8]* @str.3, i64 0, i64 0))
%9 = load i8*, i8** %5
%10 = tail call i32 @readelf(i8* %9)
br label %11
11: ; preds = %2, %4
%12 = phi i8* [ getelementptr inbounds ([150 x i8], [150 x i8]* @str.4, i64 0, i64 0), %4 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0), %2 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %12)
ret i32 0
}