#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 /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int /*<<< orphan*/);
char *get_unicode_from(char *);
int /*<<< orphan*/ str2uni(char *);
void print_unicode(FILE *fd, char *str) {
  char *p = get_unicode_from(str);
  if (p)
    fprintf(fd, "%lc", str2uni(p));
  else
    return;
  while ((p = get_unicode_from(p + 6)) != NULL) {
    fprintf(fd, "%lc", str2uni(p));
  }
}


x86 assembly (clang, -O0):
<print_unicode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <get_unicode_from@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1180 <print_unicode+0x50>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <str2uni@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%edx
lea    0xe8a(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1185 <print_unicode+0x55>
jmp    11cd <print_unicode+0x9d>
jmp    118a <print_unicode+0x5a>
mov    -0x18(%rbp),%rdi
add    $0x6,%rdi
call   1040 <get_unicode_from@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     11cd <print_unicode+0x9d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <str2uni@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe3d(%rip),%rsi
call   1030 <fprintf@plt>
jmp    118a <print_unicode+0x5a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_unicode>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <get_unicode_from@plt>
test   %rax,%rax
je     11a9 <print_unicode+0x79>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <str2uni@plt>
lea    0xea9(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1030 <fprintf@plt>
add    $0x6,%rbx
mov    %rbx,%rdi
call   1040 <get_unicode_from@plt>
test   %rax,%rax
je     11a9 <print_unicode+0x79>
mov    %rax,%rbx
lea    0xe84(%rip),%r15
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1050 <str2uni@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <fprintf@plt>
add    $0x6,%rbx
mov    %rbx,%rdi
call   1040 <get_unicode_from@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1180 <print_unicode+0x50>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lc\00"
define void @print_unicode(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i8* @get_unicode_from(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = load i8*, i8** %5
%13 = call i32 @str2uni(i8* %12)
%14 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %16
15: ; preds = %2
br label %27
16: ; preds = %10
br label %17
17: ; preds = %22, %16
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 6
%20 = call i8* @get_unicode_from(i8* %19)
store i8* %20, i8** %5
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %27
22: ; preds = %17
%23 = load i32*, i32** %3
%24 = load i8*, i8** %5
%25 = call i32 @str2uni(i8* %24)
%26 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %25)
br label %17
27: ; preds = %15, %17
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lc\00"
define void @print_unicode(i32* nocapture %0, i8* %1) {
%3 = tail call i8* @get_unicode_from(i8* %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %18, label %5
5: ; preds = %2
%6 = tail call i32 @str2uni(i8* %3)
%7 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds i8, i8* %3, i64 6
%9 = tail call i8* @get_unicode_from(i8* %8)
%10 = icmp eq i8* %9, null
br i1 %10, label %18, label %11
11: ; preds = %5, %11
%12 = phi i8* [ %16, %11 ], [ %9, %5 ]
%13 = tail call i32 @str2uni(i8* %12)
%14 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds i8, i8* %12, i64 6
%16 = tail call i8* @get_unicode_from(i8* %15)
%17 = icmp eq i8* %16, null
br i1 %17, label %18, label %11
18: ; preds = %11, %5, %2
ret void
}