#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*/ beep();
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printw(char *);
void strdel_a(int x, int y, int size, char array[size][size], int strbytes) {
  if ((y + strbytes) < size)
    memset(array[y] + x, ' ', strbytes);
  else {
    printw("error: deletion\n");
    beep();
  }
}


x86 assembly (clang, -O0):
<strdel_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118b <strdel_a+0x5b>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rdi
movslq -0x8(%rbp),%rax
imul   %rcx,%rax
add    %rax,%rdi
movslq -0x4(%rbp),%rax
add    %rax,%rdi
mov    -0x1c(%rbp),%edx
mov    $0x20,%esi
call   1030 <memset@plt>
jmp    119e <strdel_a+0x6e>
lea    0xe6e(%rip),%rdi
call   1050 <printw@plt>
mov    $0x0,%al
call   1040 <beep@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdel_a>:
lea    (%r8,%rsi,1),%eax
cmp    %edx,%eax
jge    1157 <strdel_a+0x27>
mov    %edx,%eax
movslq %esi,%rdx
imul   %rax,%rdx
add    %rdx,%rcx
movslq %edi,%rdi
add    %rcx,%rdi
mov    $0x20,%esi
mov    %r8d,%edx
jmp    1030 <memset@plt>
push   %rax
lea    0xea1(%rip),%rdi
call   1050 <printw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <beep@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"error: deletion\0A\00"
define void @strdel_a(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* %8
%12 = zext i32 %11 to i64
%13 = load i32, i32* %8
%14 = zext i32 %13 to i64
%15 = load i32, i32* %7
%16 = load i32, i32* %10
%17 = add nsw i32 %15, %16
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %31
20: ; preds = %5
%21 = load i8*, i8** %9
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = mul nsw i64 %23, %14
%25 = getelementptr inbounds i8, i8* %21, i64 %24
%26 = load i32, i32* %6
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i32, i32* %10
%30 = call i32 @memset(i8* %28, i8 signext 32, i32 %29)
br label %34
31: ; preds = %5
%32 = call i32 @printw(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%33 = call i32 (...) @beep()
br label %34
34: ; preds = %31, %20
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"error: deletion\0A\00"
define void @strdel_a(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4) {
%6 = add nsw i32 %4, %1
%7 = icmp slt i32 %6, %2
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = zext i32 %2 to i64
%10 = sext i32 %1 to i64
%11 = mul nsw i64 %9, %10
%12 = getelementptr inbounds i8, i8* %3, i64 %11
%13 = sext i32 %0 to i64
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = tail call i32 @memset(i8* %14, i8 signext 32, i32 %4)
br label %19
16: ; preds = %5
%17 = tail call i32 @printw(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%18 = tail call i32 (...) @beep()
br label %19
19: ; preds = %16, %8
ret void
}