#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*/ O_RDONLY;
int copy_something(int *, int);
int /*<<< orphan*/ free(int *);
int *malloc(int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ read(int, int *, int);
int main(int argc, char **argv) {
  int *input;
  int ret;
  int len;
  int fd = open(argv[1], O_RDONLY);
  input = malloc(sizeof(int) * 80);
  read(fd, input, sizeof(int) * 80);
  len = input[0];
  ret = copy_something(input, len);
  free(input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x24(%rbp)
mov    $0x140,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x140,%edx
call   1050 <read@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1040 <copy_something@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x8(%rsi),%rdi
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,%ebp
mov    $0x140,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %rax,%rsi
mov    $0x140,%edx
call   1050 <read@plt>
mov    (%rbx),%esi
mov    %rbx,%rdi
call   1040 <copy_something@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* @O_RDONLY
%14 = call i32 @open(i8* %12, i32 %13)
store i32 %14, i32* %9
%15 = call i32* @malloc(i32 320)
store i32* %15, i32** %6
%16 = load i32, i32* %9
%17 = load i32*, i32** %6
%18 = call i32 @read(i32 %16, i32* %17, i32 320)
%19 = load i32*, i32** %6
%20 = getelementptr inbounds i32, i32* %19, i64 0
%21 = load i32, i32* %20
store i32 %21, i32* %8
%22 = load i32*, i32** %6
%23 = load i32, i32* %8
%24 = call i32 @copy_something(i32* %22, i32 %23)
store i32 %24, i32* %7
%25 = load i32*, i32** %6
%26 = call i32 @free(i32* %25)
ret i32 0
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = load i32, i32* @O_RDONLY
%6 = tail call i32 @open(i8* %4, i32 %5)
%7 = tail call i32* @malloc(i32 320)
%8 = tail call i32 @read(i32 %6, i32* %7, i32 320)
%9 = load i32, i32* %7
%10 = tail call i32 @copy_something(i32* %7, i32 %9)
%11 = tail call i32 @free(i32* %7)
ret i32 0
}