#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 */
char *DataAfterAlignedString(char *, char *);
scalar_t__ IsNiceString(char *, char *);
int ntohl(int);
int /*<<< orphan*/ printf(char *, ...);
void PrintHeuristicallyTypeGuessedArgs(void *v, int n, int skipComma) {
  int i, thisi;
  float thisf;
  int *ints;
  char *chars;
  char *string, *nextString;
  ints = v;
  chars = v;
  for (i = 0; i < n / 4;) {
    string = &chars[i * 4];
    thisi = ntohl(ints[i]);
    thisf = *(((float *)(&thisi)));
    if (thisi >= -1000 && thisi <= 1000000) {
      printf("%d ", thisi);
      i++;
    } else if (thisf >= -1000.f && thisf <= 1000000.f &&
               (thisf <= 0.0f || thisf >= 0.000001f)) {
      printf("%f ", thisf);
      i++;
    } else if (IsNiceString(string, chars + n)) {
      nextString = DataAfterAlignedString(string, chars + n);
      printf("\"%s\" ", (i == 0 && skipComma) ? string + 1 : string);
      i += (nextString - string) / 4;
    } else {
      printf("0x%x ", ints[i]);
      i++;
    }
  }
}


x86 assembly (clang, -O0):
<PrintHeuristicallyTypeGuessedArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jge    132e <PrintHeuristicallyTypeGuessedArgs+0x1ee>
mov    -0x30(%rbp),%rax
mov    -0x14(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
call   1060 <ntohl@plt>
mov    %eax,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
cmpl   $0xfffffc18,-0x18(%rbp)
jl     11f1 <PrintHeuristicallyTypeGuessedArgs+0xb1>
cmpl   $0xf4240,-0x18(%rbp)
jg     11f1 <PrintHeuristicallyTypeGuessedArgs+0xb1>
mov    -0x18(%rbp),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1329 <PrintHeuristicallyTypeGuessedArgs+0x1e9>
movss  -0x1c(%rbp),%xmm0
movss  0xe02(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1261 <PrintHeuristicallyTypeGuessedArgs+0x121>
movss  0xdf5(%rip),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jb     1261 <PrintHeuristicallyTypeGuessedArgs+0x121>
xorps  %xmm0,%xmm0
ucomiss -0x1c(%rbp),%xmm0
jae    123c <PrintHeuristicallyTypeGuessedArgs+0xfc>
movss  -0x1c(%rbp),%xmm0
movss  0xdd5(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1261 <PrintHeuristicallyTypeGuessedArgs+0x121>
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdc4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1324 <PrintHeuristicallyTypeGuessedArgs+0x1e4>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
call   1050 <IsNiceString@plt>
cmp    $0x0,%rax
je     12fd <PrintHeuristicallyTypeGuessedArgs+0x1bd>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
call   1040 <DataAfterAlignedString@plt>
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    12bc <PrintHeuristicallyTypeGuessedArgs+0x17c>
cmpl   $0x0,-0x10(%rbp)
je     12bc <PrintHeuristicallyTypeGuessedArgs+0x17c>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x50(%rbp)
jmp    12c4 <PrintHeuristicallyTypeGuessedArgs+0x184>
mov    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rsi
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
mov    -0x38(%rbp),%rcx
sub    %rcx,%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
movslq -0x14(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x14(%rbp)
jmp    131f <PrintHeuristicallyTypeGuessedArgs+0x1df>
mov    -0x28(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1324 <PrintHeuristicallyTypeGuessedArgs+0x1e4>
jmp    1329 <PrintHeuristicallyTypeGuessedArgs+0x1e9>
jmp    1169 <PrintHeuristicallyTypeGuessedArgs+0x29>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintHeuristicallyTypeGuessedArgs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edx,0xc(%rsp)
lea    0x3(%rsi),%r14d
test   %esi,%esi
cmovns %esi,%r14d
cmp    $0x4,%esi
jl     1296 <PrintHeuristicallyTypeGuessedArgs+0x156>
mov    %rdi,%rbx
sar    $0x2,%r14d
mov    %esi,%r12d
add    %rdi,%r12
xor    %r15d,%r15d
mov    %rdi,0x10(%rsp)
jmp    1206 <PrintHeuristicallyTypeGuessedArgs+0xc6>
nop
lea    0x0(,%r15,4),%eax
movslq %eax,%r13
add    %rbx,%r13
mov    %r13,%rdi
mov    %r12,%rsi
call   1050 <IsNiceString@plt>
test   %rax,%rax
je     127b <PrintHeuristicallyTypeGuessedArgs+0x13b>
cmpl   $0x0,0xc(%rsp)
mov    %r14d,%ebp
setne  %r14b
mov    %r13,%rdi
mov    %r12,%rsi
call   1040 <DataAfterAlignedString@plt>
mov    %r12,%rbx
mov    %rax,%r12
test   %r15d,%r15d
sete   %al
and    %r14b,%al
mov    %ebp,%r14d
movzbl %al,%esi
add    %r13,%rsi
lea    0xe40(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
sub    %r13,%r12
lea    0x3(%r12),%rax
test   %r12,%r12
cmovns %r12,%rax
mov    %rbx,%r12
mov    0x10(%rsp),%rbx
shr    $0x2,%rax
add    %eax,%r15d
cmp    %r14d,%r15d
jge    1296 <PrintHeuristicallyTypeGuessedArgs+0x156>
movslq %r15d,%rbp
mov    (%rbx,%rbp,4),%edi
call   1060 <ntohl@plt>
lea    0x3e8(%rax),%ecx
cmp    $0xf4628,%ecx
ja     1230 <PrintHeuristicallyTypeGuessedArgs+0xf0>
lea    0xdea(%rip),%rdi
mov    %eax,%esi
jmp    1285 <PrintHeuristicallyTypeGuessedArgs+0x145>
nopw   0x0(%rax,%rax,1)
movd   %eax,%xmm0
ucomiss 0xdc5(%rip),%xmm0
jb     1180 <PrintHeuristicallyTypeGuessedArgs+0x40>
movss  0xdbb(%rip),%xmm1
ucomiss %xmm0,%xmm1
jb     1180 <PrintHeuristicallyTypeGuessedArgs+0x40>
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
jae    1267 <PrintHeuristicallyTypeGuessedArgs+0x127>
ucomiss 0xda7(%rip),%xmm0
jb     1180 <PrintHeuristicallyTypeGuessedArgs+0x40>
cvtss2sd %xmm0,%xmm0
lea    0xda2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
jmp    128c <PrintHeuristicallyTypeGuessedArgs+0x14c>
mov    (%rbx,%rbp,4),%esi
lea    0xd99(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
jmp    11fa <PrintHeuristicallyTypeGuessedArgs+0xba>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [6 x i8] c"\22%s\22 \00"
@.str.3 = [6 x i8] c"0x%x \00"
define void @PrintHeuristicallyTypeGuessedArgs(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
%10 = alloca i32*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%14 = load i8*, i8** %4
%15 = bitcast i8* %14 to i32*
store i32* %15, i32** %10
%16 = load i8*, i8** %4
store i8* %16, i8** %11
store i32 0, i32* %7
br label %17
17: ; preds = %113, %3
%18 = load i32, i32* %7
%19 = load i32, i32* %5
%20 = sdiv i32 %19, 4
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %114
22: ; preds = %17
%23 = load i8*, i8** %11
%24 = load i32, i32* %7
%25 = mul nsw i32 %24, 4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %23, i64 %26
store i8* %27, i8** %12
%28 = load i32*, i32** %10
%29 = load i32, i32* %7
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = call i32 @ntohl(i32 %32)
store i32 %33, i32* %8
%34 = bitcast i32* %8 to float*
%35 = load float, float* %34
store float %35, float* %9
%36 = load i32, i32* %8
%37 = icmp sge i32 %36, -1000
br i1 %37, label %38, label %46
38: ; preds = %22
%39 = load i32, i32* %8
%40 = icmp sle i32 %39, 1000000
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = load i32, i32* %8
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %42)
%44 = load i32, i32* %7
%45 = add nsw i32 %44, 1
store i32 %45, i32* %7
br label %113
46: ; preds = %38, %22
%47 = load float, float* %9
%48 = fcmp oge float %47, -1.000000e+03
br i1 %48, label %49, label %64
49: ; preds = %46
%50 = load float, float* %9
%51 = fcmp ole float %50, 1.000000e+06
br i1 %51, label %52, label %64
52: ; preds = %49
%53 = load float, float* %9
%54 = fcmp ole float %53, 0.000000e+00
br i1 %54, label %58, label %55
55: ; preds = %52
%56 = load float, float* %9
%57 = fcmp oge float %56, 0x3EB0C6F7A0000000
br i1 %57, label %58, label %64
58: ; preds = %55, %52
%59 = load float, float* %9
%60 = fpext float %59 to double
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %60)
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
br label %112
64: ; preds = %55, %49, %46
%65 = load i8*, i8** %12
%66 = load i8*, i8** %11
%67 = load i32, i32* %5
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %66, i64 %68
%70 = call i64 @IsNiceString(i8* %65, i8* %69)
%71 = icmp ne i64 %70, 0
br i1 %71, label %72, label %102
72: ; preds = %64
%73 = load i8*, i8** %12
%74 = load i8*, i8** %11
%75 = load i32, i32* %5
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %74, i64 %76
%78 = call i8* @DataAfterAlignedString(i8* %73, i8* %77)
store i8* %78, i8** %13
%79 = load i32, i32* %7
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %87
81: ; preds = %72
%82 = load i32, i32* %6
%83 = icmp ne i32 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %81
%85 = load i8*, i8** %12
%86 = getelementptr inbounds i8, i8* %85, i64 1
br label %89
87: ; preds = %81, %72
%88 = load i8*, i8** %12
br label %89
89: ; preds = %87, %84
%90 = phi i8* [ %86, %84 ], [ %88, %87 ]
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %90)
%92 = load i8*, i8** %13
%93 = load i8*, i8** %12
%94 = ptrtoint i8* %92 to i64
%95 = ptrtoint i8* %93 to i64
%96 = sub i64 %94, %95
%97 = sdiv i64 %96, 4
%98 = load i32, i32* %7
%99 = sext i32 %98 to i64
%100 = add nsw i64 %99, %97
%101 = trunc i64 %100 to i32
store i32 %101, i32* %7
br label %111
102: ; preds = %64
%103 = load i32*, i32** %10
%104 = load i32, i32* %7
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i32, i32* %103, i64 %105
%107 = load i32, i32* %106
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %107)
%109 = load i32, i32* %7
%110 = add nsw i32 %109, 1
store i32 %110, i32* %7
br label %111
111: ; preds = %102, %89
br label %112
112: ; preds = %111, %58
br label %113
113: ; preds = %112, %41
br label %17
114: ; preds = %17
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [4 x i8] c"%f \00"
@.str.2 = [6 x i8] c"\22%s\22 \00"
@.str.3 = [6 x i8] c"0x%x \00"
define void @PrintHeuristicallyTypeGuessedArgs(i8* %0, i32 %1, i32 %2) {
%4 = bitcast i8* %0 to i32*
%5 = sdiv i32 %1, 4
%6 = icmp sgt i32 %1, 3
br i1 %6, label %7, label %58
7: ; preds = %3
%8 = zext i32 %1 to i64
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = icmp ne i32 %2, 0
br label %11
11: ; preds = %7, %54
%12 = phi i32 [ 0, %7 ], [ %56, %54 ]
%13 = shl nsw i32 %12, 2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %0, i64 %14
%16 = sext i32 %12 to i64
%17 = getelementptr inbounds i32, i32* %4, i64 %16
%18 = load i32, i32* %17
%19 = tail call i32 @ntohl(i32 %18)
%20 = bitcast i32 %19 to float
%21 = add i32 %19, 1000
%22 = icmp ult i32 %21, 1001001
br i1 %22, label %23, label %25
23: ; preds = %11
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %54
25: ; preds = %11
%26 = fcmp oge float %20, -1.000000e+03
%27 = fcmp ole float %20, 1.000000e+06
%28 = and i1 %26, %27
br i1 %28, label %29, label %36
29: ; preds = %25
%30 = fcmp ole float %20, 0.000000e+00
%31 = fcmp oge float %20, 0x3EB0C6F7A0000000
%32 = or i1 %30, %31
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = fpext float %20 to double
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %34)
br label %54
36: ; preds = %29, %25
%37 = tail call i64 @IsNiceString(i8* %15, i8* %9)
%38 = icmp eq i64 %37, 0
br i1 %38, label %51, label %39
39: ; preds = %36
%40 = tail call i8* @DataAfterAlignedString(i8* %15, i8* %9)
%41 = icmp eq i32 %12, 0
%42 = and i1 %10, %41
%43 = zext i1 %42 to i64
%44 = getelementptr i8, i8* %15, i64 %43
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %44)
%46 = ptrtoint i8* %40 to i64
%47 = ptrtoint i8* %15 to i64
%48 = sub i64 %46, %47
%49 = sdiv i64 %48, 4
%50 = trunc i64 %49 to i32
br label %54
51: ; preds = %36
%52 = load i32, i32* %17
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %52)
br label %54
54: ; preds = %33, %51, %39, %23
%55 = phi i32 [ 1, %33 ], [ 1, %51 ], [ %50, %39 ], [ 1, %23 ]
%56 = add i32 %12, %55
%57 = icmp slt i32 %56, %5
br i1 %57, label %11, label %58
58: ; preds = %54, %3
ret void
}