void mode_string(mode, str) unsigned short mode;
char *str;
{
  str[0] = ftypelet((long)mode);
  rwx((mode & 0700) << 0, &str[1]);
  rwx((mode & 0070) << 3, &str[4]);
  rwx((mode & 0007) << 6, &str[7]);
  setst(mode, str);
}


x86 assembly (clang, -O0):
<mode_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
mov    %eax,%edi
mov    $0x0,%al
call   1040 <ftypelet@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movzwl -0x2(%rbp),%edi
and    $0x1c0,%edi
shl    $0x0,%edi
mov    -0x10(%rbp),%rsi
add    $0x1,%rsi
mov    $0x0,%al
call   1050 <rwx@plt>
movzwl -0x2(%rbp),%edi
and    $0x38,%edi
shl    $0x3,%edi
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
mov    $0x0,%al
call   1050 <rwx@plt>
movzwl -0x2(%rbp),%edi
and    $0x7,%edi
shl    $0x6,%edi
mov    -0x10(%rbp),%rsi
add    $0x7,%rsi
mov    $0x0,%al
call   1050 <rwx@plt>
movzwl -0x2(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <setst@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mode_string>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
movzwl %bp,%r14d
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <ftypelet@plt>
mov    %al,(%rbx)
mov    %ebp,%edi
and    $0x1c0,%edi
lea    0x1(%rbx),%rsi
xor    %eax,%eax
call   1050 <rwx@plt>
mov    %ebp,%edi
and    $0x38,%edi
shl    $0x3,%edi
lea    0x4(%rbx),%rsi
xor    %eax,%eax
call   1050 <rwx@plt>
and    $0x7,%ebp
shl    $0x6,%ebp
lea    0x7(%rbx),%rsi
mov    %ebp,%edi
xor    %eax,%eax
call   1050 <rwx@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <setst@plt>

LLVM IR (-O0):
define void @mode_string(i32 %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
%5 = trunc i32 %0 to i16
store i16 %5, i16* %3
store i8* %1, i8** %4
%6 = load i16, i16* %3
%7 = zext i16 %6 to i64
%8 = call i32 (i64, ...) bitcast (i32 (...)* @ftypelet to i32 (i64, ...)*)(i64 %7)
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 0
store i8 %9, i8* %11
%12 = load i16, i16* %3
%13 = zext i16 %12 to i32
%14 = and i32 %13, 448
%15 = shl i32 %14, 0
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @rwx to i32 (i32, i8*, ...)*)(i32 %15, i8* %17)
%19 = load i16, i16* %3
%20 = zext i16 %19 to i32
%21 = and i32 %20, 56
%22 = shl i32 %21, 3
%23 = load i8*, i8** %4
%24 = getelementptr inbounds i8, i8* %23, i64 4
%25 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @rwx to i32 (i32, i8*, ...)*)(i32 %22, i8* %24)
%26 = load i16, i16* %3
%27 = zext i16 %26 to i32
%28 = and i32 %27, 7
%29 = shl i32 %28, 6
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i64 7
%32 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @rwx to i32 (i32, i8*, ...)*)(i32 %29, i8* %31)
%33 = load i16, i16* %3
%34 = zext i16 %33 to i32
%35 = load i8*, i8** %4
%36 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @setst to i32 (i32, i8*, ...)*)(i32 %34, i8* %35)
ret void
}

LLVM IR (-O2):
define void @mode_string(i32 %0, i8* %1) {
%3 = and i32 %0, 65535
%4 = zext i32 %3 to i64
%5 = tail call i32 (i64, ...) bitcast (i32 (...)* @ftypelet to i32 (i64, ...)*)(i64 %4)
%6 = trunc i32 %5 to i8
store i8 %6, i8* %1
%7 = and i32 %0, 448
%8 = getelementptr inbounds i8, i8* %1, i64 1
%9 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @rwx to i32 (i32, i8*, ...)*)(i32 %7, i8* %8)
%10 = shl i32 %0, 3
%11 = and i32 %10, 448
%12 = getelementptr inbounds i8, i8* %1, i64 4
%13 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @rwx to i32 (i32, i8*, ...)*)(i32 %11, i8* %12)
%14 = shl i32 %0, 6
%15 = and i32 %14, 448
%16 = getelementptr inbounds i8, i8* %1, i64 7
%17 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @rwx to i32 (i32, i8*, ...)*)(i32 %15, i8* %16)
%18 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @setst to i32 (i32, i8*, ...)*)(i32 %3, i8* %1)
ret void
}