unsigned long str$copy_r_64(struct dsc$descriptor_s *destination_string,
                            const unsigned short *word_integer_source_length,
                            const void *source_string_address) {
  unsigned short s1_length;
  unsigned long length;
  int s2_length;
  unsigned long result = 1;
  char *s1_ptr;
  s2_length = strlen(source_string_address);
  if ((result = str$$is_string_class(destination_string)) != 1) {
    assert(result && 0);
    return result;
  }
  length = *word_integer_source_length;
  result = str$$resize(destination_string, *word_integer_source_length);
  if (result == 1) {
    str$analyze_sdesc(destination_string, &s1_length, &s1_ptr);
    result =
        str$$copy_fill(s1_ptr, (unsigned int)s1_length, source_string_address,
                       (unsigned int)s2_length, ' ');
  }
  return result;
}


x86 assembly (clang, -O0):
<str$copy_r_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movq   $0x1,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <str$$is_string_class@plt>
cltq
mov    %rax,-0x40(%rbp)
cmp    $0x1,%rax
je     11d9 <str$copy_r_64+0x79>
xor    %eax,%eax
cmpq   $0x0,-0x40(%rbp)
mov    %al,-0x49(%rbp)
je     11bd <str$copy_r_64+0x5d>
xor    %eax,%eax
mov    %al,-0x49(%rbp)
jmp    11bd <str$copy_r_64+0x5d>
mov    -0x49(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1080 <assert@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1244 <str$copy_r_64+0xe4>
mov    -0x18(%rbp),%rax
movzwl (%rax),%eax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movzwl (%rax),%esi
mov    $0x0,%al
call   1070 <str$$resize@plt>
cltq
mov    %rax,-0x40(%rbp)
cmpq   $0x1,-0x40(%rbp)
jne    123c <str$copy_r_64+0xdc>
mov    -0x10(%rbp),%rdi
lea    -0x22(%rbp),%rsi
lea    -0x48(%rbp),%rdx
mov    $0x0,%al
call   1050 <str$analyze_sdesc@plt>
mov    -0x48(%rbp),%rdi
movzwl -0x22(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    $0x20,%r8d
mov    $0x0,%al
call   1060 <str$$copy_fill@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str$copy_r_64>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rdx,%rdi
call   1040 <strlen@plt>
mov    %rax,%r14
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <str$$is_string_class@plt>
cmp    $0x1,%eax
jne    11da <str$copy_r_64+0x7a>
movzwl (%r12),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <str$$resize@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
jne    11e5 <str$copy_r_64+0x85>
lea    0x6(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <str$analyze_sdesc@plt>
mov    0x8(%rsp),%rdi
movzwl 0x6(%rsp),%esi
mov    %r15,%rdx
mov    %r14d,%ecx
mov    $0x20,%r8d
xor    %eax,%eax
call   1060 <str$$copy_fill@plt>
mov    %eax,%ebp
jmp    11e5 <str$copy_r_64+0x85>
mov    %eax,%ebp
xor    %edi,%edi
xor    %eax,%eax
call   1080 <assert@plt>
movslq %ebp,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%"struct.dsc$descriptor_s" = type opaque
define i64 @"str$copy_r_64"(%"struct.dsc$descriptor_s"* %0, i16* %1, i8* %2) {
%4 = alloca i64
%5 = alloca %"struct.dsc$descriptor_s"*
%6 = alloca i16*
%7 = alloca i8*
%8 = alloca i16
%9 = alloca i64
%10 = alloca i32
%11 = alloca i64
%12 = alloca i8*
store %"struct.dsc$descriptor_s"* %0, %"struct.dsc$descriptor_s"** %5
store i16* %1, i16** %6
store i8* %2, i8** %7
store i64 1, i64* %11
%13 = load i8*, i8** %7
%14 = call i64 @strlen(i8* %13)
%15 = trunc i64 %14 to i32
store i32 %15, i32* %10
%16 = load %"struct.dsc$descriptor_s"*, %"struct.dsc$descriptor_s"** %5
%17 = call i32 (%"struct.dsc$descriptor_s"*, ...) bitcast (i32 (...)* @"str$$is_string_class" to i32 (%"struct.dsc$descriptor_s"*, ...)*)(%"struct.dsc$descriptor_s"* %16)
%18 = sext i32 %17 to i64
store i64 %18, i64* %11
%19 = icmp ne i64 %18, 1
br i1 %19, label %20, label %29
20: ; preds = %3
%21 = load i64, i64* %11
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
br label %24
24: ; preds = %23, %20
%25 = phi i1 [ false, %20 ], [ false, %23 ]
%26 = zext i1 %25 to i32
%27 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %26)
%28 = load i64, i64* %11
store i64 %28, i64* %4
br label %53
29: ; preds = %3
%30 = load i16*, i16** %6
%31 = load i16, i16* %30
%32 = zext i16 %31 to i64
store i64 %32, i64* %9
%33 = load %"struct.dsc$descriptor_s"*, %"struct.dsc$descriptor_s"** %5
%34 = load i16*, i16** %6
%35 = load i16, i16* %34
%36 = zext i16 %35 to i32
%37 = call i32 (%"struct.dsc$descriptor_s"*, i32, ...) bitcast (i32 (...)* @"str$$resize" to i32 (%"struct.dsc$descriptor_s"*, i32, ...)*)(%"struct.dsc$descriptor_s"* %33, i32 %36)
%38 = sext i32 %37 to i64
store i64 %38, i64* %11
%39 = load i64, i64* %11
%40 = icmp eq i64 %39, 1
br i1 %40, label %41, label %51
41: ; preds = %29
%42 = load %"struct.dsc$descriptor_s"*, %"struct.dsc$descriptor_s"** %5
%43 = call i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...) bitcast (i32 (...)* @"str$analyze_sdesc" to i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...)*)(%"struct.dsc$descriptor_s"* %42, i16* %8, i8** %12)
%44 = load i8*, i8** %12
%45 = load i16, i16* %8
%46 = zext i16 %45 to i32
%47 = load i8*, i8** %7
%48 = load i32, i32* %10
%49 = call i32 (i8*, i32, i8*, i32, i32, ...) bitcast (i32 (...)* @"str$$copy_fill" to i32 (i8*, i32, i8*, i32, i32, ...)*)(i8* %44, i32 %46, i8* %47, i32 %48, i32 32)
%50 = sext i32 %49 to i64
store i64 %50, i64* %11
br label %51
51: ; preds = %41, %29
%52 = load i64, i64* %11
store i64 %52, i64* %4
br label %53
53: ; preds = %51, %24
%54 = load i64, i64* %4
ret i64 %54
}

