#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void testArguments(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "Numero invalido de argumentos. (%d)\n", argc - 1);
    fprintf(stderr, "ERRO: Não forneceu a porta do socket!\n");
    exit(-1);
  } else if (argc > 2) {
    fprintf(stderr, "Numero invalido de argumentos. (%d)\n", argc - 1);
    fprintf(stderr, "ERRO: Forneceu argumentos demais! Esperado 1\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<testArguments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    1177 <testArguments+0x57>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
cmpl   $0x2,-0x4(%rbp)
jle    11bf <testArguments+0x9f>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
lea    0xe69(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
jmp    11c4 <testArguments+0xa4>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testArguments>:
push   %rbx
mov    %edi,%edx
cmp    $0x1,%edi
jle    112f <testArguments+0xf>
cmp    $0x2,%edx
jne    1154 <testArguments+0x34>
pop    %rbx
ret
mov    0x2eaa(%rip),%rbx
mov    (%rbx),%edi
add    $0xffffffff,%edx
lea    0xebe(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed3(%rip),%rsi
jmp    1177 <testArguments+0x57>
mov    0x2e85(%rip),%rbx
mov    (%rbx),%edi
add    $0xffffffff,%edx
lea    0xe99(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed6(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Numero invalido de argumentos. (%d)\0A\00"
@.str.1 = [40 x i8] c"ERRO: N\C3\A3o forneceu a porta do socket!\0A\00"
@.str.2 = [46 x i8] c"ERRO: Forneceu argumentos demais! Esperado 1\0A\00"
define void @testArguments(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 2
br i1 %6, label %7, label %15
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i32, i32* %3
%10 = sub nsw i32 %9, 1
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 @exit(i32 -1)
unreachable
15: ; preds = %2
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 2
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32, i32* @stderr
%20 = load i32, i32* %3
%21 = sub nsw i32 %20, 1
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @exit(i32 -1)
unreachable
26: ; preds = %15
br label %27
27: ; preds = %26
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Numero invalido de argumentos. (%d)\0A\00"
@.str.1 = [40 x i8] c"ERRO: N\C3\A3o forneceu a porta do socket!\0A\00"
@.str.2 = [46 x i8] c"ERRO: Forneceu argumentos demais! Esperado 1\0A\00"
define void @testArguments(i32 %0, i8** nocapture readnone %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = add nsw i32 %0, -1
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = icmp eq i32 %0, 2
br i1 %12, label %20, label %13
13: ; preds = %11
%14 = load i32, i32* @stderr
%15 = add nsw i32 %0, -1
%16 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %11
ret void
}