#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ puts(char *);
int main(int argc, char *argv[]) {
  FILE *fent = NULL;
  FILE *fsal = NULL;
  char cadena[200];
  int maximo = 200 - 1;
  if (argc != 3)
    puts("Se necesitan dos parametros: origen y destino\n");
  else {
    if ((fent = fopen(argv[1], "r")) == NULL)
      puts("No se puede abrir el fichero origen\n");
    else {
      if ((fsal = fopen(argv[2], "w")) == NULL)
        puts("No se puede abrir el fichero destino\n");
      else {
        fgets(cadena, maximo, fent);
        fputs(cadena, fsal);
        fclose(fsal);
      }
      fclose(fent);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0xc7,-0xf4(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     119e <main+0x4e>
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
jmp    1241 <main+0xf1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe82(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    11d1 <main+0x81>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
jmp    123c <main+0xec>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe76(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1204 <main+0xb4>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
jmp    1233 <main+0xe3>
lea    -0xf0(%rbp),%rdi
mov    -0xf4(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1060 <fgets@plt>
lea    -0xf0(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1050 <fputs@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1241 <main+0xf1>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xd0,%rsp
cmp    $0x3,%edi
jne    11bc <main+0x6c>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xec0(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11ca <main+0x7a>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
lea    0xecf(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11d8 <main+0x88>
mov    %rax,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0xc7,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <fputs@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
jmp    11e4 <main+0x94>
lea    0xe3d(%rip),%rdi
call   1030 <puts@plt>
jmp    11ec <main+0x9c>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
jmp    11ec <main+0x9c>
lea    0xe79(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Se necesitan dos parametros: origen y destino\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [37 x i8] c"No se puede abrir el fichero origen\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [38 x i8] c"No se puede abrir el fichero destino\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca [200 x i8]
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
store i32* null, i32** %7
store i32 199, i32* %9
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @puts(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %44
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %18, i32** %6
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = call i32 @puts(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %43
22: ; preds = %14
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %26, i32** %7
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @puts(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %40
30: ; preds = %22
%31 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%32 = load i32, i32* %9
%33 = load i32*, i32** %6
%34 = call i32 @fgets(i8* %31, i32 %32, i32* %33)
%35 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 0, i64 0
%36 = load i32*, i32** %7
%37 = call i32 @fputs(i8* %35, i32* %36)
%38 = load i32*, i32** %7
%39 = call i32 @fclose(i32* %38)
br label %40
40: ; preds = %30, %28
%41 = load i32*, i32** %6
%42 = call i32 @fclose(i32* %41)
br label %43
43: ; preds = %40, %20
br label %44
44: ; preds = %43, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"Se necesitan dos parametros: origen y destino\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [37 x i8] c"No se puede abrir el fichero origen\0A\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [38 x i8] c"No se puede abrir el fichero destino\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [200 x i8]
%4 = getelementptr inbounds [200 x i8], [200 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %28
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %28
15: ; preds = %8
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
br label %26
22: ; preds = %15
%23 = call i32 @fgets(i8* %4, i32 199, i32* %11)
%24 = call i32 @fputs(i8* %4, i32* %18)
%25 = call i32 @fclose(i32* %18)
br label %26
26: ; preds = %22, %20
%27 = call i32 @fclose(i32* %11)
br label %28
28: ; preds = %13, %26, %6
ret i32 0
}