#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 */
typedef int wchar_t;

/* Variables and functions */
int /*<<< orphan*/ write(int, unsigned char *, int);
void ft_printwchar_norm(wchar_t c, unsigned char bit) {
  bit = 240 | (c >> 18 & 7);
  write(1, &bit, 1);
  bit = 128 | (c >> 12 & 63);
  write(1, &bit, 1);
  bit = 128 | (c >> 6 & 63);
  write(1, &bit, 1);
  bit = 128 | (c & 63);
  write(1, &bit, 1);
}


x86 assembly (clang, -O0):
<ft_printwchar_norm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x12,%eax
and    $0x7,%eax
or     $0xf0,%eax
mov    %al,-0x5(%rbp)
mov    $0x1,%edx
lea    -0x5(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
sar    $0xc,%eax
and    $0x3f,%eax
or     $0x80,%eax
mov    %al,-0x5(%rbp)
mov    $0x1,%edx
lea    -0x5(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
sar    $0x6,%eax
and    $0x3f,%eax
or     $0x80,%eax
mov    %al,-0x5(%rbp)
mov    $0x1,%edx
lea    -0x5(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
mov    -0x4(%rbp),%eax
and    $0x3f,%eax
or     $0x80,%eax
mov    %al,-0x5(%rbp)
mov    $0x1,%edx
lea    -0x5(%rbp),%rsi
mov    %edx,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_printwchar_norm>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%eax
shr    $0x12,%eax
and    $0x7,%al
or     $0xf0,%al
mov    %al,0x7(%rsp)
lea    0x7(%rsp),%r14
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %ebx,%eax
shr    $0xc,%eax
and    $0x3f,%al
or     $0x80,%al
mov    %al,0x7(%rsp)
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %ebx,%eax
shr    $0x6,%eax
and    $0x3f,%al
or     $0x80,%al
mov    %al,0x7(%rsp)
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
and    $0x3f,%bl
or     $0x80,%bl
mov    %bl,0x7(%rsp)
mov    $0x1,%edi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @ft_printwchar_norm(i32 %0, i8 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
store i8 %1, i8* %4
%5 = load i32, i32* %3
%6 = ashr i32 %5, 18
%7 = and i32 %6, 7
%8 = or i32 240, %7
%9 = trunc i32 %8 to i8
store i8 %9, i8* %4
%10 = call i32 @write(i32 1, i8* %4, i32 1)
%11 = load i32, i32* %3
%12 = ashr i32 %11, 12
%13 = and i32 %12, 63
%14 = or i32 128, %13
%15 = trunc i32 %14 to i8
store i8 %15, i8* %4
%16 = call i32 @write(i32 1, i8* %4, i32 1)
%17 = load i32, i32* %3
%18 = ashr i32 %17, 6
%19 = and i32 %18, 63
%20 = or i32 128, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %4
%22 = call i32 @write(i32 1, i8* %4, i32 1)
%23 = load i32, i32* %3
%24 = and i32 %23, 63
%25 = or i32 128, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %4
%27 = call i32 @write(i32 1, i8* %4, i32 1)
ret void
}

LLVM IR (-O2):
define void @ft_printwchar_norm(i32 %0, i8 zeroext %1) {
%3 = alloca i8
%4 = lshr i32 %0, 18
%5 = trunc i32 %4 to i8
%6 = and i8 %5, 7
%7 = or i8 %6, -16
store i8 %7, i8* %3
%8 = call i32 @write(i32 1, i8* %3, i32 1)
%9 = lshr i32 %0, 12
%10 = trunc i32 %9 to i8
%11 = and i8 %10, 63
%12 = or i8 %11, -128
store i8 %12, i8* %3
%13 = call i32 @write(i32 1, i8* %3, i32 1)
%14 = lshr i32 %0, 6
%15 = trunc i32 %14 to i8
%16 = and i8 %15, 63
%17 = or i8 %16, -128
store i8 %17, i8* %3
%18 = call i32 @write(i32 1, i8* %3, i32 1)
%19 = trunc i32 %0 to i8
%20 = and i8 %19, 63
%21 = or i8 %20, -128
store i8 %21, i8* %3
%22 = call i32 @write(i32 1, i8* %3, i32 1)
ret void
}