#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*/ assertEquals(char *, int /*<<< orphan*/);
int /*<<< orphan*/ getNumberInWords(int);
void test6DigitNumbers() {
  assertEquals("one lakh", getNumberInWords(100000));
  assertEquals("one lakh one", getNumberInWords(100001));
  assertEquals("one lakh nine thousand eight hundred seventy six",
               getNumberInWords(109876));
  assertEquals("two lakh ten thousand nine hundred eighty seven",
               getNumberInWords(210987));
  assertEquals("three lakh twenty one thousand ninety eight",
               getNumberInWords(321098));
  assertEquals("four lakh thirty two thousand one hundred nine",
               getNumberInWords(432109));
  assertEquals("five lakh forty three thousand two hundred ten",
               getNumberInWords(543210));
  assertEquals("six lakh fifty four thousand three hundred twenty one",
               getNumberInWords(654321));
  assertEquals("seven lakh sixty five thousand four hundred thirty two",
               getNumberInWords(765432));
  assertEquals("eight lakh seventy six thousand five hundred forty three",
               getNumberInWords(876543));
  assertEquals("nine lakh eighty seven thousand six hundred fifty four",
               getNumberInWords(987654));
  assertEquals("nine lakh ninety nine thousand nine hundred ninety nine",
               getNumberInWords(999999));
}


