#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*/ PrintError(char *);
int /*<<< orphan*/ PrintUsage(char *);
const char *IcnsFromArguments(int argc, char *argv[]) {
  if (argc < 2) {
    PrintError("No path given to icns file.");
    PrintUsage(argv[0]);
    return NULL;
  } else if (argc > 2) {
    PrintError("Too many arguments.");
    PrintUsage(argv[0]);
    return NULL;
  }
  return argv[1];
}


x86 assembly (clang, -O0):
<IcnsFromArguments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    115e <IcnsFromArguments+0x3e>
lea    0xec0(%rip),%rdi
call   1040 <PrintError@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <PrintUsage@plt>
movq   $0x0,-0x8(%rbp)
jmp    119e <IcnsFromArguments+0x7e>
cmpl   $0x2,-0xc(%rbp)
jle    118d <IcnsFromArguments+0x6d>
lea    0xead(%rip),%rdi
call   1040 <PrintError@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <PrintUsage@plt>
movq   $0x0,-0x8(%rbp)
jmp    119e <IcnsFromArguments+0x7e>
jmp    1192 <IcnsFromArguments+0x72>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IcnsFromArguments>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x1,%edi
jg     1132 <IcnsFromArguments+0x12>
lea    0xed0(%rip),%rdi
jmp    1144 <IcnsFromArguments+0x24>
cmp    $0x2,%edi
jne    113d <IcnsFromArguments+0x1d>
mov    0x8(%rbx),%rax
pop    %rbx
ret
lea    0xed8(%rip),%rdi
call   1040 <PrintError@plt>
mov    (%rbx),%rdi
call   1030 <PrintUsage@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"No path given to icns file.\00"
@.str.1 = [20 x i8] c"Too many arguments.\00"
define i8* @IcnsFromArguments(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = call i32 @PrintError(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = call i32 @PrintUsage(i8* %12)
store i8* null, i8** %3
br label %28
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 2
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = call i32 @PrintError(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @PrintUsage(i8* %21)
store i8* null, i8** %3
br label %28
23: ; preds = %14
br label %24
24: ; preds = %23
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
store i8* %27, i8** %3
br label %28
28: ; preds = %24, %17, %8
%29 = load i8*, i8** %3
ret i8* %29
}

LLVM IR (-O2):
@.str = [28 x i8] c"No path given to icns file.\00"
@.str.1 = [20 x i8] c"Too many arguments.\00"
define i8* @IcnsFromArguments(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 @PrintError(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %1
%7 = tail call i32 @PrintUsage(i8* %6)
br label %17
8: ; preds = %2
%9 = icmp eq i32 %0, 2
br i1 %9, label %14, label %10
10: ; preds = %8
%11 = tail call i32 @PrintError(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%12 = load i8*, i8** %1
%13 = tail call i32 @PrintUsage(i8* %12)
br label %17
14: ; preds = %8
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
br label %17
17: ; preds = %14, %10, %4
%18 = phi i8* [ null, %4 ], [ null, %10 ], [ %16, %14 ]
ret i8* %18
}