#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*/ interrupt(int, int, char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ neededSectors(int);
void copyCommand(char *args[]) {
  char buffer[(32 - 6) * 512];
  int charCount = 0;
  interrupt(0x21, 0x3, args[1], buffer, 0);
  while (buffer[charCount] != '\0' && charCount < (32 - 6) * 512) {
    charCount++;
  }
  charCount++;
  interrupt(0x21, 0x8, args[2], buffer, neededSectors(charCount));
  return;
}


x86 assembly (clang, -O0):
<copyCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3430,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x3414(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdx
lea    -0x3410(%rbp),%rcx
mov    $0x21,%edi
mov    $0x3,%esi
xor    %r8d,%r8d
call   1040 <interrupt@plt>
movslq -0x3414(%rbp),%rax
movsbl -0x3410(%rbp,%rax,1),%ecx
ff
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x3415(%rbp)
je     118d <copyCommand+0x6d>
cmpl   $0x3400,-0x3414(%rbp)
setl   %al
mov    %al,-0x3415(%rbp)
mov    -0x3415(%rbp),%al
test   $0x1,%al
jne    11a0 <copyCommand+0x80>
jmp    11b4 <copyCommand+0x94>
mov    -0x3414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3414(%rbp)
jmp    115a <copyCommand+0x3a>
mov    -0x3414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3414(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x3428(%rbp)
lea    -0x3410(%rbp),%rax
mov    %rax,-0x3420(%rbp)
mov    -0x3414(%rbp),%edi
call   1030 <neededSectors@plt>
mov    -0x3428(%rbp),%rdx
mov    -0x3420(%rbp),%rcx
mov    %eax,%r8d
mov    $0x21,%edi
mov    $0x8,%esi
call   1040 <interrupt@plt>
add    $0x3430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copyCommand>:
push   %r14
push   %rbx
sub    $0x3408,%rsp
mov    %rdi,%r14
mov    0x8(%rdi),%rdx
mov    %rsp,%rcx
xor    %ebx,%ebx
mov    $0x21,%edi
mov    $0x3,%esi
xor    %r8d,%r8d
call   1040 <interrupt@plt>
nopl   0x0(%rax,%rax,1)
lea    0x1(%rbx),%rdi
cmpb   $0x0,(%rsp,%rbx,1)
je     1166 <copyCommand+0x46>
cmp    $0x3400,%rbx
mov    %rdi,%rbx
jb     1150 <copyCommand+0x30>
mov    0x10(%r14),%rbx
call   1030 <neededSectors@plt>
mov    %rsp,%rcx
mov    $0x21,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
mov    %eax,%r8d
call   1040 <interrupt@plt>
add    $0x3408,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @copyCommand(i8** nocapture %0) {
%2 = alloca [13312 x i8]
%3 = getelementptr inbounds [13312 x i8], [13312 x i8]* %2, i64 0, i64 0
%4 = getelementptr inbounds i8*, i8** %0, i64 1
%5 = load i8*, i8** %4
%6 = call i32 @interrupt(i32 33, i32 3, i8* %5, i8* %3, i32 0)
br label %7
7: ; preds = %7, %1
%8 = phi i64 [ %14, %7 ], [ 0, %1 ]
%9 = getelementptr inbounds [13312 x i8], [13312 x i8]* %2, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
%12 = icmp ult i64 %8, 13312
%13 = select i1 %11, i1 %12, i1 false
%14 = add nuw nsw i64 %8, 1
br i1 %13, label %7, label %15
15: ; preds = %7
%16 = trunc i64 %8 to i32
%17 = add nuw nsw i32 %16, 1
%18 = getelementptr inbounds i8*, i8** %0, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @neededSectors(i32 %17)
%21 = call i32 @interrupt(i32 33, i32 8, i8* %19, i8* %3, i32 %20)
ret void
}