#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 *, ...);
void printShaperResult(unsigned int tbresult, unsigned int tbmindepth,
                       unsigned int tbmaxdepth, double tbrate,
                       unsigned int tbabortflag, int dir, FILE *fp) {
  if (tbabortflag == 1) {
    return;
  }
  if (dir == 0)
    fprintf(fp, "Up: ");
  else
    fprintf(fp, "Down: ");
  if (tbresult == 0) {
    fprintf(fp, "0\n");
    return;
  }
  fprintf(fp, "%d Kbps\n", (int)tbrate);
}


x86 assembly (clang, -O0):
<printShaperResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jne    1140 <printShaperResult+0x30>
jmp    11ab <printShaperResult+0x9b>
cmpl   $0x0,-0x20(%rbp)
jne    1161 <printShaperResult+0x51>
mov    -0x28(%rbp),%rdi
lea    0xeab(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1173 <printShaperResult+0x63>
mov    -0x28(%rbp),%rdi
lea    0xe99(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0x4(%rbp)
jne    1194 <printShaperResult+0x84>
mov    -0x28(%rbp),%rdi
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11ab <printShaperResult+0x9b>
mov    -0x28(%rbp),%rdi
cvttsd2si -0x18(%rbp),%edx
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printShaperResult>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x1,%ecx
jne    112f <printShaperResult+0xf>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %r9,%rbx
mov    %edi,%ebp
movsd  %xmm0,(%rsp)
test   %r8d,%r8d
je     114c <printShaperResult+0x2c>
lea    0xec0(%rip),%rdi
mov    $0x6,%esi
jmp    1158 <printShaperResult+0x38>
lea    0xead(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
test   %ebp,%ebp
movsd  (%rsp),%xmm0
je     1189 <printShaperResult+0x69>
cvttsd2si %xmm0,%edx
lea    0xe96(%rip),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"Up: \00"
@.str.1 = [7 x i8] c"Down: \00"
@.str.2 = [3 x i8] c"0\0A\00"
@.str.3 = [9 x i8] c"%d Kbps\0A\00"
define void @printShaperResult(i32 %0, i32 %1, i32 %2, double %3, i32 %4, i32 %5, i32* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store double %3, double* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32* %6, i32** %14
%15 = load i32, i32* %12
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %18
17: ; preds = %7
br label %38
18: ; preds = %7
%19 = load i32, i32* %13
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32*, i32** %14
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %27
24: ; preds = %18
%25 = load i32*, i32** %14
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %24, %21
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %33
30: ; preds = %27
%31 = load i32*, i32** %14
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %38
33: ; preds = %27
%34 = load i32*, i32** %14
%35 = load double, double* %11
%36 = fptosi double %35 to i32
%37 = call i32 (i32*, i8*, ...) @fprintf(i32* %34, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %33, %30, %17
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"Up: \00"
@.str.1 = [7 x i8] c"Down: \00"
@.str.2 = [3 x i8] c"0\0A\00"
@.str.3 = [9 x i8] c"%d Kbps\0A\00"
define void @printShaperResult(i32 %0, i32 %1, i32 %2, double %3, i32 %4, i32 %5, i32* nocapture %6) {
%8 = icmp eq i32 %4, 1
br i1 %8, label %22, label %9
9: ; preds = %7
%10 = icmp eq i32 %5, 0
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 4, i64 1, i32* %6)
br label %15
13: ; preds = %9
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i64 6, i64 1, i32* %6)
br label %15
15: ; preds = %13, %11
%16 = icmp eq i32 %0, 0
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64 2, i64 1, i32* %6)
br label %22
19: ; preds = %15
%20 = fptosi double %3 to i32
%21 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %7, %19, %17
ret void
}