#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*/ strcpy(char *, char *);
int strlen(char *);
void removeCharAt(int cursorPosition, char currentCommand[]) {
  char removedCharCommand[100] = "";
  int i = 0, j = 0;
  while (i < strlen(currentCommand)) {
    if (i != cursorPosition) {
      removedCharCommand[j] = currentCommand[i];
      j++;
    }
    i++;
  }
  strcpy(currentCommand, removedCharCommand);
}


x86 assembly (clang, -O0):
<removeCharAt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1050 <memset@plt>
movl   $0x0,-0x84(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x8c(%rbp),%eax
cmp    %ecx,%eax
jge    11d6 <removeCharAt+0xa6>
mov    -0x84(%rbp),%eax
cmp    -0x4(%rbp),%eax
je     11c2 <removeCharAt+0x92>
mov    -0x10(%rbp),%rax
movslq -0x84(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x88(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    1166 <removeCharAt+0x36>
mov    -0x10(%rbp),%rdi
lea    -0x80(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeCharAt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
xorps  %xmm0,%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x60(%rsp)
mov    %rsi,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1198 <removeCharAt+0x78>
mov    %ebp,%r14d
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1183 <removeCharAt+0x63>
nopl   0x0(%rax)
add    $0x1,%rbp
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    1198 <removeCharAt+0x78>
cmp    %rbp,%r14
je     1170 <removeCharAt+0x50>
movzbl (%r15,%rbp,1),%eax
movslq %ebx,%rbx
mov    %al,(%rsp,%rbx,1)
add    $0x1,%ebx
jmp    1170 <removeCharAt+0x50>
mov    %rsp,%rsi
mov    %r15,%rdi
call   1030 <strcpy@plt>
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @removeCharAt(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca [100 x i8]
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i8* %1, i8** %4
%8 = bitcast [100 x i8]* %5 to i8*
store i32 0, i32* %6
store i32 0, i32* %7
br label %9
9: ; preds = %29, %2
%10 = load i32, i32* %6
%11 = load i8*, i8** %4
%12 = call i32 @strlen(i8* %11)
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %32
14: ; preds = %9
%15 = load i32, i32* %6
%16 = load i32, i32* %3
%17 = icmp ne i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i8*, i8** %4
%20 = load i32, i32* %6
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 %25
store i8 %23, i8* %26
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %29
29: ; preds = %18, %14
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %9
32: ; preds = %9
%33 = load i8*, i8** %4
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%35 = call i32 @strcpy(i8* %33, i8* %34)
ret void
}

LLVM IR (-O2):
define void @removeCharAt(i32 %0, i8* %1) {
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @strlen(i8* %1)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %2
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %7, %19
%10 = phi i64 [ 0, %7 ], [ %21, %19 ]
%11 = phi i32 [ 0, %7 ], [ %20, %19 ]
%12 = icmp eq i64 %10, %8
br i1 %12, label %19, label %13
13: ; preds = %9
%14 = getelementptr inbounds i8, i8* %1, i64 %10
%15 = load i8, i8* %14
%16 = sext i32 %11 to i64
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %16
store i8 %15, i8* %17
%18 = add nsw i32 %11, 1
br label %19
19: ; preds = %13, %9
%20 = phi i32 [ %18, %13 ], [ %11, %9 ]
%21 = add nuw nsw i64 %10, 1
%22 = tail call i32 @strlen(i8* %1)
%23 = sext i32 %22 to i64
%24 = icmp slt i64 %21, %23
br i1 %24, label %9, label %25
25: ; preds = %19, %2
%26 = call i32 @strcpy(i8* %1, i8* %4)
ret void
}