#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*/ printf_s(char *, ...);
int main(int argc, char *argv[]) {
  if (1 == argc) {
    printf_s("objinfo %s (c) 2015 Adrian Oboroc "
             "https://github.com/oboroc/msobjutils/ (%s)\n\n",
             "0.0.1-pre1", "Mar 16 2022");
    printf_s("Print information about obj file: objinfo file.obj\n");
    return 1;
  }
  if (2 != argc) {
    printf_s("Error in main(): wrong number of parameters. Type objinfo for "
             "usage.\n");
    return 2;
  }
  printf_s("TODO: analyze file %s\n", argv[1]);
  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)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
jne    116a <main+0x5a>
lea    0xec5(%rip),%rdi
lea    0xf0d(%rip),%rsi
lea    0xf11(%rip),%rdx
mov    $0x0,%al
call   1030 <printf_s@plt>
lea    0xf0f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf_s@plt>
movl   $0x1,-0x4(%rbp)
jmp    11af <main+0x9f>
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     1192 <main+0x82>
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf_s@plt>
movl   $0x2,-0x4(%rbp)
jmp    11af <main+0x9f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xf3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf_s@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
je     114c <main+0x3c>
cmp    $0x1,%edi
jne    1162 <main+0x52>
lea    0xede(%rip),%rdi
lea    0xf26(%rip),%rsi
lea    0xf2a(%rip),%rdx
xor    %eax,%eax
call   1030 <printf_s@plt>
lea    0xf28(%rip),%rdi
xor    %eax,%eax
call   1030 <printf_s@plt>
mov    $0x1,%ebx
jmp    1175 <main+0x65>
mov    0x8(%rsi),%rsi
lea    0xf89(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf_s@plt>
jmp    1175 <main+0x65>
lea    0xf31(%rip),%rdi
xor    %eax,%eax
call   1030 <printf_s@plt>
mov    $0x2,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [79 x i8] c"objinfo %s (c) 2015 Adrian Oboroc https://github.com/oboroc/msobjutils/ (%s)\0A\0A\00"
@.str.1 = [11 x i8] c"0.0.1-pre1\00"
@.str.2 = [12 x i8] c"Mar 16 2022\00"
@.str.3 = [52 x i8] c"Print information about obj file: objinfo file.obj\0A\00"
@.str.4 = [70 x i8] c"Error in main(): wrong number of parameters. Type objinfo for usage.\0A\00"
@.str.5 = [23 x i8] c"TODO: analyze file %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 eq i32 1, %6
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf_s(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf_s(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %21
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp ne i32 2, %12
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (i8*, ...) @printf_s(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.4, i64 0, i64 0))
store i32 2, i32* %3
br label %21
16: ; preds = %11
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf_s(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %19)
store i32 0, i32* %3
br label %21
21: ; preds = %16, %14, %8
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [79 x i8] c"objinfo %s (c) 2015 Adrian Oboroc https://github.com/oboroc/msobjutils/ (%s)\0A\0A\00"
@.str.1 = [11 x i8] c"0.0.1-pre1\00"
@.str.2 = [12 x i8] c"Mar 16 2022\00"
@.str.3 = [52 x i8] c"Print information about obj file: objinfo file.obj\0A\00"
@.str.4 = [70 x i8] c"Error in main(): wrong number of parameters. Type objinfo for usage.\0A\00"
@.str.5 = [23 x i8] c"TODO: analyze file %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %6 [
i32 1, label %3
i32 2, label %8
]
3: ; preds = %2
%4 = tail call i32 (i8*, ...) @printf_s(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf_s(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
br label %12
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf_s(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.4, i64 0, i64 0))
br label %12
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 (i8*, ...) @printf_s(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %8, %6, %3
%13 = phi i32 [ 1, %3 ], [ 2, %6 ], [ 0, %8 ]
ret i32 %13
}