void baseinfo(char chain_id, long res_seq, char iCode, char *rname, char bcode,
              long stnd, char *idmsg) {
  char snum[10], rname_cp[10];
  long i;
  sprintf(snum, "%4ld", res_seq);
  for (i = 0; i < 4; i++)
    if (snum[i] == ' ')
      snum[i] = '.';
  if (chain_id == ' ')
    chain_id = '-';
  if (iCode == ' ')
    iCode = '_';
  strcpy(rname_cp, rname);
  for (i = 0; i < 3; i++)
    if (rname_cp[i] == ' ')
      rname_cp[i] = '.';
  if (stnd == 1)
    sprintf(idmsg, "%c:%4s%c:[%s]%c", chain_id, snum, iCode, rname_cp, bcode);
  else
    sprintf(idmsg, "%c[%s]:%4s%c:%c", bcode, rname_cp, snum, iCode, chain_id);
}


x86 assembly (clang, -O0):
<baseinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %r8b,%al
mov    0x10(%rbp),%r8
mov    %dil,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %dl,-0x11(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %al,-0x21(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x3a(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
movq   $0x0,-0x50(%rbp)
cmpq   $0x4,-0x50(%rbp)
jge    119f <baseinfo+0x7f>
mov    -0x50(%rbp),%rax
movsbl -0x3a(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    1189 <baseinfo+0x69>
mov    -0x50(%rbp),%rax
movb   $0x2e,-0x3a(%rbp,%rax,1)
jmp    118e <baseinfo+0x6e>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    1163 <baseinfo+0x43>
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jne    11b0 <baseinfo+0x90>
movb   $0x2d,-0x1(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    11c1 <baseinfo+0xa1>
movb   $0x5f,-0x11(%rbp)
lea    -0x44(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
movq   $0x0,-0x50(%rbp)
cmpq   $0x3,-0x50(%rbp)
jge    1212 <baseinfo+0xf2>
mov    -0x50(%rbp),%rax
movsbl -0x44(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    11fc <baseinfo+0xdc>
mov    -0x50(%rbp),%rax
movb   $0x2e,-0x44(%rbp,%rax,1)
jmp    1201 <baseinfo+0xe1>
mov    -0x50(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    11d6 <baseinfo+0xb6>
cmpq   $0x1,-0x30(%rbp)
jne    124c <baseinfo+0x12c>
mov    0x10(%rbp),%rdi
movsbl -0x1(%rbp),%edx
lea    -0x3a(%rbp),%rcx
movsbl -0x11(%rbp),%r8d
lea    -0x44(%rbp),%r9
movsbl -0x21(%rbp),%eax
lea    0xdc8(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    1276 <baseinfo+0x156>
mov    0x10(%rbp),%rdi
movsbl -0x21(%rbp),%edx
lea    -0x44(%rbp),%rcx
lea    -0x3a(%rbp),%r8
movsbl -0x11(%rbp),%r9d
movsbl -0x1(%rbp),%eax
lea    0xda9(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <sprintf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baseinfo>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r9,%r15
mov    %r8d,%r14d
mov    %rcx,%r12
mov    %edx,%ebp
mov    %rsi,%rdx
mov    %edi,%ebx
lea    0xebd(%rip),%rsi
lea    0xc(%rsp),%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
cmpb   $0x20,0xc(%rsp)
je     1203 <baseinfo+0xe3>
cmpb   $0x20,0xd(%rsp)
je     1213 <baseinfo+0xf3>
cmpb   $0x20,0xe(%rsp)
je     1223 <baseinfo+0x103>
cmpb   $0x20,0xf(%rsp)
jne    117c <baseinfo+0x5c>
movb   $0x2e,0xf(%rsp)
lea    0x16(%rsp),%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
cmpb   $0x20,0x16(%rsp)
je     1238 <baseinfo+0x118>
cmpb   $0x20,0x17(%rsp)
je     1248 <baseinfo+0x128>
cmpb   $0x20,0x18(%rsp)
jne    11ab <baseinfo+0x8b>
movb   $0x2e,0x18(%rsp)
mov    0x50(%rsp),%rdi
cmp    $0x20,%bl
movzbl %bl,%ecx
mov    $0x2d,%eax
cmovne %ecx,%eax
cmp    $0x20,%bpl
movzbl %bpl,%edx
mov    $0x5f,%ecx
cmovne %edx,%ecx
cmp    $0x1,%r15
jne    125d <baseinfo+0x13d>
movsbl %al,%edx
movsbl %cl,%r8d
movsbl %r14b,%eax
mov    %eax,(%rsp)
lea    0xe18(%rip),%rsi
lea    0xc(%rsp),%rcx
lea    0x16(%rsp),%r9
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    1283 <baseinfo+0x163>
movb   $0x2e,0xc(%rsp)
cmpb   $0x20,0xd(%rsp)
jne    1165 <baseinfo+0x45>
movb   $0x2e,0xd(%rsp)
cmpb   $0x20,0xe(%rsp)
jne    1170 <baseinfo+0x50>
movb   $0x2e,0xe(%rsp)
cmpb   $0x20,0xf(%rsp)
je     1177 <baseinfo+0x57>
jmp    117c <baseinfo+0x5c>
movb   $0x2e,0x16(%rsp)
cmpb   $0x20,0x17(%rsp)
jne    119f <baseinfo+0x7f>
movb   $0x2e,0x17(%rsp)
cmpb   $0x20,0x18(%rsp)
je     11a6 <baseinfo+0x86>
jmp    11ab <baseinfo+0x8b>
movsbl %r14b,%edx
movsbl %cl,%r9d
movsbl %al,%eax
mov    %eax,(%rsp)
lea    0xda3(%rip),%rsi
lea    0x16(%rsp),%rcx
lea    0xc(%rsp),%r8
xor    %eax,%eax
call   1040 <sprintf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%4ld\00"
@.str.1 = [16 x i8] c"%c:%4s%c:[%s]%c\00"
@.str.2 = [16 x i8] c"%c[%s]:%4s%c:%c\00"
define void @baseinfo(i8 signext %0, i64 %1, i8 signext %2, i8* %3, i8 signext %4, i64 %5, i8* %6) {
%8 = alloca i8
%9 = alloca i64
%10 = alloca i8
%11 = alloca i8*
%12 = alloca i8
%13 = alloca i64
%14 = alloca i8*
%15 = alloca [10 x i8]
%16 = alloca [10 x i8]
%17 = alloca i64
store i8 %0, i8* %8
store i64 %1, i64* %9
store i8 %2, i8* %10
store i8* %3, i8** %11
store i8 %4, i8* %12
store i64 %5, i64* %13
store i8* %6, i8** %14
%18 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%19 = load i64, i64* %9
%20 = call i32 (i8*, i8*, ...) @sprintf(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %19)
store i64 0, i64* %17
br label %21
21: ; preds = %34, %7
%22 = load i64, i64* %17
%23 = icmp slt i64 %22, 4
br i1 %23, label %24, label %37
24: ; preds = %21
%25 = load i64, i64* %17
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 32
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = load i64, i64* %17
%32 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 %31
store i8 46, i8* %32
br label %33
33: ; preds = %30, %24
br label %34
34: ; preds = %33
%35 = load i64, i64* %17
%36 = add nsw i64 %35, 1
store i64 %36, i64* %17
br label %21
37: ; preds = %21
%38 = load i8, i8* %8
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 32
br i1 %40, label %41, label %42
41: ; preds = %37
store i8 45, i8* %8
br label %42
42: ; preds = %41, %37
%43 = load i8, i8* %10
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 32
br i1 %45, label %46, label %47
46: ; preds = %42
store i8 95, i8* %10
br label %47
47: ; preds = %46, %42
%48 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%49 = load i8*, i8** %11
%50 = call i8* @strcpy(i8* %48, i8* %49)
store i64 0, i64* %17
br label %51
51: ; preds = %64, %47
%52 = load i64, i64* %17
%53 = icmp slt i64 %52, 3
br i1 %53, label %54, label %67
54: ; preds = %51
%55 = load i64, i64* %17
%56 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 32
br i1 %59, label %60, label %63
60: ; preds = %54
%61 = load i64, i64* %17
%62 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 %61
store i8 46, i8* %62
br label %63
63: ; preds = %60, %54
br label %64
64: ; preds = %63
%65 = load i64, i64* %17
%66 = add nsw i64 %65, 1
store i64 %66, i64* %17
br label %51
67: ; preds = %51
%68 = load i64, i64* %13
%69 = icmp eq i64 %68, 1
br i1 %69, label %70, label %81
70: ; preds = %67
%71 = load i8*, i8** %14
%72 = load i8, i8* %8
%73 = sext i8 %72 to i32
%74 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%75 = load i8, i8* %10
%76 = sext i8 %75 to i32
%77 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%78 = load i8, i8* %12
%79 = sext i8 %78 to i32
%80 = call i32 (i8*, i8*, ...) @sprintf(i8* %71, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %73, i8* %74, i32 %76, i8* %77, i32 %79)
br label %92
81: ; preds = %67
%82 = load i8*, i8** %14
%83 = load i8, i8* %12
%84 = sext i8 %83 to i32
%85 = getelementptr inbounds [10 x i8], [10 x i8]* %16, i64 0, i64 0
%86 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%87 = load i8, i8* %10
%88 = sext i8 %87 to i32
%89 = load i8, i8* %8
%90 = sext i8 %89 to i32
%91 = call i32 (i8*, i8*, ...) @sprintf(i8* %82, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %84, i8* %85, i8* %86, i32 %88, i32 %90)
br label %92
92: ; preds = %81, %70
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%4ld\00"
@.str.1 = [16 x i8] c"%c:%4s%c:[%s]%c\00"
@.str.2 = [16 x i8] c"%c[%s]:%4s%c:%c\00"
define void @baseinfo(i8 signext %0, i64 %1, i8 signext %2, i8* nocapture %3, i8 signext %4, i64 %5, i8* nocapture writeonly %6) {
%8 = alloca [10 x i8]
%9 = alloca [10 x i8]
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %1)
%13 = load i8, i8* %10
%14 = icmp eq i8 %13, 32
br i1 %14, label %15, label %16
15: ; preds = %7
store i8 46, i8* %10
br label %16
16: ; preds = %7, %15
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 1
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 32
br i1 %19, label %20, label %21
20: ; preds = %16
store i8 46, i8* %17
br label %21
21: ; preds = %20, %16
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 2
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 32
br i1 %24, label %25, label %26
25: ; preds = %21
store i8 46, i8* %22
br label %26
26: ; preds = %25, %21
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 3
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 32
br i1 %29, label %30, label %31
30: ; preds = %26
store i8 46, i8* %27
br label %31
31: ; preds = %30, %26
%32 = icmp eq i8 %0, 32
%33 = icmp eq i8 %2, 32
%34 = call i8* @strcpy(i8* %11, i8* dereferenceable(1) %3)
%35 = load i8, i8* %11
%36 = icmp eq i8 %35, 32
br i1 %36, label %37, label %38
37: ; preds = %31
store i8 46, i8* %11
br label %38
38: ; preds = %31, %37
%39 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 1
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 32
br i1 %41, label %42, label %43
42: ; preds = %38
store i8 46, i8* %39
br label %43
43: ; preds = %42, %38
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 2
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 32
br i1 %46, label %47, label %48
47: ; preds = %43
store i8 46, i8* %44
br label %48
48: ; preds = %47, %43
%49 = select i1 %32, i8 45, i8 %0
%50 = select i1 %33, i8 95, i8 %2
%51 = icmp eq i64 %5, 1
br i1 %51, label %52, label %57
52: ; preds = %48
%53 = sext i8 %49 to i32
%54 = sext i8 %50 to i32
%55 = sext i8 %4 to i32
%56 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %53, i8* %10, i32 %54, i8* %11, i32 %55)
br label %62
57: ; preds = %48
%58 = sext i8 %4 to i32
%59 = sext i8 %50 to i32
%60 = sext i8 %49 to i32
%61 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 %58, i8* %11, i8* %10, i32 %59, i32 %60)
br label %62
62: ; preds = %57, %52
ret void
}