#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 atoi(char *);
char *convert_to_title(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  char *title;
  int n;
  if (argc != 2) {
    printf("invalid params.\n");
    return -1;
  }
  n = atoi(argv[1]);
  title = convert_to_title(n);
  if (title != NULL) {
    printf("%d --> %s\n", n, title);
    free(title);
  } else {
    printf("convert failed.\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     117a <main+0x3a>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11d9 <main+0x99>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
call   1050 <convert_to_title@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11c4 <main+0x84>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    11d2 <main+0x92>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jne    1192 <main+0x42>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1060 <convert_to_title@plt>
test   %rax,%rax
je     11a5 <main+0x55>
mov    %rax,%r14
lea    0xe86(%rip),%rdi
xor    %ebx,%ebx
mov    %ebp,%esi
mov    %rax,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
call   1030 <free@plt>
jmp    11b3 <main+0x63>
lea    0xe82(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%ebx
jmp    11b3 <main+0x63>
lea    0xe5f(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"invalid params.\0A\00"
@.str.1 = [11 x i8] c"%d --> %s\0A\00"
@.str.2 = [17 x i8] c"convert failed.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %30
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = call i8* @convert_to_title(i32 %17)
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %27
21: ; preds = %12
%22 = load i32, i32* %7
%23 = load i8*, i8** %6
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %22, i8* %23)
%25 = load i8*, i8** %6
%26 = call i32 @free(i8* %25)
br label %29
27: ; preds = %12
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %21
store i32 0, i32* %3
br label %30
30: ; preds = %29, %10
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str.1 = [11 x i8] c"%d --> %s\0A\00"
@str = [16 x i8] c"convert failed.\00"
@str.3 = [16 x i8] c"invalid params.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
br label %17
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = tail call i8* @convert_to_title(i32 %9)
%11 = icmp eq i8* %10, null
br i1 %11, label %15, label %12
12: ; preds = %6
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %9, i8* %10)
%14 = tail call i32 @free(i8* %10)
br label %17
15: ; preds = %6
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %17
17: ; preds = %12, %15, %4
%18 = phi i32 [ -1, %4 ], [ 0, %15 ], [ 0, %12 ]
ret i32 %18
}