#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*/ mpfr_printf(char *);
int /*<<< orphan*/ putchar(char const);
int /*<<< orphan*/ round_str(char const *, char const *, int, int, int, int);
void round_for_all(const char *s) {
  static const struct fmt {
    const char *suffix;
    int prec;
    int emin;
    int emax;
    bool ibm_ld;
  } formats[7] = {
      {"f", 24, -148, 128, false},      {"", 53, -1073, 1024, false},
      {"L", 53, -1073, 1024, false},    {"L", 64, -16444, 16384, false},
      {"L", 64, -16445, 16384, false},  {"L", 106, -1073, 1024, true},
      {"L", 113, -16493, 16384, false},
  };
  mpfr_printf("  TEST (\"");
  const char *p;
  for (p = s; *p; p++) {
    putchar(*p);
    if ((p - s) % 60 == 59 && p[1])
      mpfr_printf("\"\n\t\"");
  }
  mpfr_printf("\",\n");
  int i;
  for (i = 0; i < 7; i++) {
    round_str(s, formats[i].suffix, formats[i].prec, formats[i].emin,
              formats[i].emax, formats[i].ibm_ld);
    if (i < 6)
      mpfr_printf(",\n");
  }
  mpfr_printf("),\n");
}


x86 assembly (clang, -O0):
<round_for_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xec1(%rip),%rdi
call   1040 <mpfr_printf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11bb <round_for_all+0x8b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
cmp    $0x3b,%rdx
jne    11a5 <round_for_all+0x75>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
je     11a5 <round_for_all+0x75>
lea    0xe6e(%rip),%rdi
call   1040 <mpfr_printf@plt>
jmp    11aa <round_for_all+0x7a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1150 <round_for_all+0x20>
lea    0xe51(%rip),%rdi
call   1040 <mpfr_printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    1275 <round_for_all+0x145>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rcx
lea    0x2b89(%rip),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%rsi
movslq -0x14(%rbp),%rcx
lea    0x2b74(%rip),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%edx
movslq -0x14(%rbp),%rcx
lea    0x2b5f(%rip),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0xc(%rax),%ecx
movslq -0x14(%rbp),%r8
lea    0x2b4a(%rip),%rax
imul   $0x18,%r8,%r8
add    %r8,%rax
mov    0x10(%rax),%r8d
movslq -0x14(%rbp),%r9
lea    0x2b34(%rip),%rax
imul   $0x18,%r9,%r9
add    %r9,%rax
mov    0x14(%rax),%r9d
call   1050 <round_str@plt>
cmpl   $0x6,-0x14(%rbp)
jge    1262 <round_for_all+0x132>
lea    0xdb7(%rip),%rdi
call   1040 <mpfr_printf@plt>
jmp    1267 <round_for_all+0x137>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ce <round_for_all+0x9e>
lea    0xd9b(%rip),%rdi
call   1040 <mpfr_printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_for_all>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r12
lea    0xec2(%rip),%rdi
call   1040 <mpfr_printf@plt>
mov    (%r12),%al
test   %al,%al
je     11bf <round_for_all+0x8f>
xor    %ebx,%ebx
movabs $0x8888888888888889,%r15
88 88 88
lea    0xeac(%rip),%r14
jmp    117e <round_for_all+0x4e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%r12,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
je     11bf <round_for_all+0x8f>
movsbl %al,%edi
call   1030 <putchar@plt>
mov    %rbx,%rax
imul   %r15
add    %rbx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x5,%rdx
add    %rax,%rdx
imul   $0x3c,%rdx,%rax
mov    %rbx,%rcx
sub    %rax,%rcx
cmp    $0x3b,%rcx
jne    1170 <round_for_all+0x40>
cmpb   $0x0,0x1(%r12,%rbx,1)
je     1170 <round_for_all+0x40>
mov    %r14,%rdi
call   1040 <mpfr_printf@plt>
jmp    1170 <round_for_all+0x40>
lea    0xe4d(%rip),%rdi
call   1040 <mpfr_printf@plt>
lea    0xe2e(%rip),%rsi
mov    %r12,%rdi
mov    $0x18,%edx
mov    $0xffffff6c,%ecx
mov    $0x80,%r8d
xor    %r9d,%r9d
call   1050 <round_str@plt>
lea    0xe20(%rip),%r14
mov    %r14,%rdi
call   1040 <mpfr_printf@plt>
lea    0xe13(%rip),%rsi
mov    %r12,%rdi
mov    $0x35,%edx
mov    $0xfffffbcf,%ecx
mov    $0x400,%r8d
xor    %r9d,%r9d
call   1050 <round_str@plt>
mov    %r14,%rdi
call   1040 <mpfr_printf@plt>
lea    0xdd5(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x35,%edx
mov    $0xfffffbcf,%ecx
mov    $0x400,%r8d
xor    %r9d,%r9d
call   1050 <round_str@plt>
mov    %r14,%rdi
call   1040 <mpfr_printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x40,%edx
mov    $0xffffbfc4,%ecx
mov    $0x4000,%r8d
xor    %r9d,%r9d
call   1050 <round_str@plt>
mov    %r14,%rdi
call   1040 <mpfr_printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x40,%edx
mov    $0xffffbfc3,%ecx
mov    $0x4000,%r8d
xor    %r9d,%r9d
call   1050 <round_str@plt>
mov    %r14,%rdi
call   1040 <mpfr_printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x6a,%edx
mov    $0xfffffbcf,%ecx
mov    $0x400,%r8d
mov    $0x1,%r9d
call   1050 <round_str@plt>
mov    %r14,%rdi
call   1040 <mpfr_printf@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0x71,%edx
mov    $0xffffbf93,%ecx
mov    $0x4000,%r8d
xor    %r9d,%r9d
call   1050 <round_str@plt>
lea    0xd2a(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <mpfr_printf@plt>

LLVM IR (-O0):
%struct.fmt = type { i8*, i32, i32, i32, i32 }
@round_for_all.formats = internal constant [7 x %struct.fmt] [%struct.fmt { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i32 24, i32 -148, i32 128, i32 0 }, %struct.fmt { i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i32 0, i32 0), i32 53, i32 -1073, i32 1024, i32 0 }, %struct.fmt { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i32 53, i32 -1073, i32 1024, i32 0 }, %struct.fmt { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i32 64, i32 -16444, i32 16384, i32 0 }, %struct.fmt { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i32 64, i32 -16445, i32 16384, i32 0 }, %struct.fmt { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i32 106, i32 -1073, i32 1024, i32 1 }, %struct.fmt { i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i32 113, i32 -16493, i32 16384, i32 0 }]
@.str = [2 x i8] c"f\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"L\00"
@.str.3 = [10 x i8] c" TEST (\22\00"
@.str.4 = [5 x i8] c"\22\0A\09\22\00"
@.str.5 = [4 x i8] c"\22,\0A\00"
@.str.6 = [3 x i8] c",\0A\00"
@.str.7 = [4 x i8] c"),\0A\00"
define void @round_for_all(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = call i32 @mpfr_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%6 = load i8*, i8** %2
store i8* %6, i8** %3
br label %7
7: ; preds = %31, %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %11, label %34
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = call i32 @putchar(i8 signext %13)
%15 = load i8*, i8** %3
%16 = load i8*, i8** %2
%17 = ptrtoint i8* %15 to i64
%18 = ptrtoint i8* %16 to i64
%19 = sub i64 %17, %18
%20 = srem i64 %19, 60
%21 = icmp eq i64 %20, 59
br i1 %21, label %22, label %30
22: ; preds = %11
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @mpfr_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %28, %22, %11
br label %31
31: ; preds = %30
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %3
br label %7
34: ; preds = %7
%35 = call i32 @mpfr_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %4
br label %36
36: ; preds = %72, %34
%37 = load i32, i32* %4
%38 = icmp slt i32 %37, 7
br i1 %38, label %39, label %75
39: ; preds = %36
%40 = load i8*, i8** %2
%41 = load i32, i32* %4
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [7 x %struct.fmt], [7 x %struct.fmt]* @round_for_all.formats, i64 0, i64 %42
%44 = getelementptr inbounds %struct.fmt, %struct.fmt* %43, i32 0, i32 0
%45 = load i8*, i8** %44
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [7 x %struct.fmt], [7 x %struct.fmt]* @round_for_all.formats, i64 0, i64 %47
%49 = getelementptr inbounds %struct.fmt, %struct.fmt* %48, i32 0, i32 1
%50 = load i32, i32* %49
%51 = load i32, i32* %4
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [7 x %struct.fmt], [7 x %struct.fmt]* @round_for_all.formats, i64 0, i64 %52
%54 = getelementptr inbounds %struct.fmt, %struct.fmt* %53, i32 0, i32 2
%55 = load i32, i32* %54
%56 = load i32, i32* %4
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [7 x %struct.fmt], [7 x %struct.fmt]* @round_for_all.formats, i64 0, i64 %57
%59 = getelementptr inbounds %struct.fmt, %struct.fmt* %58, i32 0, i32 3
%60 = load i32, i32* %59
%61 = load i32, i32* %4
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [7 x %struct.fmt], [7 x %struct.fmt]* @round_for_all.formats, i64 0, i64 %62
%64 = getelementptr inbounds %struct.fmt, %struct.fmt* %63, i32 0, i32 4
%65 = load i32, i32* %64
%66 = call i32 @round_str(i8* %40, i8* %45, i32 %50, i32 %55, i32 %60, i32 %65)
%67 = load i32, i32* %4
%68 = icmp slt i32 %67, 6
br i1 %68, label %69, label %71
69: ; preds = %39
%70 = call i32 @mpfr_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %71
71: ; preds = %69, %39
br label %72
72: ; preds = %71
%73 = load i32, i32* %4
%74 = add nsw i32 %73, 1
store i32 %74, i32* %4
br label %36
75: ; preds = %36
%76 = call i32 @mpfr_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"f\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"L\00"
@.str.3 = [10 x i8] c" TEST (\22\00"
@.str.4 = [5 x i8] c"\22\0A\09\22\00"
@.str.5 = [4 x i8] c"\22,\0A\00"
@.str.6 = [3 x i8] c",\0A\00"
@.str.7 = [4 x i8] c"),\0A\00"
define void @round_for_all(i8* %0) {
%2 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %25, label %5
5: ; preds = %1
%6 = ptrtoint i8* %0 to i64
br label %7
7: ; preds = %5, %21
%8 = phi i8 [ %3, %5 ], [ %23, %21 ]
%9 = phi i8* [ %0, %5 ], [ %22, %21 ]
%10 = tail call i32 @putchar(i8 signext %8)
%11 = ptrtoint i8* %9 to i64
%12 = sub i64 %11, %6
%13 = srem i64 %12, 60
%14 = icmp eq i64 %13, 59
br i1 %14, label %15, label %21
15: ; preds = %7
%16 = getelementptr inbounds i8, i8* %9, i64 1
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %21
21: ; preds = %7, %15, %19
%22 = getelementptr inbounds i8, i8* %9, i64 1
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %7
25: ; preds = %21, %1
%26 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%27 = tail call i32 @round_str(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 24, i32 -148, i32 128, i32 0)
%28 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%29 = tail call i32 @round_str(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i32 53, i32 -1073, i32 1024, i32 0)
%30 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%31 = tail call i32 @round_str(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 53, i32 -1073, i32 1024, i32 0)
%32 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%33 = tail call i32 @round_str(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 64, i32 -16444, i32 16384, i32 0)
%34 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%35 = tail call i32 @round_str(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 64, i32 -16445, i32 16384, i32 0)
%36 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%37 = tail call i32 @round_str(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 106, i32 -1073, i32 1024, i32 1)
%38 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%39 = tail call i32 @round_str(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 113, i32 -16493, i32 16384, i32 0)
%40 = tail call i32 @mpfr_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
ret void
}