#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*/ print_heximal(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
void decimal_to_heximal() {
  int a, b, c;
  do {
    scanf("%d, %d, %d", &a, &b, &c);
  } while (a < 0 || a > 255 || b < 0 || b > 255 || c < 0 || c > 255);
  printf("#");
  print_heximal(a / 16);
  print_heximal(a % 16);
  print_heximal(b / 16);
  print_heximal(b % 16);
  print_heximal(c / 16);
  print_heximal(c % 16);
}


x86 assembly (clang, -O0):
<decimal_to_heximal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0xd(%rbp)
jl     11ae <decimal_to_heximal+0x7e>
mov    $0x1,%al
cmpl   $0xff,-0x4(%rbp)
mov    %al,-0xd(%rbp)
jg     11ae <decimal_to_heximal+0x7e>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jl     11ae <decimal_to_heximal+0x7e>
mov    $0x1,%al
cmpl   $0xff,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jg     11ae <decimal_to_heximal+0x7e>
mov    $0x1,%al
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jl     11ae <decimal_to_heximal+0x7e>
cmpl   $0xff,-0xc(%rbp)
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1138 <decimal_to_heximal+0x8>
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <print_heximal@plt>
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <print_heximal@plt>
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <print_heximal@plt>
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <print_heximal@plt>
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1040 <print_heximal@plt>
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1040 <print_heximal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimal_to_heximal>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebe(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
call   1050 <scanf@plt>
cmpl   $0xff,0x14(%rsp)
ja     1160 <decimal_to_heximal+0x30>
mov    0x10(%rsp),%eax
test   %eax,%eax
js     1160 <decimal_to_heximal+0x30>
cmp    $0xff,%eax
jg     1160 <decimal_to_heximal+0x30>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     1160 <decimal_to_heximal+0x30>
cmp    $0xff,%eax
jg     1160 <decimal_to_heximal+0x30>
mov    $0x23,%edi
call   1030 <putchar@plt>
mov    0x14(%rsp),%eax
lea    0xf(%rax),%edi
test   %eax,%eax
cmovns %eax,%edi
sar    $0x4,%edi
call   1040 <print_heximal@plt>
mov    0x14(%rsp),%edi
lea    0xf(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xfffffff0,%eax
sub    %eax,%edi
call   1040 <print_heximal@plt>
mov    0x10(%rsp),%eax
lea    0xf(%rax),%edi
test   %eax,%eax
cmovns %eax,%edi
sar    $0x4,%edi
call   1040 <print_heximal@plt>
mov    0x10(%rsp),%edi
lea    0xf(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xfffffff0,%eax
sub    %eax,%edi
call   1040 <print_heximal@plt>
mov    0xc(%rsp),%eax
lea    0xf(%rax),%edi
test   %eax,%eax
cmovns %eax,%edi
sar    $0x4,%edi
call   1040 <print_heximal@plt>
mov    0xc(%rsp),%edi
lea    0xf(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xfffffff0,%eax
sub    %eax,%edi
call   1040 <print_heximal@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%d, %d, %d\00"
@.str.1 = [2 x i8] c"#\00"
define void @decimal_to_heximal() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
br label %4
4: ; preds = %24, %0
%5 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
br label %6
6: ; preds = %4
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 0
br i1 %8, label %24, label %9
9: ; preds = %6
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, 255
br i1 %11, label %24, label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 255
br i1 %17, label %24, label %18
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp slt i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 255
br label %24
24: ; preds = %21, %18, %15, %12, %9, %6
%25 = phi i1 [ true, %18 ], [ true, %15 ], [ true, %12 ], [ true, %9 ], [ true, %6 ], [ %23, %21 ]
br i1 %25, label %4, label %26
26: ; preds = %24
%27 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%28 = load i32, i32* %1
%29 = sdiv i32 %28, 16
%30 = call i32 @print_heximal(i32 %29)
%31 = load i32, i32* %1
%32 = srem i32 %31, 16
%33 = call i32 @print_heximal(i32 %32)
%34 = load i32, i32* %2
%35 = sdiv i32 %34, 16
%36 = call i32 @print_heximal(i32 %35)
%37 = load i32, i32* %2
%38 = srem i32 %37, 16
%39 = call i32 @print_heximal(i32 %38)
%40 = load i32, i32* %3
%41 = sdiv i32 %40, 16
%42 = call i32 @print_heximal(i32 %41)
%43 = load i32, i32* %3
%44 = srem i32 %43, 16
%45 = call i32 @print_heximal(i32 %44)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%d, %d, %d\00"
define void @decimal_to_heximal() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
br label %7
7: ; preds = %7, %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %1
%10 = icmp ugt i32 %9, 255
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 0
%13 = select i1 %10, i1 true, i1 %12
%14 = icmp sgt i32 %11, 255
%15 = select i1 %13, i1 true, i1 %14
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 0
%18 = select i1 %15, i1 true, i1 %17
%19 = icmp sgt i32 %16, 255
%20 = select i1 %18, i1 true, i1 %19
br i1 %20, label %7, label %21
21: ; preds = %7
%22 = call i32 @putchar(i32 35)
%23 = load i32, i32* %1
%24 = sdiv i32 %23, 16
%25 = call i32 @print_heximal(i32 %24)
%26 = load i32, i32* %1
%27 = srem i32 %26, 16
%28 = call i32 @print_heximal(i32 %27)
%29 = load i32, i32* %2
%30 = sdiv i32 %29, 16
%31 = call i32 @print_heximal(i32 %30)
%32 = load i32, i32* %2
%33 = srem i32 %32, 16
%34 = call i32 @print_heximal(i32 %33)
%35 = load i32, i32* %3
%36 = sdiv i32 %35, 16
%37 = call i32 @print_heximal(i32 %36)
%38 = load i32, i32* %3
%39 = srem i32 %38, 16
%40 = call i32 @print_heximal(i32 %39)
ret void
}