#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*/ printf(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int ler_parametros(int argc, char **argv, char *nome_entrada, char *nome_saida,
                   int *semente) {
  if (argc != 4) {
    printf("Erro: Parametros invalidos. Entrar com semente "
           "nome_de_arquivo_entrada nome_de_arquivo_de_saida");
    return 0;
  }
  *semente = atoi(argv[1]);
  strcpy(nome_entrada, argv[2]);
  strcpy(nome_saida, argv[3]);
  return 1;
}


x86 assembly (clang, -O0):
<ler_parametros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     116d <ler_parametros+0x3d>
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11ab <ler_parametros+0x7b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ler_parametros>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    1175 <ler_parametros+0x45>
mov    %r8,%r12
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,(%r12)
mov    0x10(%rbx),%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
mov    0x18(%rbx),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    $0x1,%eax
jmp    1183 <ler_parametros+0x53>
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [96 x i8] c"Erro: Parametros invalidos. Entrar com semente nome_de_arquivo_entrada nome_de_arquivo_de_saida\00"
define i32 @ler_parametros(i32 %0, i8** %1, i8* %2, i8* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32*
store i32 %0, i32* %7
store i8** %1, i8*** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32* %4, i32** %11
%12 = load i32, i32* %7
%13 = icmp ne i32 %12, 4
br i1 %13, label %14, label %16
14: ; preds = %5
%15 = call i32 @printf(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %32
16: ; preds = %5
%17 = load i8**, i8*** %8
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = load i32*, i32** %11
store i32 %20, i32* %21
%22 = load i8*, i8** %9
%23 = load i8**, i8*** %8
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @strcpy(i8* %22, i8* %25)
%27 = load i8*, i8** %10
%28 = load i8**, i8*** %8
%29 = getelementptr inbounds i8*, i8** %28, i64 3
%30 = load i8*, i8** %29
%31 = call i32 @strcpy(i8* %27, i8* %30)
store i32 1, i32* %6
br label %32
32: ; preds = %16, %14
%33 = load i32, i32* %6
ret i32 %33
}

LLVM IR (-O2):
@.str = [96 x i8] c"Erro: Parametros invalidos. Entrar com semente nome_de_arquivo_entrada nome_de_arquivo_de_saida\00"
define i32 @ler_parametros(i32 %0, i8** nocapture %1, i8* %2, i8* %3, i32* nocapture writeonly %4) {
%6 = icmp eq i32 %0, 4
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0))
br label %19
9: ; preds = %5
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
store i32 %12, i32* %4
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @strcpy(i8* %2, i8* %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 3
%17 = load i8*, i8** %16
%18 = tail call i32 @strcpy(i8* %3, i8* %17)
br label %19
19: ; preds = %9, %7
%20 = phi i32 [ 0, %7 ], [ 1, %9 ]
ret i32 %20
}