#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*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void fancy_numbers(float num, char *fancy) {
  char number[18];
  if (num >= 100000000) {
    int num1 = (num / 1000000);
    sprintf(number, "%d", num1);
    strcpy(fancy, number);
    strcat(fancy, " Million");
  } else if (num >= 10000000) {
    int num1 = (num / 1000000);
    int num2 = (((int)num % 1000000) / 100000);
    sprintf(number, "%d", num1);
    strcpy(fancy, number);
    if (num2 > 0) {
      strcat(fancy, ".");
      sprintf(number, "%d", num2);
      strcat(fancy, number);
    }
    strcat(fancy, " Million");
  } else if (num >= 1000000) {
    int num1 = (num / 1000000);
    int num2 = (((int)num % 1000000) / 10000);
    sprintf(number, "%d", num1);
    strcpy(fancy, number);
    if (num2 > 0) {
      strcat(fancy, ".");
      sprintf(number, "%d", num2);
      strcat(fancy, number);
    }
    strcat(fancy, " Million");
  } else {
    sprintf(number, "%d", (int)num);
    strcpy(fancy, number);
  }
}


x86 assembly (clang, -O0):
<fancy_numbers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeb2(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     11a4 <fancy_numbers+0x74>
movss  -0x4(%rbp),%xmm0
movss  0xea4(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%edx
lea    0xe8f(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xe75(%rip),%rsi
call   1040 <strcat@plt>
jmp    133e <fancy_numbers+0x20e>
movss  -0x4(%rbp),%xmm0
movss  0xe53(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     125b <fancy_numbers+0x12b>
movss  -0x4(%rbp),%xmm0
movss  0xe41(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x38(%rbp)
cvttss2si -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x186a0,%ecx
cltd
idiv   %ecx
mov    %eax,-0x3c(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%edx
lea    0xe12(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
cmpl   $0x0,-0x3c(%rbp)
jle    1246 <fancy_numbers+0x116>
mov    -0x10(%rbp),%rdi
lea    0xdf7(%rip),%rsi
call   1040 <strcat@plt>
lea    -0x30(%rbp),%rdi
mov    -0x3c(%rbp),%edx
lea    0xdd8(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xdbe(%rip),%rsi
call   1040 <strcat@plt>
jmp    1339 <fancy_numbers+0x209>
movss  -0x4(%rbp),%xmm0
movss  0xda0(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1312 <fancy_numbers+0x1e2>
movss  -0x4(%rbp),%xmm0
movss  0xd8a(%rip),%xmm1
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x40(%rbp)
cvttss2si -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,-0x44(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x40(%rbp),%edx
lea    0xd5b(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
cmpl   $0x0,-0x44(%rbp)
jle    12fd <fancy_numbers+0x1cd>
mov    -0x10(%rbp),%rdi
lea    0xd40(%rip),%rsi
call   1040 <strcat@plt>
lea    -0x30(%rbp),%rdi
mov    -0x44(%rbp),%edx
lea    0xd21(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <strcat@plt>
mov    -0x10(%rbp),%rdi
lea    0xd07(%rip),%rsi
call   1040 <strcat@plt>
jmp    1334 <fancy_numbers+0x204>
lea    -0x30(%rbp),%rdi
cvttss2si -0x4(%rbp),%edx
lea    0xcea(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    1339 <fancy_numbers+0x209>
jmp    133e <fancy_numbers+0x20e>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fancy_numbers>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%r14
ucomiss 0xebd(%rip),%xmm0
jae    1181 <fancy_numbers+0x51>
ucomiss 0xebc(%rip),%xmm0
jae    11af <fancy_numbers+0x7f>
ucomiss 0xeaf(%rip),%xmm0
jae    1217 <fancy_numbers+0xe7>
cvttss2si %xmm0,%edx
lea    0xea6(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
jmp    12b7 <fancy_numbers+0x187>
divss  0xe7b(%rip),%xmm0
cvttss2si %xmm0,%edx
lea    0xe78(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
jmp    12a8 <fancy_numbers+0x178>
cvttss2si %xmm0,%eax
divss  0xe49(%rip),%xmm0
cvttss2si %xmm0,%edx
movslq %eax,%rbx
imul   $0x431bde83,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
imul   $0xf4240,%eax,%eax
sub    %eax,%ebx
lea    0xe27(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
cmp    $0x186a0,%ebx
jl     12a8 <fancy_numbers+0x178>
shr    $0x5,%ebx
imul   $0xa7c5ac5,%rbx,%rbx
shr    $0x27,%rbx
jmp    127a <fancy_numbers+0x14a>
cvttss2si %xmm0,%eax
divss  0xde1(%rip),%xmm0
cvttss2si %xmm0,%edx
movslq %eax,%rbx
imul   $0x431bde83,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
imul   $0xf4240,%eax,%eax
sub    %eax,%ebx
lea    0xdbf(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
call   1050 <sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
cmp    $0x2710,%ebx
jl     12a8 <fancy_numbers+0x178>
mov    %ebx,%eax
mov    $0xd1b71759,%ebx
imul   %rax,%rbx
shr    $0x2d,%rbx
lea    0xd97(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcat@plt>
lea    0xd7c(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %ebx,%edx
call   1050 <sprintf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcat@plt>
lea    0xd60(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcat@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c" Million\00"
@.str.2 = [2 x i8] c".\00"
define void @fancy_numbers(float %0, i8* %1) {
%3 = alloca float
%4 = alloca i8*
%5 = alloca [18 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store float %0, float* %3
store i8* %1, i8** %4
%11 = load float, float* %3
%12 = fcmp oge float %11, 1.000000e+08
br i1 %12, label %13, label %25
13: ; preds = %2
%14 = load float, float* %3
%15 = fdiv float %14, 1.000000e+06
%16 = fptosi float %15 to i32
store i32 %16, i32* %6
%17 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%18 = load i32, i32* %6
%19 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i8*, i8** %4
%21 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%22 = call i32 @strcpy(i8* %20, i8* %21)
%23 = load i8*, i8** %4
%24 = call i32 @strcat(i8* %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %97
25: ; preds = %2
%26 = load float, float* %3
%27 = fcmp oge float %26, 1.000000e+07
br i1 %27, label %28, label %56
28: ; preds = %25
%29 = load float, float* %3
%30 = fdiv float %29, 1.000000e+06
%31 = fptosi float %30 to i32
store i32 %31, i32* %7
%32 = load float, float* %3
%33 = fptosi float %32 to i32
%34 = srem i32 %33, 1000000
%35 = sdiv i32 %34, 100000
store i32 %35, i32* %8
%36 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%37 = load i32, i32* %7
%38 = call i32 @sprintf(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = load i8*, i8** %4
%40 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%41 = call i32 @strcpy(i8* %39, i8* %40)
%42 = load i32, i32* %8
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %53
44: ; preds = %28
%45 = load i8*, i8** %4
%46 = call i32 @strcat(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%47 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%48 = load i32, i32* %8
%49 = call i32 @sprintf(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %48)
%50 = load i8*, i8** %4
%51 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%52 = call i32 @strcat(i8* %50, i8* %51)
br label %53
53: ; preds = %44, %28
%54 = load i8*, i8** %4
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %96
56: ; preds = %25
%57 = load float, float* %3
%58 = fcmp oge float %57, 1.000000e+06
br i1 %58, label %59, label %87
59: ; preds = %56
%60 = load float, float* %3
%61 = fdiv float %60, 1.000000e+06
%62 = fptosi float %61 to i32
store i32 %62, i32* %9
%63 = load float, float* %3
%64 = fptosi float %63 to i32
%65 = srem i32 %64, 1000000
%66 = sdiv i32 %65, 10000
store i32 %66, i32* %10
%67 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%68 = load i32, i32* %9
%69 = call i32 @sprintf(i8* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %68)
%70 = load i8*, i8** %4
%71 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%72 = call i32 @strcpy(i8* %70, i8* %71)
%73 = load i32, i32* %10
%74 = icmp sgt i32 %73, 0
br i1 %74, label %75, label %84
75: ; preds = %59
%76 = load i8*, i8** %4
%77 = call i32 @strcat(i8* %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%78 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%79 = load i32, i32* %10
%80 = call i32 @sprintf(i8* %78, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %79)
%81 = load i8*, i8** %4
%82 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%83 = call i32 @strcat(i8* %81, i8* %82)
br label %84
84: ; preds = %75, %59
%85 = load i8*, i8** %4
%86 = call i32 @strcat(i8* %85, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %95
87: ; preds = %56
%88 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%89 = load float, float* %3
%90 = fptosi float %89 to i32
%91 = call i32 @sprintf(i8* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %90)
%92 = load i8*, i8** %4
%93 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 0
%94 = call i32 @strcpy(i8* %92, i8* %93)
br label %95
95: ; preds = %87, %84
br label %96
96: ; preds = %95, %53
br label %97
97: ; preds = %96, %13
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c" Million\00"
@.str.2 = [2 x i8] c".\00"
define void @fancy_numbers(float %0, i8* %1) {
%3 = alloca [18 x i8]
%4 = getelementptr inbounds [18 x i8], [18 x i8]* %3, i64 0, i64 0
%5 = fcmp ult float %0, 1.000000e+08
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = fdiv float %0, 1.000000e+06
%8 = fptosi float %7 to i32
%9 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 @strcpy(i8* %1, i8* %4)
%11 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %50
12: ; preds = %2
%13 = fcmp ult float %0, 1.000000e+07
br i1 %13, label %29, label %14
14: ; preds = %12
%15 = fdiv float %0, 1.000000e+06
%16 = fptosi float %15 to i32
%17 = fptosi float %0 to i32
%18 = srem i32 %17, 1000000
%19 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %16)
%20 = call i32 @strcpy(i8* %1, i8* %4)
%21 = icmp sgt i32 %18, 99999
br i1 %21, label %22, label %27
22: ; preds = %14
%23 = udiv i32 %18, 100000
%24 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%25 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %23)
%26 = call i32 @strcat(i8* %1, i8* %4)
br label %27
27: ; preds = %22, %14
%28 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %50
29: ; preds = %12
%30 = fcmp ult float %0, 1.000000e+06
br i1 %30, label %46, label %31
31: ; preds = %29
%32 = fdiv float %0, 1.000000e+06
%33 = fptosi float %32 to i32
%34 = fptosi float %0 to i32
%35 = srem i32 %34, 1000000
%36 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %33)
%37 = call i32 @strcpy(i8* %1, i8* %4)
%38 = icmp sgt i32 %35, 9999
br i1 %38, label %39, label %44
39: ; preds = %31
%40 = udiv i32 %35, 10000
%41 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%42 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %40)
%43 = call i32 @strcat(i8* %1, i8* %4)
br label %44
44: ; preds = %39, %31
%45 = call i32 @strcat(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %50
46: ; preds = %29
%47 = fptosi float %0 to i32
%48 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %47)
%49 = call i32 @strcpy(i8* %1, i8* %4)
br label %50
50: ; preds = %27, %46, %44, %6
ret void
}