#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 desc_digits(short);
int kaprekar(short);
int largest_digit(short, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, short, int);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  short num = (short)strtol(argv[1], NULL, 10);
  printf("largest_digit(%d) -> %d\n", num, largest_digit(num, NULL));
  printf("desc_digits(%d) -> %d\n", num, desc_digits(num));
  printf("kaprekar(%d) -> %d\n", num, kaprekar(num));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %ax,-0x12(%rbp)
mov    -0x12(%rbp),%ax
mov    %ax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%esi
movswl -0x12(%rbp),%edi
call   1060 <largest_digit@plt>
mov    %eax,%edx
mov    -0x18(%rbp),%ax
lea    0xe65(%rip),%rdi
movswl %ax,%esi
call   1030 <printf@plt>
mov    -0x12(%rbp),%ax
mov    %ax,-0x16(%rbp)
movswl -0x12(%rbp),%edi
call   1040 <desc_digits@plt>
mov    %eax,%edx
mov    -0x16(%rbp),%ax
lea    0xe58(%rip),%rdi
movswl %ax,%esi
call   1030 <printf@plt>
mov    -0x12(%rbp),%ax
mov    %ax,-0x14(%rbp)
movswl -0x12(%rbp),%edi
call   1070 <kaprekar@plt>
mov    %eax,%edx
mov    -0x14(%rbp),%ax
lea    0xe49(%rip),%rdi
movswl %ax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
movswl %ax,%ebx
mov    %ebx,%edi
xor    %esi,%esi
call   1060 <largest_digit@plt>
lea    0xe8c(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <desc_digits@plt>
lea    0xe8e(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %ebx,%edi
call   1070 <kaprekar@plt>
lea    0xe8e(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"largest_digit(%d) -> %d\0A\00"
@.str.1 = [23 x i8] c"desc_digits(%d) -> %d\0A\00"
@.str.2 = [20 x i8] c"kaprekar(%d) -> %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i16
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i64 @strtol(i8* %8, i32* null, i32 10)
%10 = trunc i64 %9 to i16
store i16 %10, i16* %5
%11 = load i16, i16* %5
%12 = load i16, i16* %5
%13 = call i32 @largest_digit(i16 signext %12, i32* null)
%14 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i16 signext %11, i32 %13)
%15 = load i16, i16* %5
%16 = load i16, i16* %5
%17 = call i32 @desc_digits(i16 signext %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i16 signext %15, i32 %17)
%19 = load i16, i16* %5
%20 = load i16, i16* %5
%21 = call i32 @kaprekar(i16 signext %20)
%22 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i16 signext %19, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"largest_digit(%d) -> %d\0A\00"
@.str.1 = [23 x i8] c"desc_digits(%d) -> %d\0A\00"
@.str.2 = [20 x i8] c"kaprekar(%d) -> %d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @strtol(i8* nocapture %4, i32* null, i32 10)
%6 = trunc i64 %5 to i16
%7 = tail call i32 @largest_digit(i16 signext %6, i32* null)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i16 signext %6, i32 %7)
%9 = tail call i32 @desc_digits(i16 signext %6)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i16 signext %6, i32 %9)
%11 = tail call i32 @kaprekar(i16 signext %6)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i16 signext %6, i32 %11)
ret i32 0
}