x86 assembly (clang, -O0):
<test6DigitNumbers>:
push   %rbp
mov    %rsp,%rbp
mov    $0x186a0,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0x186a1,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0x1ad34,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xeaf(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0x3382b,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xec8(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0x4e64a,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xee0(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0x697ed,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xef4(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0x849ea,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xf0b(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0x9fbf1,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xf22(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0xbadf8,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xf40(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0xd5fff,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xf5f(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0xf1206,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xf80(%rip),%rdi
call   1030 <assertEquals@plt>
mov    $0xf423f,%edi
call   1040 <getNumberInWords@plt>
mov    %eax,%esi
lea    0xf9f(%rip),%rdi
call   1030 <assertEquals@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test6DigitNumbers>:
push   %rax
mov    $0x186a0,%edi
call   1040 <getNumberInWords@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0x186a1,%edi
call   1040 <getNumberInWords@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0x1ad34,%edi
call   1040 <getNumberInWords@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0x3382b,%edi
call   1040 <getNumberInWords@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0x4e64a,%edi
call   1040 <getNumberInWords@plt>
lea    0xee5(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0x697ed,%edi
call   1040 <getNumberInWords@plt>
lea    0xef9(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0x849ea,%edi
call   1040 <getNumberInWords@plt>
lea    0xf10(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0x9fbf1,%edi
call   1040 <getNumberInWords@plt>
lea    0xf27(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0xbadf8,%edi
call   1040 <getNumberInWords@plt>
lea    0xf45(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0xd5fff,%edi
call   1040 <getNumberInWords@plt>
lea    0xf64(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0xf1206,%edi
call   1040 <getNumberInWords@plt>
lea    0xf85(%rip),%rdi
mov    %eax,%esi
call   1030 <assertEquals@plt>
mov    $0xf423f,%edi
call   1040 <getNumberInWords@plt>
lea    0xfa4(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <assertEquals@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"one lakh\00"
@.str.1 = [13 x i8] c"one lakh one\00"
@.str.2 = [49 x i8] c"one lakh nine thousand eight hundred seventy six\00"
@.str.3 = [48 x i8] c"two lakh ten thousand nine hundred eighty seven\00"
@.str.4 = [44 x i8] c"three lakh twenty one thousand ninety eight\00"
@.str.5 = [47 x i8] c"four lakh thirty two thousand one hundred nine\00"
@.str.6 = [47 x i8] c"five lakh forty three thousand two hundred ten\00"
@.str.7 = [54 x i8] c"six lakh fifty four thousand three hundred twenty one\00"
@.str.8 = [55 x i8] c"seven lakh sixty five thousand four hundred thirty two\00"
@.str.9 = [57 x i8] c"eight lakh seventy six thousand five hundred forty three\00"
@.str.10 = [55 x i8] c"nine lakh eighty seven thousand six hundred fifty four\00"
@.str.11 = [56 x i8] c"nine lakh ninety nine thousand nine hundred ninety nine\00"
define void @test6DigitNumbers() {
%1 = call i32 @getNumberInWords(i32 100000)
%2 = call i32 @assertEquals(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 @getNumberInWords(i32 100001)
%4 = call i32 @assertEquals(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = call i32 @getNumberInWords(i32 109876)
%6 = call i32 @assertEquals(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = call i32 @getNumberInWords(i32 210987)
%8 = call i32 @assertEquals(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = call i32 @getNumberInWords(i32 321098)
%10 = call i32 @assertEquals(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = call i32 @getNumberInWords(i32 432109)
%12 = call i32 @assertEquals(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = call i32 @getNumberInWords(i32 543210)
%14 = call i32 @assertEquals(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = call i32 @getNumberInWords(i32 654321)
%16 = call i32 @assertEquals(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32 %15)
%17 = call i32 @getNumberInWords(i32 765432)
%18 = call i32 @assertEquals(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0), i32 %17)
%19 = call i32 @getNumberInWords(i32 876543)
%20 = call i32 @assertEquals(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), i32 %19)
%21 = call i32 @getNumberInWords(i32 987654)
%22 = call i32 @assertEquals(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0), i32 %21)
%23 = call i32 @getNumberInWords(i32 999999)
%24 = call i32 @assertEquals(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0), i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"one lakh\00"
@.str.1 = [13 x i8] c"one lakh one\00"
@.str.2 = [49 x i8] c"one lakh nine thousand eight hundred seventy six\00"
@.str.3 = [48 x i8] c"two lakh ten thousand nine hundred eighty seven\00"
@.str.4 = [44 x i8] c"three lakh twenty one thousand ninety eight\00"
@.str.5 = [47 x i8] c"four lakh thirty two thousand one hundred nine\00"
@.str.6 = [47 x i8] c"five lakh forty three thousand two hundred ten\00"
@.str.7 = [54 x i8] c"six lakh fifty four thousand three hundred twenty one\00"
@.str.8 = [55 x i8] c"seven lakh sixty five thousand four hundred thirty two\00"
@.str.9 = [57 x i8] c"eight lakh seventy six thousand five hundred forty three\00"
@.str.10 = [55 x i8] c"nine lakh eighty seven thousand six hundred fifty four\00"
@.str.11 = [56 x i8] c"nine lakh ninety nine thousand nine hundred ninety nine\00"
define void @test6DigitNumbers() {
%1 = tail call i32 @getNumberInWords(i32 100000)
%2 = tail call i32 @assertEquals(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @getNumberInWords(i32 100001)
%4 = tail call i32 @assertEquals(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @getNumberInWords(i32 109876)
%6 = tail call i32 @assertEquals(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %5)
%7 = tail call i32 @getNumberInWords(i32 210987)
%8 = tail call i32 @assertEquals(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%9 = tail call i32 @getNumberInWords(i32 321098)
%10 = tail call i32 @assertEquals(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0), i32 %9)
%11 = tail call i32 @getNumberInWords(i32 432109)
%12 = tail call i32 @assertEquals(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i32 %11)
%13 = tail call i32 @getNumberInWords(i32 543210)
%14 = tail call i32 @assertEquals(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i32 %13)
%15 = tail call i32 @getNumberInWords(i32 654321)
%16 = tail call i32 @assertEquals(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32 %15)
%17 = tail call i32 @getNumberInWords(i32 765432)
%18 = tail call i32 @assertEquals(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.8, i64 0, i64 0), i32 %17)
%19 = tail call i32 @getNumberInWords(i32 876543)
%20 = tail call i32 @assertEquals(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.9, i64 0, i64 0), i32 %19)
%21 = tail call i32 @getNumberInWords(i32 987654)
%22 = tail call i32 @assertEquals(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.10, i64 0, i64 0), i32 %21)
%23 = tail call i32 @getNumberInWords(i32 999999)
%24 = tail call i32 @assertEquals(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.11, i64 0, i64 0), i32 %23)
ret void
}