#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 const *,
                           char const *, char const *, char const *);
int /*<<< orphan*/ output_itemv(int /*<<< orphan*/ *, char const *,
                                char const *, int);
int /*<<< orphan*/ output_level(int /*<<< orphan*/ *, int);
void output_range(FILE *outptr, const char *tag, const char *start,
                  const char *end, int level) {
  if (start && end) {
    output_level(outptr, level);
    fprintf(outptr, "<%s>%s-%s</%s>\n", tag, start, end, tag);
  } else if (start)
    output_itemv(outptr, tag, start, level);
  else if (end)
    output_itemv(outptr, tag, end, level);
}


x86 assembly (clang, -O0):
<output_range>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1193 <output_range+0x63>
cmpq   $0x0,-0x20(%rbp)
je     1193 <output_range+0x63>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <output_level@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x10(%rbp),%r9
lea    0xe77(%rip),%rsi
call   1040 <fprintf@plt>
jmp    11e0 <output_range+0xb0>
cmpq   $0x0,-0x18(%rbp)
je     11b7 <output_range+0x87>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <output_itemv@plt>
jmp    11db <output_range+0xab>
cmpq   $0x0,-0x20(%rbp)
je     11d6 <output_range+0xa6>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
call   1030 <output_itemv@plt>
jmp    11db <output_range+0xab>
jmp    11e0 <output_range+0xb0>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_range>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r12
test   %rdx,%rdx
je     117f <output_range+0x4f>
test   %r15,%r15
je     117f <output_range+0x4f>
mov    %r12,%rdi
mov    %r8d,%esi
call   1050 <output_level@plt>
lea    0xea0(%rip),%rsi
mov    %r12,%rdi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %r15,%r8
mov    %r14,%r9
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <fprintf@plt>
test   %rbx,%rbx
je     118f <output_range+0x5f>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
jmp    119d <output_range+0x6d>
test   %r15,%r15
je     11b0 <output_range+0x80>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r8d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <output_itemv@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"<%s>%s-%s</%s>\0A\00"
define void @output_range(i32* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32* %0, i32** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i8*, i8** %8
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %26
13: ; preds = %5
%14 = load i8*, i8** %9
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %26
16: ; preds = %13
%17 = load i32*, i32** %6
%18 = load i32, i32* %10
%19 = call i32 @output_level(i32* %17, i32 %18)
%20 = load i32*, i32** %6
%21 = load i8*, i8** %7
%22 = load i8*, i8** %8
%23 = load i8*, i8** %9
%24 = load i8*, i8** %7
%25 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %22, i8* %23, i8* %24)
br label %46
26: ; preds = %13, %5
%27 = load i8*, i8** %8
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = load i32*, i32** %6
%31 = load i8*, i8** %7
%32 = load i8*, i8** %8
%33 = load i32, i32* %10
%34 = call i32 @output_itemv(i32* %30, i8* %31, i8* %32, i32 %33)
br label %45
35: ; preds = %26
%36 = load i8*, i8** %9
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %44
38: ; preds = %35
%39 = load i32*, i32** %6
%40 = load i8*, i8** %7
%41 = load i8*, i8** %9
%42 = load i32, i32* %10
%43 = call i32 @output_itemv(i32* %39, i8* %40, i8* %41, i32 %42)
br label %44
44: ; preds = %38, %35
br label %45
45: ; preds = %44, %29
br label %46
46: ; preds = %45, %16
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"<%s>%s-%s</%s>\0A\00"
define void @output_range(i32* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = icmp ne i8* %2, null
%7 = icmp ne i8* %3, null
%8 = and i1 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = tail call i32 @output_level(i32* %0, i32 %4)
%11 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %3, i8* %1)
br label %18
12: ; preds = %5
br i1 %6, label %13, label %15
13: ; preds = %12
%14 = tail call i32 @output_itemv(i32* %0, i8* %1, i8* %2, i32 %4)
br label %18
15: ; preds = %12
br i1 %7, label %16, label %18
16: ; preds = %15
%17 = tail call i32 @output_itemv(i32* %0, i8* %1, i8* %3, i32 %4)
br label %18
18: ; preds = %13, %16, %15, %9
ret void
}