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

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
void iw_print_retry_value(char *buffer, int buflen, int value, int flags,
                          int we_version) {
  if (buflen < 20) {
    snprintf(buffer, buflen, "<too big>");
    return;
  }
  buflen -= 20;
  if (flags & 0x0001) {
    strcpy(buffer, " min");
    buffer += 4;
  }
  if (flags & 0x0002) {
    strcpy(buffer, " max");
    buffer += 4;
  }
  if (flags & 0x0010) {
    strcpy(buffer, " short");
    buffer += 6;
  }
  if (flags & 0x0020) {
    strcpy(buffer, "  long");
    buffer += 6;
  }
  if (flags & 0x2000) {
    strcpy(buffer, " lifetime:");
    buffer += 10;
    if (flags & 0x0004) {
      if (we_version < 21)
        value /= 1e6;
      snprintf(buffer, buflen, "%d", value);
    } else {
      if (value >= (int)1e6)
        snprintf(buffer, buflen, "%gs", ((double)value) / 1e6);
      else if (value >= (int)1e3)
        snprintf(buffer, buflen, "%gms", ((double)value) / 1e3);
      else
        snprintf(buffer, buflen, "%dus", value);
    }
  } else
    snprintf(buffer, buflen, " limit:%d", value);
}


x86 assembly (clang, -O0):
<iw_print_retry_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
cmpl   $0x14,-0xc(%rbp)
jge    115d <iw_print_retry_value+0x3d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xebf(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
jmp    133c <iw_print_retry_value+0x21c>
mov    -0xc(%rbp),%eax
sub    $0x14,%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1191 <iw_print_retry_value+0x71>
mov    -0x8(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     11bc <iw_print_retry_value+0x9c>
mov    -0x8(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     11e7 <iw_print_retry_value+0xc7>
mov    -0x8(%rbp),%rdi
lea    0xe4e(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1212 <iw_print_retry_value+0xf2>
mov    -0x8(%rbp),%rdi
lea    0xe2a(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x6,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
and    $0x2000,%eax
cmp    $0x0,%eax
je     1324 <iw_print_retry_value+0x204>
mov    -0x8(%rbp),%rdi
lea    0xe04(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     128d <iw_print_retry_value+0x16d>
cmpl   $0x15,-0x18(%rbp)
jge    1270 <iw_print_retry_value+0x150>
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xda3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
lea    0xdd1(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
jmp    131f <iw_print_retry_value+0x1ff>
cmpl   $0xf4240,-0x10(%rbp)
jl     12c5 <iw_print_retry_value+0x1a5>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xd5a(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd84(%rip),%rdx
mov    $0x1,%al
call   1040 <snprintf@plt>
jmp    131a <iw_print_retry_value+0x1fa>
cmpl   $0x3e8,-0x10(%rbp)
jl     12fd <iw_print_retry_value+0x1dd>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
cvtsi2sdl -0x10(%rbp),%xmm0
movsd  0xd1a(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xd50(%rip),%rdx
mov    $0x1,%al
call   1040 <snprintf@plt>
jmp    1315 <iw_print_retry_value+0x1f5>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
lea    0xd38(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
jmp    131a <iw_print_retry_value+0x1fa>
jmp    131f <iw_print_retry_value+0x1ff>
jmp    133c <iw_print_retry_value+0x21c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
lea    0xd16(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iw_print_retry_value>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r12d
mov    %rdi,%rbx
cmp    $0x13,%esi
jg     114f <iw_print_retry_value+0x2f>
lea    0xed6(%rip),%rdx
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <snprintf@plt>
mov    %r8d,%r15d
mov    %ecx,%ebp
mov    %edx,%r14d
test   $0x1,%bpl
jne    119a <iw_print_retry_value+0x7a>
test   $0x2,%bpl
jne    11b3 <iw_print_retry_value+0x93>
test   $0x10,%bpl
jne    11cc <iw_print_retry_value+0xac>
test   $0x20,%bpl
je     1182 <iw_print_retry_value+0x62>
lea    0xeb5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
add    $0x6,%rbx
add    $0xffffffec,%r12d
test   $0x2000,%ebp
jne    11e7 <iw_print_retry_value+0xc7>
lea    0xeb6(%rip),%rdx
jmp    1279 <iw_print_retry_value+0x159>
lea    0xe79(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
add    $0x4,%rbx
test   $0x2,%bpl
je     1163 <iw_print_retry_value+0x43>
lea    0xe65(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
add    $0x4,%rbx
test   $0x10,%bpl
je     1169 <iw_print_retry_value+0x49>
lea    0xe51(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
add    $0x6,%rbx
test   $0x20,%bpl
jne    116f <iw_print_retry_value+0x4f>
jmp    1182 <iw_print_retry_value+0x62>
lea    0xe44(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
add    $0xa,%rbx
test   $0x4,%bpl
jne    121f <iw_print_retry_value+0xff>
cmp    $0xf4240,%r14d
jl     1240 <iw_print_retry_value+0x120>
cvtsi2sd %r14d,%xmm0
divsd  0xdea(%rip),%xmm0
lea    0xe20(%rip),%rdx
jmp    125d <iw_print_retry_value+0x13d>
cmp    $0x14,%r15d
jg     1237 <iw_print_retry_value+0x117>
cvtsi2sd %r14d,%xmm0
divsd  0xdce(%rip),%xmm0
cvttsd2si %xmm0,%r14d
lea    0xe14(%rip),%rdx
jmp    1279 <iw_print_retry_value+0x159>
cmp    $0x3e8,%r14d
jl     1272 <iw_print_retry_value+0x152>
cvtsi2sd %r14d,%xmm0
divsd  0xdb2(%rip),%xmm0
lea    0xde4(%rip),%rdx
mov    %rbx,%rdi
mov    %r12d,%esi
mov    $0x1,%al
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <snprintf@plt>
lea    0xdcd(%rip),%rdx
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r14d,%ecx
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <snprintf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"<too big>\00"
@.str.1 = [5 x i8] c" min\00"
@.str.2 = [5 x i8] c" max\00"
@.str.3 = [7 x i8] c" short\00"
@.str.4 = [7 x i8] c" long\00"
@.str.5 = [11 x i8] c" lifetime:\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"%gs\00"
@.str.8 = [5 x i8] c"%gms\00"
@.str.9 = [5 x i8] c"%dus\00"
@.str.10 = [10 x i8] c" limit:%d\00"
define void @iw_print_retry_value(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 20
br i1 %12, label %13, label %17
13: ; preds = %5
%14 = load i8*, i8** %6
%15 = load i32, i32* %7
%16 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %14, i32 %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %113
17: ; preds = %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 20
store i32 %19, i32* %7
%20 = load i32, i32* %9
%21 = and i32 %20, 1
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %17
%24 = load i8*, i8** %6
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%26 = load i8*, i8** %6
%27 = getelementptr inbounds i8, i8* %26, i64 4
store i8* %27, i8** %6
br label %28
28: ; preds = %23, %17
%29 = load i32, i32* %9
%30 = and i32 %29, 2
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %28
%33 = load i8*, i8** %6
%34 = call i32 @strcpy(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i64 4
store i8* %36, i8** %6
br label %37
37: ; preds = %32, %28
%38 = load i32, i32* %9
%39 = and i32 %38, 16
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %46
41: ; preds = %37
%42 = load i8*, i8** %6
%43 = call i32 @strcpy(i8* %42, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%44 = load i8*, i8** %6
%45 = getelementptr inbounds i8, i8* %44, i64 6
store i8* %45, i8** %6
br label %46
46: ; preds = %41, %37
%47 = load i32, i32* %9
%48 = and i32 %47, 32
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %55
50: ; preds = %46
%51 = load i8*, i8** %6
%52 = call i32 @strcpy(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%53 = load i8*, i8** %6
%54 = getelementptr inbounds i8, i8* %53, i64 6
store i8* %54, i8** %6
br label %55
55: ; preds = %50, %46
%56 = load i32, i32* %9
%57 = and i32 %56, 8192
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %108
59: ; preds = %55
%60 = load i8*, i8** %6
%61 = call i32 @strcpy(i8* %60, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%62 = load i8*, i8** %6
%63 = getelementptr inbounds i8, i8* %62, i64 10
store i8* %63, i8** %6
%64 = load i32, i32* %9
%65 = and i32 %64, 4
%66 = icmp ne i32 %65, 0
br i1 %66, label %67, label %80
67: ; preds = %59
%68 = load i32, i32* %10
%69 = icmp slt i32 %68, 21
br i1 %69, label %70, label %75
70: ; preds = %67
%71 = load i32, i32* %8
%72 = sitofp i32 %71 to double
%73 = fdiv double %72, 1.000000e+06
%74 = fptosi double %73 to i32
store i32 %74, i32* %8
br label %75
75: ; preds = %70, %67
%76 = load i8*, i8** %6
%77 = load i32, i32* %7
%78 = load i32, i32* %8
%79 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %76, i32 %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %78)
br label %107
80: ; preds = %59
%81 = load i32, i32* %8
%82 = icmp sge i32 %81, 1000000
br i1 %82, label %83, label %90
83: ; preds = %80
%84 = load i8*, i8** %6
%85 = load i32, i32* %7
%86 = load i32, i32* %8
%87 = sitofp i32 %86 to double
%88 = fdiv double %87, 1.000000e+06
%89 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %84, i32 %85, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double %88)
br label %106
90: ; preds = %80
%91 = load i32, i32* %8
%92 = icmp sge i32 %91, 1000
br i1 %92, label %93, label %100
93: ; preds = %90
%94 = load i8*, i8** %6
%95 = load i32, i32* %7
%96 = load i32, i32* %8
%97 = sitofp i32 %96 to double
%98 = fdiv double %97, 1.000000e+03
%99 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %94, i32 %95, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), double %98)
br label %105
100: ; preds = %90
%101 = load i8*, i8** %6
%102 = load i32, i32* %7
%103 = load i32, i32* %8
%104 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %101, i32 %102, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %103)
br label %105
105: ; preds = %100, %93
br label %106
106: ; preds = %105, %83
br label %107
107: ; preds = %106, %75
br label %113
108: ; preds = %55
%109 = load i8*, i8** %6
%110 = load i32, i32* %7
%111 = load i32, i32* %8
%112 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %109, i32 %110, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %111)
br label %113
113: ; preds = %13, %108, %107
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"<too big>\00"
@.str.1 = [5 x i8] c" min\00"
@.str.2 = [5 x i8] c" max\00"
@.str.3 = [7 x i8] c" short\00"
@.str.4 = [7 x i8] c" long\00"
@.str.5 = [11 x i8] c" lifetime:\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [4 x i8] c"%gs\00"
@.str.8 = [5 x i8] c"%gms\00"
@.str.9 = [5 x i8] c"%dus\00"
@.str.10 = [10 x i8] c" limit:%d\00"
define void @iw_print_retry_value(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp slt i32 %1, 20
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %71
9: ; preds = %5
%10 = add nsw i32 %1, -20
%11 = and i32 %3, 1
%12 = icmp eq i32 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %9
%14 = tail call i32 @strcpy(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%15 = getelementptr inbounds i8, i8* %0, i64 4
br label %16
16: ; preds = %13, %9
%17 = phi i8* [ %15, %13 ], [ %0, %9 ]
%18 = and i32 %3, 2
%19 = icmp eq i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %16
%21 = tail call i32 @strcpy(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%22 = getelementptr inbounds i8, i8* %17, i64 4
br label %23
23: ; preds = %20, %16
%24 = phi i8* [ %22, %20 ], [ %17, %16 ]
%25 = and i32 %3, 16
%26 = icmp eq i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %23
%28 = tail call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%29 = getelementptr inbounds i8, i8* %24, i64 6
br label %30
30: ; preds = %27, %23
%31 = phi i8* [ %29, %27 ], [ %24, %23 ]
%32 = and i32 %3, 32
%33 = icmp eq i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %30
%35 = tail call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%36 = getelementptr inbounds i8, i8* %31, i64 6
br label %37
37: ; preds = %34, %30
%38 = phi i8* [ %36, %34 ], [ %31, %30 ]
%39 = and i32 %3, 8192
%40 = icmp eq i32 %39, 0
br i1 %40, label %69, label %41
41: ; preds = %37
%42 = tail call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%43 = getelementptr inbounds i8, i8* %38, i64 10
%44 = and i32 %3, 4
%45 = icmp eq i32 %44, 0
br i1 %45, label %55, label %46
46: ; preds = %41
%47 = icmp slt i32 %4, 21
br i1 %47, label %48, label %52
48: ; preds = %46
%49 = sitofp i32 %2 to double
%50 = fdiv double %49, 1.000000e+06
%51 = fptosi double %50 to i32
br label %52
52: ; preds = %48, %46
%53 = phi i32 [ %51, %48 ], [ %2, %46 ]
%54 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* %43, i32 %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %53)
br label %71
55: ; preds = %41
%56 = icmp sgt i32 %2, 999999
br i1 %56, label %57, label %61
57: ; preds = %55
%58 = sitofp i32 %2 to double
%59 = fdiv double %58, 1.000000e+06
%60 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* %43, i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double %59)
br label %71
61: ; preds = %55
%62 = icmp sgt i32 %2, 999
br i1 %62, label %63, label %67
63: ; preds = %61
%64 = sitofp i32 %2 to double
%65 = fdiv double %64, 1.000000e+03
%66 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* %43, i32 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), double %65)
br label %71
67: ; preds = %61
%68 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* %43, i32 %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i32 %2)
br label %71
69: ; preds = %37
%70 = tail call i32 (i8*, i32, i8*, ...) @snprintf(i8* %38, i32 %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i64 0, i64 0), i32 %2)
br label %71
71: ; preds = %52, %63, %67, %57, %7, %69
ret void
}