#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 *malloc(int);
scalar_t__ modf(double, double *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ swap(int *, int *);
char *howMuch(int m, int n) {
  if (m > n)
    swap(&m, &n);
  char *results = malloc(sizeof(char) * 1000);
  strcat(results, "[");
  double c = 0.0, b = 0.0;
  int i;
  for (i = m; i <= n; ++i) {
    c = (i - 1) / 9.0;
    b = (i - 2) / 7.0;
    if (c < 0 || b < 0)
      continue;
    double intpart;
    if (modf(c, &intpart) == 0 && modf(b, &intpart) == 0) {
      char *temp = malloc(sizeof(char) * 35);
      sprintf(temp, "[M: %d B: %d C: %d]", i, (int)b, (int)c);
      strcat(results, temp);
      strcpy(temp, "");
    }
  }
  strcat(results, "]");
  return results;
}


x86 assembly (clang, -O0):
<howMuch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1187 <howMuch+0x27>
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <swap@plt>
mov    $0x3e8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1060 <strcat@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12aa <howMuch+0x14a>
mov    -0x24(%rbp),%eax
sub    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe2f(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe0c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x18(%rbp),%xmm0
ja     1219 <howMuch+0xb9>
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    121e <howMuch+0xbe>
jmp    129c <howMuch+0x13c>
movsd  -0x18(%rbp),%xmm0
lea    -0x30(%rbp),%rdi
call   1040 <modf@plt>
cmp    $0x0,%rax
jne    1297 <howMuch+0x137>
movsd  -0x20(%rbp),%xmm0
lea    -0x30(%rbp),%rdi
call   1040 <modf@plt>
cmp    $0x0,%rax
jne    1297 <howMuch+0x137>
mov    $0x23,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x24(%rbp),%edx
cvttsd2si -0x20(%rbp),%ecx
cvttsd2si -0x18(%rbp),%r8d
lea    0xd9d(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1060 <strcat@plt>
mov    -0x38(%rbp),%rdi
lea    0xd7f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    129c <howMuch+0x13c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bb <howMuch+0x5b>
mov    -0x10(%rbp),%rdi
lea    0xd6f(%rip),%rsi
call   1060 <strcat@plt>
mov    -0x10(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<howMuch>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edi,0xc(%rsp)
mov    %esi,0x8(%rsp)
cmp    %esi,%edi
jle    1189 <howMuch+0x29>
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1080 <swap@plt>
mov    $0x3e8,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
lea    0xe83(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcat@plt>
mov    0xc(%rsp),%ebx
mov    0x8(%rsp),%eax
cmp    %eax,%ebx
jle    11d2 <howMuch+0x72>
lea    0xe7c(%rip),%rsi
mov    %r14,%rdi
call   1060 <strcat@plt>
mov    %r14,%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movdqa 0xe26(%rip),%xmm1
movapd 0xe2e(%rip),%xmm2
xorpd  %xmm3,%xmm3
lea    0x30(%rsp),%r15
lea    0xe30(%rip),%r12
lea    0xe28(%rip),%r13
jmp    1221 <howMuch+0xc1>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%eax
movdqa 0xdf4(%rip),%xmm1
movapd 0xdfc(%rip),%xmm2
xorpd  %xmm3,%xmm3
lea    0x1(%rbx),%ecx
cmp    %eax,%ebx
mov    %ecx,%ebx
jge    11b1 <howMuch+0x51>
movd   %ebx,%xmm0
pshufd $0x50,%xmm0,%xmm0
paddd  %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm4
divpd  %xmm2,%xmm4
movapd %xmm4,%xmm0
cmpltpd %xmm3,%xmm0
movmskpd %xmm0,%ecx
test   %ecx,%ecx
jne    1218 <howMuch+0xb8>
movapd %xmm4,0x10(%rsp)
movapd %xmm4,%xmm0
unpckhpd %xmm4,%xmm0
movapd %xmm0,0x20(%rsp)
mov    %r15,%rdi
call   1040 <modf@plt>
test   %rax,%rax
jne    1200 <howMuch+0xa0>
movapd 0x10(%rsp),%xmm0
mov    %r15,%rdi
call   1040 <modf@plt>
test   %rax,%rax
jne    1200 <howMuch+0xa0>
mov    $0x23,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
cvttsd2si 0x10(%rsp),%ecx
cvttsd2si 0x20(%rsp),%r8d
mov    %rax,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1070 <sprintf@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   1060 <strcat@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
jmp    1200 <howMuch+0xa0>

LLVM IR (-O0):
@.str = [2 x i8] c"[\00"
@.str.1 = [20 x i8] c"[M: %d B: %d C: %d]\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"]\00"
define i8* @howMuch(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
%8 = alloca i32
%9 = alloca double
%10 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 @swap(i32* %3, i32* %4)
br label %16
16: ; preds = %14, %2
%17 = call i8* @malloc(i32 1000)
store i8* %17, i8** %5
%18 = load i8*, i8** %5
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
%20 = load i32, i32* %3
store i32 %20, i32* %8
br label %21
21: ; preds = %63, %16
%22 = load i32, i32* %8
%23 = load i32, i32* %4
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %66
25: ; preds = %21
%26 = load i32, i32* %8
%27 = sub nsw i32 %26, 1
%28 = sitofp i32 %27 to double
%29 = fdiv double %28, 9.000000e+00
store double %29, double* %6
%30 = load i32, i32* %8
%31 = sub nsw i32 %30, 2
%32 = sitofp i32 %31 to double
%33 = fdiv double %32, 7.000000e+00
store double %33, double* %7
%34 = load double, double* %6
%35 = fcmp olt double %34, 0.000000e+00
br i1 %35, label %39, label %36
36: ; preds = %25
%37 = load double, double* %7
%38 = fcmp olt double %37, 0.000000e+00
br i1 %38, label %39, label %40
39: ; preds = %36, %25
br label %63
40: ; preds = %36
%41 = load double, double* %6
%42 = call i64 @modf(double %41, double* %9)
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %62
44: ; preds = %40
%45 = load double, double* %7
%46 = call i64 @modf(double %45, double* %9)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %62
48: ; preds = %44
%49 = call i8* @malloc(i32 35)
store i8* %49, i8** %10
%50 = load i8*, i8** %10
%51 = load i32, i32* %8
%52 = load double, double* %7
%53 = fptosi double %52 to i32
%54 = load double, double* %6
%55 = fptosi double %54 to i32
%56 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %51, i32 %53, i32 %55)
%57 = load i8*, i8** %5
%58 = load i8*, i8** %10
%59 = call i32 @strcat(i8* %57, i8* %58)
%60 = load i8*, i8** %10
%61 = call i32 @strcpy(i8* %60, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %62
62: ; preds = %48, %44, %40
br label %63
63: ; preds = %62, %39
%64 = load i32, i32* %8
%65 = add nsw i32 %64, 1
store i32 %65, i32* %8
br label %21
66: ; preds = %21
%67 = load i8*, i8** %5
%68 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%69 = load i8*, i8** %5
ret i8* %69
}

LLVM IR (-O2):
@.str = [2 x i8] c"[\00"
@.str.1 = [20 x i8] c"[M: %d B: %d C: %d]\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"]\00"
define i8* @howMuch(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = icmp sgt i32 %0, %1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @swap(i32* %3, i32* %4)
br label %9
9: ; preds = %7, %2
%10 = call dereferenceable_or_null(1000) i8* @malloc(i32 1000)
%11 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = icmp sgt i32 %12, %13
br i1 %14, label %50, label %15
15: ; preds = %9
%16 = bitcast double* %5 to i8*
br label %17
17: ; preds = %15, %46
%18 = phi i32 [ %13, %15 ], [ %47, %46 ]
%19 = phi i32 [ %12, %15 ], [ %48, %46 ]
%20 = insertelement <2 x i32> poison, i32 %19, i64 0
%21 = shufflevector <2 x i32> %20, <2 x i32> poison, <2 x i32> zeroinitializer
%22 = add nsw <2 x i32> %21, <i32 -2, i32 -1>
%23 = sitofp <2 x i32> %22 to <2 x double>
%24 = fdiv <2 x double> %23, <double 7.000000e+00, double 9.000000e+00>
%25 = fcmp olt <2 x double> %24, zeroinitializer
%26 = extractelement <2 x i1> %25, i64 0
%27 = extractelement <2 x i1> %25, i64 1
%28 = select i1 %27, i1 true, i1 %26
br i1 %28, label %46, label %29
29: ; preds = %17
%30 = extractelement <2 x double> %24, i64 1
%31 = call i64 @modf(double %30, double* %5)
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %44
33: ; preds = %29
%34 = extractelement <2 x double> %24, i64 0
%35 = call i64 @modf(double %34, double* %5)
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %33
%38 = call dereferenceable_or_null(35) i8* @malloc(i32 35)
%39 = fptosi double %34 to i32
%40 = fptosi double %30 to i32
%41 = call i32 @sprintf(i8* dereferenceable(1) %38, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i32 %19, i32 %39, i32 %40)
%42 = call i32 @strcat(i8* %10, i8* %38)
%43 = call i32 @strcpy(i8* %38, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %44
44: ; preds = %37, %33, %29
%45 = load i32, i32* %4
br label %46
46: ; preds = %17, %44
%47 = phi i32 [ %18, %17 ], [ %45, %44 ]
%48 = add nsw i32 %19, 1
%49 = icmp slt i32 %19, %47
br i1 %49, label %17, label %50
50: ; preds = %46, %9
%51 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i8* %10
}