#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*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int strnlen(char *, int);
void send(char *line, FILE *executable) {
  char command[256];
  int length = strnlen(line, 256);
  for (int ii = 4; ii <= length; ii++)
    command[ii - 4] = line[ii];
  fprintf(executable, "%s", command);
}


x86 assembly (clang, -O0):
<send>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x100,%esi
call   1030 <strnlen@plt>
mov    %eax,-0x114(%rbp)
movl   $0x4,-0x118(%rbp)
mov    -0x118(%rbp),%eax
cmp    -0x114(%rbp),%eax
jg     1197 <send+0x77>
mov    -0x8(%rbp),%rax
movslq -0x118(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
mov    -0x118(%rbp),%eax
sub    $0x4,%eax
cltq
mov    %cl,-0x110(%rbp,%rax,1)
mov    -0x118(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x118(%rbp)
jmp    1151 <send+0x31>
mov    -0x10(%rbp),%rdi
lea    -0x110(%rbp),%rdx
lea    0xe57(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x100,%esi
call   1040 <strnlen@plt>
cmp    $0x4,%eax
jl     1164 <send+0x34>
add    $0x4,%rbx
add    $0xfffffffd,%eax
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1050 <memcpy@plt>
mov    %rsp,%rdi
mov    %r14,%rsi
call   1030 <fputs@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @send(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca [256 x i8]
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
%8 = load i8*, i8** %3
%9 = call i32 @strnlen(i8* %8, i32 256)
store i32 %9, i32* %6
store i32 4, i32* %7
br label %10
10: ; preds = %24, %2
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = load i32, i32* %7
%21 = sub nsw i32 %20, 4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 %22
store i8 %19, i8* %23
br label %24
24: ; preds = %14
%25 = load i32, i32* %7
%26 = add nsw i32 %25, 1
store i32 %26, i32* %7
br label %10
27: ; preds = %10
%28 = load i32*, i32** %4
%29 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%30 = call i32 @fprintf(i32* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %29)
ret void
}

LLVM IR (-O2):
define void @send(i8* %0, i32* nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @strnlen(i8* %0, i32 256)
%6 = icmp slt i32 %5, 4
br i1 %6, label %12, label %7
7: ; preds = %2
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%9 = getelementptr i8, i8* %0, i64 4
%10 = add nsw i32 %5, -3
%11 = zext i32 %10 to i64
br label %12
12: ; preds = %7, %2
%13 = call i32 @fputs(i8* %4, i32* %1)
ret void
}