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

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
char *format_quality_max(int qmax) {
  static char buf[8];
  if (qmax < 0)
    snprintf(buf, sizeof(buf), "unknown");
  else
    snprintf(buf, sizeof(buf), "%d", qmax);
  return buf;
}


x86 assembly (clang, -O0):
<format_quality_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1144 <format_quality_max+0x34>
lea    0x2efd(%rip),%rdi
mov    $0x8,%esi
lea    0xec8(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1161 <format_quality_max+0x51>
mov    -0x4(%rbp),%ecx
lea    0x2edb(%rip),%rdi
mov    $0x8,%esi
lea    0xeae(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
lea    0x2ec1(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_quality_max>:
push   %rax
test   %edi,%edi
js     1133 <format_quality_max+0x23>
mov    %edi,%ecx
lea    0x2f0b(%rip),%rdi
lea    0xee3(%rip),%rdx
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    114d <format_quality_max+0x3d>
lea    0x2eef(%rip),%rdi
lea    0xebf(%rip),%rdx
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <snprintf@plt>
lea    0x2ed5(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@format_quality_max.buf = internal global [8 x i8] zeroinitializer
@.str = [8 x i8] c"unknown\00"
@.str.1 = [3 x i8] c"%d\00"
define i8* @format_quality_max(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @format_quality_max.buf, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @format_quality_max.buf, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %10
10: ; preds = %7, %5
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @format_quality_max.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@format_quality_max.buf = internal global [8 x i8] zeroinitializer
@.str = [8 x i8] c"unknown\00"
@.str.1 = [3 x i8] c"%d\00"
define i8* @format_quality_max(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @format_quality_max.buf, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %7
5: ; preds = %1
%6 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @format_quality_max.buf, i64 0, i64 0), i32 8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %7
7: ; preds = %5, %3
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @format_quality_max.buf, i64 0, i64 0)
}