LLVM IR (-O2):
%"struct.dsc$descriptor_s" = type opaque
define i64 @"str$copy_r_64"(%"struct.dsc$descriptor_s"* %0, i16* nocapture %1, i8* %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = bitcast i16* %4 to i8*
%7 = bitcast i8** %5 to i8*
%8 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%9 = trunc i64 %8 to i32
%10 = tail call i32 (%"struct.dsc$descriptor_s"*, ...) bitcast (i32 (...)* @"str$$is_string_class" to i32 (%"struct.dsc$descriptor_s"*, ...)*)(%"struct.dsc$descriptor_s"* %0)
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 0)
br label %25
14: ; preds = %3
%15 = load i16, i16* %1
%16 = zext i16 %15 to i32
%17 = tail call i32 (%"struct.dsc$descriptor_s"*, i32, ...) bitcast (i32 (...)* @"str$$resize" to i32 (%"struct.dsc$descriptor_s"*, i32, ...)*)(%"struct.dsc$descriptor_s"* %0, i32 %16)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = call i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...) bitcast (i32 (...)* @"str$analyze_sdesc" to i32 (%"struct.dsc$descriptor_s"*, i16*, i8**, ...)*)(%"struct.dsc$descriptor_s"* %0, i16* %4, i8** %5)
%21 = load i8*, i8** %5
%22 = load i16, i16* %4
%23 = zext i16 %22 to i32
%24 = call i32 (i8*, i32, i8*, i32, i32, ...) bitcast (i32 (...)* @"str$$copy_fill" to i32 (i8*, i32, i8*, i32, i32, ...)*)(i8* %21, i32 %23, i8* %2, i32 %9, i32 32)
br label %25
25: ; preds = %14, %19, %12
%26 = phi i32 [ %10, %12 ], [ %24, %19 ], [ %17, %14 ]
%27 = sext i32 %26 to i64
ret i64 %27
}