#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*/ getchar();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int /*<<< orphan*/ written_amount(unsigned int, char *);
int main(void) {
  unsigned int numar;
  char buffer[100];
  puts("\n\tINTEGERS TO WORRRDS\n");
  printf("Enter the number which you want to be transformed:\n\t");
  scanf("%u", &numar);
  puts("Now press enter to see the magic!");
  getchar();
  getchar();
  written_amount(numar, buffer);
  puts(buffer);
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
lea    0xe95(%rip),%rdi
call   1050 <printf@plt>
lea    0xebe(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1080 <scanf@plt>
lea    0xeb1(%rip),%rdi
call   1040 <puts@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0x8(%rbp),%edi
lea    -0x70(%rbp),%rsi
call   1070 <written_amount@plt>
lea    -0x70(%rbp),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
lea    0xe91(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9c(%rip),%rdi
call   1050 <printf@plt>
lea    0xec5(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1080 <scanf@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0xc(%rsp),%edi
lea    0x10(%rsp),%rbx
mov    %rbx,%rsi
call   1070 <written_amount@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\09INTEGERS TO WORRRDS\0A\00"
@.str.1 = [53 x i8] c"Enter the number which you want to be transformed:\0A\09\00"
@.str.2 = [3 x i8] c"%u\00"
@.str.3 = [34 x i8] c"Now press enter to see the magic!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i8]
store i32 0, i32* %1
%4 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%7 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%8 = call i32 (...) @getchar()
%9 = call i32 (...) @getchar()
%10 = load i32, i32* %2
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%12 = call i32 @written_amount(i32 %10, i8* %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%14 = call i32 @puts(i8* %13)
%15 = call i32 @putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0A\09INTEGERS TO WORRRDS\0A\00"
@.str.1 = [53 x i8] c"Enter the number which you want to be transformed:\0A\09\00"
@.str.2 = [3 x i8] c"%u\00"
@.str.3 = [34 x i8] c"Now press enter to see the magic!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (...) @getchar()
%10 = call i32 (...) @getchar()
%11 = load i32, i32* %1
%12 = call i32 @written_amount(i32 %11, i8* %4)
%13 = call i32 @puts(i8* %4)
%14 = call i32 @putchar(i8 signext 10)
ret i32 0
}