#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 atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void validaParametrosInput(int argc, char *argv[], int *cantVias) {
  if (argc != 2) {
    printf("\nDebe recibir el número de vias de peaje\n\n");
    exit(1);
  }
  int val = atoi(argv[1]);
  *cantVias = val;
  if (val < 0) {
    printf("\nEl nro de vias de peaje no cumple con los permitidos\n\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<validaParametrosInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1163 <validaParametrosInput+0x33>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
cmpl   $0x0,-0x1c(%rbp)
jge    119c <validaParametrosInput+0x6c>
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validaParametrosInput>:
push   %rbx
cmp    $0x2,%edi
jne    114a <validaParametrosInput+0x1a>
mov    %rdx,%rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,(%rbx)
test   %eax,%eax
js     1153 <validaParametrosInput+0x23>
pop    %rbx
ret
lea    0xee6(%rip),%rdi
jmp    115a <validaParametrosInput+0x2a>
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [44 x i8] c"\0ADebe recibir el n\C3\BAmero de vias de peaje\0A\0A\00"
@.str.1 = [56 x i8] c"\0AEl nro de vias de peaje no cumple con los permitidos\0A\0A\00"
define void @validaParametrosInput(i32 %0, i8** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* %2, i32** %6
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %3
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = load i32*, i32** %6
store i32 %18, i32* %19
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %13
%23 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %13
ret void
}

LLVM IR (-O2):
@str = [55 x i8] c"\0AEl nro de vias de peaje no cumple con los permitidos\0A\00"
@str.2 = [43 x i8] c"\0ADebe recibir el n\C3\BAmero de vias de peaje\0A\00"
define void @validaParametrosInput(i32 %0, i8** nocapture %1, i32* nocapture writeonly %2) {
%4 = icmp eq i32 %0, 2
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.2, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %3
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
store i32 %11, i32* %2
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %8
ret void
}