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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void pr_TIDR(FILE *fp, uint8_t tidr) {
  fprintf(fp, "TIDR=%d:Threat identity data range:", tidr);
  if (tidr == 0)
    fprintf(fp, "No range estimate available\n");
  else if (tidr == 1)
    fprintf(fp, "< %.2f NM\n", 0.05);
  else if (tidr == 127)
    fprintf(fp, "> %.2f NM\n", 12.55);
  else
    fprintf(fp, "%.2f ± %.2f NM\n", (tidr - 1) / 10.0, 0.05);
}


x86 assembly (clang, -O0):
<pr_TIDR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xeeb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1155 <pr_TIDR+0x45>
mov    -0x8(%rbp),%rdi
lea    0xef3(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11e1 <pr_TIDR+0xd1>
cmpl   $0x1,-0xc(%rbp)
jne    117e <pr_TIDR+0x6e>
mov    -0x8(%rbp),%rdi
lea    0xeef(%rip),%rsi
movsd  0xe8e(%rip),%xmm0
mov    $0x1,%al
call   1030 <fprintf@plt>
jmp    11dc <pr_TIDR+0xcc>
cmpl   $0x7f,-0xc(%rbp)
jne    11a7 <pr_TIDR+0x97>
mov    -0x8(%rbp),%rdi
lea    0xed1(%rip),%rsi
movsd  0xe75(%rip),%xmm0
mov    $0x1,%al
call   1030 <fprintf@plt>
jmp    11d7 <pr_TIDR+0xc7>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xea7(%rip),%rsi
movsd  0xe30(%rip),%xmm1
mov    $0x2,%al
call   1030 <fprintf@plt>
jmp    11dc <pr_TIDR+0xcc>
jmp    11e1 <pr_TIDR+0xd1>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_TIDR>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xee9(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x7f,%ebp
je     1165 <pr_TIDR+0x45>
cmp    $0x1,%ebp
je     1176 <pr_TIDR+0x56>
test   %ebp,%ebp
jne    1195 <pr_TIDR+0x75>
lea    0xeef(%rip),%rdi
mov    $0x1c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fwrite@plt>
lea    0xef8(%rip),%rsi
movsd  0xe8c(%rip),%xmm0
jmp    1185 <pr_TIDR+0x65>
lea    0xedc(%rip),%rsi
movsd  0xe83(%rip),%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>
add    $0xffffffff,%ebp
cvtsi2sd %ebp,%xmm0
divsd  0xe6c(%rip),%xmm0
lea    0xec4(%rip),%rsi
movsd  0xe55(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x2,%al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"TIDR=%d:Threat identity data range:\00"
@.str.1 = [29 x i8] c"No range estimate available\0A\00"
@.str.2 = [11 x i8] c"< %.2f NM\0A\00"
@.str.3 = [11 x i8] c"> %.2f NM\0A\00"
@.str.4 = [18 x i8] c"%.2f \C2\B1\C2\A0%.2f NM\0A\00"
define void @pr_TIDR(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %34
13: ; preds = %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = load i32*, i32** %3
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double 5.000000e-02)
br label %33
19: ; preds = %13
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 127
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32*, i32** %3
%24 = call i32 (i32*, i8*, ...) @fprintf(i32* %23, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double 1.255000e+01)
br label %32
25: ; preds = %19
%26 = load i32*, i32** %3
%27 = load i32, i32* %4
%28 = sub nsw i32 %27, 1
%29 = sitofp i32 %28 to double
%30 = fdiv double %29, 1.000000e+01
%31 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %30, double 5.000000e-02)
br label %32
32: ; preds = %25, %22
br label %33
33: ; preds = %32, %16
br label %34
34: ; preds = %33, %10
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"TIDR=%d:Threat identity data range:\00"
@.str.1 = [29 x i8] c"No range estimate available\0A\00"
@.str.2 = [11 x i8] c"< %.2f NM\0A\00"
@.str.3 = [11 x i8] c"> %.2f NM\0A\00"
@.str.4 = [18 x i8] c"%.2f \C2\B1\C2\A0%.2f NM\0A\00"
define void @pr_TIDR(i32* nocapture %0, i32 %1) {
%3 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %1)
switch i32 %1, label %10 [
i32 0, label %4
i32 1, label %6
i32 127, label %8
]
4: ; preds = %2
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i64 28, i64 1, i32* %0)
br label %15
6: ; preds = %2
%7 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double 5.000000e-02)
br label %15
8: ; preds = %2
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), double 1.255000e+01)
br label %15
10: ; preds = %2
%11 = add nsw i32 %1, -1
%12 = sitofp i32 %11 to double
%13 = fdiv double %12, 1.000000e+01
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), double %13, double 5.000000e-02)
br label %15
15: ; preds = %6, %10, %8, %4
ret void
}