#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*/ h(char *, int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *, int *, int *);
void dec() {
  int r = 0, g = 0, b = 0;
  char heci[8];
  scanf("%d, %d, %d", &r, &g, &b);
  heci[0] = '#';
  heci[2] = r % 16;
  r /= 16;
  heci[1] = r % 16;
  heci[4] = g % 16;
  g /= 16;
  heci[3] = g % 16;
  heci[6] = b % 16;
  b /= 16;
  heci[5] = b % 16;
  heci[7] = '\0';
  h(heci, 8);
  puts(heci);
}


x86 assembly (clang, -O0):
<dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
call   1050 <scanf@plt>
movb   $0x23,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x12(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x13(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0x11(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0xe(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %dl,%al
mov    %al,-0xf(%rbp)
movb   $0x0,-0xd(%rbp)
lea    -0x14(%rbp),%rdi
mov    $0x8,%esi
call   1040 <h@plt>
lea    -0x14(%rbp),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec>:
push   %rbx
sub    $0x20,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xecc(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1050 <scanf@plt>
movb   $0x23,0x18(%rsp)
mov    0x14(%rsp),%eax
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x4,%ecx
mov    %ecx,0x14(%rsp)
mov    0x10(%rsp),%edx
lea    0xf(%rdx),%esi
test   %edx,%edx
cmovns %edx,%esi
sar    $0x4,%esi
mov    %esi,0x10(%rsp)
movd   %esi,%xmm0
movd   %edx,%xmm1
punpckldq %xmm1,%xmm0
movd   %ecx,%xmm1
movd   %eax,%xmm2
punpckldq %xmm2,%xmm1
punpcklqdq %xmm0,%xmm1
movdqa %xmm1,%xmm0
psrad  $0x1f,%xmm0
psrld  $0x1c,%xmm0
paddd  %xmm1,%xmm0
pand   0xe37(%rip),%xmm0
psubd  %xmm0,%xmm1
pand   0xe3b(%rip),%xmm1
packuswb %xmm1,%xmm1
packuswb %xmm1,%xmm1
movd   %xmm1,0x19(%rsp)
mov    0xc(%rsp),%eax
lea    0xf(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
mov    %ecx,%edx
and    $0xfffffff0,%edx
sub    %edx,%eax
mov    %al,0x1e(%rsp)
sar    $0x4,%ecx
mov    %ecx,0xc(%rsp)
lea    0xf(%rcx),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
and    $0xf0,%eax
sub    %eax,%ecx
mov    %cl,0x1d(%rsp)
movb   $0x0,0x1f(%rsp)
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x8,%esi
call   1040 <h@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%d, %d, %d\00"
define void @dec() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [8 x i8]
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%5 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%6 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
store i8 35, i8* %6
%7 = load i32, i32* %1
%8 = srem i32 %7, 16
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 2
store i8 %9, i8* %10
%11 = load i32, i32* %1
%12 = sdiv i32 %11, 16
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = srem i32 %13, 16
%15 = trunc i32 %14 to i8
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 1
store i8 %15, i8* %16
%17 = load i32, i32* %2
%18 = srem i32 %17, 16
%19 = trunc i32 %18 to i8
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 4
store i8 %19, i8* %20
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 16
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = srem i32 %23, 16
%25 = trunc i32 %24 to i8
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 3
store i8 %25, i8* %26
%27 = load i32, i32* %3
%28 = srem i32 %27, 16
%29 = trunc i32 %28 to i8
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 6
store i8 %29, i8* %30
%31 = load i32, i32* %3
%32 = sdiv i32 %31, 16
store i32 %32, i32* %3
%33 = load i32, i32* %3
%34 = srem i32 %33, 16
%35 = trunc i32 %34 to i8
%36 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 5
store i8 %35, i8* %36
%37 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 7
store i8 0, i8* %37
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%39 = call i32 @h(i8* %38, i32 8)
%40 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%41 = call i32 @puts(i8* %40)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%d, %d, %d\00"
define void @dec() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [8 x i8]
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
store i8 35, i8* %8
%10 = load i32, i32* %1
%11 = sdiv i32 %10, 16
store i32 %11, i32* %1
%12 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 1
%13 = load i32, i32* %2
%14 = sdiv i32 %13, 16
store i32 %14, i32* %2
%15 = insertelement <4 x i32> poison, i32 %11, i64 0
%16 = insertelement <4 x i32> %15, i32 %10, i64 1
%17 = insertelement <4 x i32> %16, i32 %14, i64 2
%18 = insertelement <4 x i32> %17, i32 %13, i64 3
%19 = srem <4 x i32> %18, <i32 16, i32 16, i32 16, i32 16>
%20 = trunc <4 x i32> %19 to <4 x i8>
%21 = bitcast i8* %12 to <4 x i8>*
store <4 x i8> %20, <4 x i8>* %21
%22 = load i32, i32* %3
%23 = srem i32 %22, 16
%24 = trunc i32 %23 to i8
%25 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 6
store i8 %24, i8* %25
%26 = sdiv i32 %22, 16
store i32 %26, i32* %3
%27 = srem i32 %26, 16
%28 = trunc i32 %27 to i8
%29 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 5
store i8 %28, i8* %29
%30 = getelementptr inbounds [8 x i8], [8 x i8]* %4, i64 0, i64 7
store i8 0, i8* %30
%31 = call i32 @h(i8* %8, i32 8)
%32 = call i32 @puts(i8* %8)
ret void
}