#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 *, char);
void fprintf_tree(unsigned char Number_symbols, FILE *file_out,
                  char *elements) {
  fprintf(file_out, "%c", Number_symbols);
  for (int i = 0; elements[i]; i++) {
    fprintf(file_out, "%c", elements[i]);
  }
}


x86 assembly (clang, -O0):
<fprintf_tree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xecf(%rip),%rsi
movsbl -0x1(%rbp),%edx
call   1030 <fprintf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     117d <fprintf_tree+0x6d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
lea    0xe9a(%rip),%rsi
movsbl (%rax,%rcx,1),%edx
call   1030 <fprintf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <fprintf_tree+0x31>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprintf_tree>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
movsbl %dil,%edi
call   1030 <fputc@plt>
mov    (%rbx),%al
test   %al,%al
je     1146 <fprintf_tree+0x36>
add    $0x1,%rbx
nopl   (%rax)
movsbl %al,%edi
mov    %r14,%rsi
call   1030 <fputc@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <fprintf_tree+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @fprintf_tree(i8 zeroext %0, i32* nocapture %1, i8* nocapture %2) {
%4 = sext i8 %0 to i32
%5 = tail call i32 @fputc(i32 %4, i32* %1)
%6 = load i8, i8* %2
%7 = icmp eq i8 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %9, %3
ret void
9: ; preds = %3, %9
%10 = phi i64 [ %14, %9 ], [ 0, %3 ]
%11 = phi i8 [ %16, %9 ], [ %6, %3 ]
%12 = sext i8 %11 to i32
%13 = tail call i32 @fputc(i32 %12, i32* %1)
%14 = add nuw i64 %10, 1
%15 = getelementptr inbounds i8, i8* %2, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %8, label %9
}