#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*/ binString(unsigned short);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ scanf(char *, unsigned short *);
void main_1(void) {
  unsigned short int value;
  int x;
  printf("Enter an integer value, 0 to 65,535 %c ", 16);
  scanf("%d", &value);
  printf("\nDecimal    Hexadecimal   Binary\n");
  for (x = 0; x < 40; x++)
    putchar('*');
  printf("\n%7d\t", value);
  printf("   0x%09X\t", value);
  binString(value);
  putchar('n');
}


x86 assembly (clang, -O0):
<main_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x10,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x2(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x28,-0x8(%rbp)
jge    11a2 <main_1+0x62>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1180 <main_1+0x40>
movzwl -0x2(%rbp),%esi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movzwl -0x2(%rbp),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movzwl -0x2(%rbp),%edi
call   1050 <binString@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_1>:
push   %rax
lea    0xea8(%rip),%rdi
mov    $0x10,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xebd(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1070 <scanf@plt>
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    $0x2a,%edi
call   1030 <putchar@plt>
movzwl 0x6(%rsp),%esi
lea    0xd0e(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzwl 0x6(%rsp),%esi
lea    0xd01(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movzwl 0x6(%rsp),%edi
call   1060 <binString@plt>
mov    $0x6e,%edi
call   1030 <putchar@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Enter an integer value, 0 to 65,535 %c \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"\0ADecimal Hexadecimal Binary\0A\00"
@.str.3 = [6 x i8] c"\0A%7d\09\00"
@.str.4 = [11 x i8] c" 0x%09X\09\00"
define void @main_1() {
%1 = alloca i16
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 16)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i16* %1)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %6
6: ; preds = %11, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 40
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = call i32 @putchar(i8 signext 42)
br label %11
11: ; preds = %9
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %6
14: ; preds = %6
%15 = load i16, i16* %1
%16 = zext i16 %15 to i32
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%18 = load i16, i16* %1
%19 = zext i16 %18 to i32
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %19)
%21 = load i16, i16* %1
%22 = call i32 @binString(i16 zeroext %21)
%23 = call i32 @putchar(i8 signext 110)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Enter an integer value, 0 to 65,535 %c \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [6 x i8] c"\0A%7d\09\00"
@.str.4 = [11 x i8] c" 0x%09X\09\00"
@str = [33 x i8] c"\0ADecimal Hexadecimal Binary\00"
define void @main_1() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 16)
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i16* %1)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%6 = call i32 @putchar(i8 signext 42)
%7 = call i32 @putchar(i8 signext 42)
%8 = call i32 @putchar(i8 signext 42)
%9 = call i32 @putchar(i8 signext 42)
%10 = call i32 @putchar(i8 signext 42)
%11 = call i32 @putchar(i8 signext 42)
%12 = call i32 @putchar(i8 signext 42)
%13 = call i32 @putchar(i8 signext 42)
%14 = call i32 @putchar(i8 signext 42)
%15 = call i32 @putchar(i8 signext 42)
%16 = call i32 @putchar(i8 signext 42)
%17 = call i32 @putchar(i8 signext 42)
%18 = call i32 @putchar(i8 signext 42)
%19 = call i32 @putchar(i8 signext 42)
%20 = call i32 @putchar(i8 signext 42)
%21 = call i32 @putchar(i8 signext 42)
%22 = call i32 @putchar(i8 signext 42)
%23 = call i32 @putchar(i8 signext 42)
%24 = call i32 @putchar(i8 signext 42)
%25 = call i32 @putchar(i8 signext 42)
%26 = call i32 @putchar(i8 signext 42)
%27 = call i32 @putchar(i8 signext 42)
%28 = call i32 @putchar(i8 signext 42)
%29 = call i32 @putchar(i8 signext 42)
%30 = call i32 @putchar(i8 signext 42)
%31 = call i32 @putchar(i8 signext 42)
%32 = call i32 @putchar(i8 signext 42)
%33 = call i32 @putchar(i8 signext 42)
%34 = call i32 @putchar(i8 signext 42)
%35 = call i32 @putchar(i8 signext 42)
%36 = call i32 @putchar(i8 signext 42)
%37 = call i32 @putchar(i8 signext 42)
%38 = call i32 @putchar(i8 signext 42)
%39 = call i32 @putchar(i8 signext 42)
%40 = call i32 @putchar(i8 signext 42)
%41 = call i32 @putchar(i8 signext 42)
%42 = call i32 @putchar(i8 signext 42)
%43 = call i32 @putchar(i8 signext 42)
%44 = call i32 @putchar(i8 signext 42)
%45 = call i32 @putchar(i8 signext 42)
%46 = load i16, i16* %1
%47 = zext i16 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %47)
%49 = load i16, i16* %1
%50 = zext i16 %49 to i32
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %50)
%52 = load i16, i16* %1
%53 = call i32 @binString(i16 zeroext %52)
%54 = call i32 @putchar(i8 signext 110)
ret void
}