#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*/ memcpy(char *, char *, int);
void strcut(char *data, int free_space, int data_size) {
  char new_data[data_size];
  int i;
  for (i = free_space; i < data_size; i++) {
    new_data[i - free_space] = data[i];
  }
  memcpy(data, new_data, data_size - free_space);
}


x86 assembly (clang, -O0):
<strcut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1183 <strcut+0x73>
mov    -0x30(%rbp),%rax
mov    -0x8(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
mov    -0x24(%rbp),%ecx
sub    -0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114e <strcut+0x3e>
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
sub    -0xc(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcut>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    %edx,%ecx
mov    %rsp,%rbx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rbx
mov    %rbx,%rsp
mov    %edx,%r15d
sub    %esi,%r15d
jle    1153 <strcut+0x43>
mov    %esi,%eax
movslq %esi,%rsi
add    %r14,%rsi
not    %eax
add    %edx,%eax
add    $0x1,%rax
mov    %rbx,%rdi
mov    %rax,%rdx
call   1030 <memcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1030 <memcpy@plt>
lea    -0x18(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @strcut(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %6
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %7
%13 = alloca i8, i64 %11
store i64 %11, i64* %8
%14 = load i32, i32* %5
store i32 %14, i32* %9
br label %15
15: ; preds = %30, %3
%16 = load i32, i32* %9
%17 = load i32, i32* %6
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %33
19: ; preds = %15
%20 = load i8*, i8** %4
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = load i32, i32* %9
%26 = load i32, i32* %5
%27 = sub nsw i32 %25, %26
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %13, i64 %28
store i8 %24, i8* %29
br label %30
30: ; preds = %19
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
store i32 %32, i32* %9
br label %15
33: ; preds = %15
%34 = load i8*, i8** %4
%35 = load i32, i32* %6
%36 = load i32, i32* %5
%37 = sub nsw i32 %35, %36
%38 = call i32 @memcpy(i8* %34, i8* %13, i32 %37)
%39 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
define void @strcut(i8* %0, i32 %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = alloca i8, i64 %4
%6 = icmp sgt i32 %2, %1
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = sext i32 %1 to i64
%9 = getelementptr i8, i8* %0, i64 %8
%10 = xor i32 %1, -1
%11 = add i32 %10, %2
%12 = zext i32 %11 to i64
%13 = add nuw nsw i64 %12, 1
br label %14
14: ; preds = %7, %3
%15 = sub nsw i32 %2, %1
%16 = call i32 @memcpy(i8* %0, i8* %5, i32 %15)
ret void
}