#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*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int hexvalue;
  int Rhex;
  int Ghex;
  int Bhex;
  int score;
  char *holder;
  char ch;
  int r, g, b;
  int counter;
  scanf("%c", &ch);
  if (ch == 'h') {
    scanf("%x", &hexvalue);
    while (hexvalue > 1) {
      printf("%d\n", hexvalue % 100);
      hexvalue /= 100;
    }
  }
  if (ch == 'd') {
    scanf("%d,%d,%d", &r, &g, &b);
    printf("#%x%x%x\n", r, g, b);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x21(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x21(%rbp),%eax
cmp    $0x68,%eax
jne    119d <main+0x7d>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jle    1198 <main+0x78>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1160 <main+0x40>
jmp    119d <main+0x7d>
movsbl -0x21(%rbp),%eax
cmp    $0x64,%eax
jne    11db <main+0xbb>
lea    0xe59(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x30(%rbp),%ecx
lea    0xe3f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xed4(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xf(%rsp),%al
cmp    $0x68,%al
jne    11b5 <main+0x95>
lea    0xebc(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%esi
cmp    $0x2,%esi
jl     11b1 <main+0x91>
lea    0xea3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %esi,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
imul   $0x64,%eax,%eax
sub    %eax,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movslq 0x10(%rsp),%rax
imul   $0x51eb851f,%rax,%rsi
mov    %rsi,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rsi
add    %ecx,%esi
mov    %esi,0x10(%rsp)
cmp    $0xc7,%rax
jg     1170 <main+0x50>
mov    0xf(%rsp),%al
cmp    $0x64,%al
jne    11f0 <main+0xd0>
lea    0xe4a(%rip),%rdi
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x1c(%rsp),%esi
mov    0x18(%rsp),%edx
mov    0x14(%rsp),%ecx
lea    0xe2a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@.str.1 = [3 x i8] c"%x\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [9 x i8] c"%d,%d,%d\00"
@.str.4 = [9 x i8] c"#%x%x%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%11 = load i8, i8* %2
%12 = icmp eq i8 %11, 104
br i1 %12, label %13, label %26
13: ; preds = %0
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = icmp sgt i32 %15, 1
br i1 %16, label %17, label %24
17: ; preds = %13, %17
%18 = phi i32 [ %22, %17 ], [ %15, %13 ]
%19 = urem i32 %18, 100
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %19)
%21 = load i32, i32* %1
%22 = sdiv i32 %21, 100
store i32 %22, i32* %1
%23 = icmp sgt i32 %21, 199
br i1 %23, label %17, label %24
24: ; preds = %17, %13
%25 = load i8, i8* %2
br label %26
26: ; preds = %24, %0
%27 = phi i8 [ %25, %24 ], [ %11, %0 ]
%28 = icmp eq i8 %27, 100
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = load i32, i32* %5
%34 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %32, i32 %33)
br label %35
35: ; preds = %29, %26
ret i32 0
}