#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 EOF;
int atoi(char *);
int /*<<< orphan*/ exit(int);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(int);
int main(int argc, char *argv[]) {
  if (argc == 1) {
    printf("you must supply a filename to read's\n");
    exit(1);
  }
  char *input = argv[1];
  int c = atoi(input);
  while ((c = getchar()) != EOF) {
    putchar(c);
  }
  printf("el numero que has ingresado %d\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1188 <main+0x38>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e37(%rip),%rcx
cmp    (%rcx),%eax
je     11c6 <main+0x76>
mov    -0x1c(%rbp),%edi
call   1030 <putchar@plt>
jmp    11a0 <main+0x50>
mov    -0x1c(%rbp),%esi
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
je     1196 <main+0x46>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e84(%rip),%rbx
cmp    (%rbx),%eax
je     1182 <main+0x32>
nopl   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
jne    1170 <main+0x20>
lea    0xe77(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret
lea    0xe83(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"you must supply a filename to read's\0A\00"
@EOF = global i32 0
@.str.1 = [32 x i8] c"el numero que has ingresado %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %7
br label %19
19: ; preds = %23, %13
%20 = call i32 (...) @getchar()
store i32 %20, i32* %7
%21 = load i32, i32* @EOF
%22 = icmp ne i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %7
%25 = call i32 @putchar(i32 %24)
br label %19
26: ; preds = %19
%27 = load i32, i32* %7
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i32 0
@.str.1 = [32 x i8] c"el numero que has ingresado %d\0A\00"
@str = [37 x i8] c"you must supply a filename to read's\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = tail call i32 (...) @getchar()
%6 = load i32, i32* @EOF
%7 = icmp eq i32 %5, %6
br i1 %7, label %17, label %11
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %4, %11
%12 = phi i32 [ %14, %11 ], [ %5, %4 ]
%13 = tail call i32 @putchar(i32 %12)
%14 = tail call i32 (...) @getchar()
%15 = load i32, i32* @EOF
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %11
17: ; preds = %11, %4
%18 = phi i32 [ %5, %4 ], [ %14, %11 ]
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %18)
ret i32 0
}