#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 */
char getchar();
int pass_the_meme(char);
int /*<<< orphan*/ printf(char *, int, int, int);
void hexi_rgb() {
  int r, g, b, i, temp1, temp2;
  char hexvalue[8];
  for (i = 0; i < 8; i++) {
    hexvalue[i] = getchar();
  }
  for (i = 1; i < 3; i++) {
    temp1 = pass_the_meme(hexvalue[i]);
    temp2 = pass_the_meme(hexvalue[i + 1]);
  }
  r = temp1 * 16 + temp2 * 1;
  for (i = 3; i < 5; i++) {
    temp1 = pass_the_meme(hexvalue[i]);
    temp2 = pass_the_meme(hexvalue[i + 1]);
  }
  g = temp1 * 16 + temp2 * 1;
  temp1 = pass_the_meme(hexvalue[6]);
  temp2 = pass_the_meme(hexvalue[7]);
  b = temp1 * 16 + temp2 * 1;
  printf("rgb(%d, %d, %d)", r, g, b);
}


x86 assembly (clang, -O0):
<hexi_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x10(%rbp)
cmpl   $0x8,-0x10(%rbp)
jge    1168 <hexi_rgb+0x38>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113f <hexi_rgb+0xf>
movl   $0x1,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    11ad <hexi_rgb+0x7d>
movslq -0x10(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%edi
call   1040 <pass_the_meme@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x20(%rbp,%rax,1),%edi
call   1040 <pass_the_meme@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116f <hexi_rgb+0x3f>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    -0x18(%rbp),%ecx
shl    $0x0,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
movl   $0x3,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1203 <hexi_rgb+0xd3>
movslq -0x10(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%edi
call   1040 <pass_the_meme@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x20(%rbp,%rax,1),%edi
call   1040 <pass_the_meme@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c5 <hexi_rgb+0x95>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    -0x18(%rbp),%ecx
shl    $0x0,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
movsbl -0x1a(%rbp),%edi
call   1040 <pass_the_meme@plt>
mov    %eax,-0x14(%rbp)
movsbl -0x19(%rbp),%edi
call   1040 <pass_the_meme@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
mov    -0x18(%rbp),%ecx
shl    $0x0,%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xdb3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexi_rgb>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x6(%rsp)
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %al,0x7(%rsp)
movsbl %bl,%edi
call   1040 <pass_the_meme@plt>
movsbl %bpl,%ebx
mov    %ebx,%edi
call   1040 <pass_the_meme@plt>
mov    %ebx,%edi
call   1040 <pass_the_meme@plt>
mov    %eax,%r15d
movsbl %r14b,%ebx
mov    %ebx,%edi
call   1040 <pass_the_meme@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1040 <pass_the_meme@plt>
movsbl %r13b,%ebx
mov    %ebx,%edi
call   1040 <pass_the_meme@plt>
mov    %ebx,%edi
call   1040 <pass_the_meme@plt>
mov    %eax,%ebx
movsbl %r12b,%edi
call   1040 <pass_the_meme@plt>
shl    $0x4,%r15d
add    %r14d,%r15d
shl    $0x4,%ebx
add    %eax,%ebx
movsbl 0x6(%rsp),%edi
call   1040 <pass_the_meme@plt>
mov    %eax,%ebp
movsbl 0x7(%rsp),%edi
call   1040 <pass_the_meme@plt>
shl    $0x4,%ebp
add    %eax,%ebp
lea    0xdfb(%rip),%rdi
mov    %r15d,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"rgb(%d, %d, %d)\00"
define void @hexi_rgb() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [8 x i8]
store i32 0, i32* %4
br label %8
8: ; preds = %16, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 8
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = call signext i8 (...) @getchar()
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %14
store i8 %12, i8* %15
br label %16
16: ; preds = %11
%17 = load i32, i32* %4
%18 = add nsw i32 %17, 1
store i32 %18, i32* %4
br label %8
19: ; preds = %8
store i32 1, i32* %4
br label %20
20: ; preds = %35, %19
%21 = load i32, i32* %4
%22 = icmp slt i32 %21, 3
br i1 %22, label %23, label %38
23: ; preds = %20
%24 = load i32, i32* %4
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = call i32 @pass_the_meme(i8 signext %27)
store i32 %28, i32* %5
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = call i32 @pass_the_meme(i8 signext %33)
store i32 %34, i32* %6
br label %35
35: ; preds = %23
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %20
38: ; preds = %20
%39 = load i32, i32* %5
%40 = mul nsw i32 %39, 16
%41 = load i32, i32* %6
%42 = mul nsw i32 %41, 1
%43 = add nsw i32 %40, %42
store i32 %43, i32* %1
store i32 3, i32* %4
br label %44
44: ; preds = %59, %38
%45 = load i32, i32* %4
%46 = icmp slt i32 %45, 5
br i1 %46, label %47, label %62
47: ; preds = %44
%48 = load i32, i32* %4
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = call i32 @pass_the_meme(i8 signext %51)
store i32 %52, i32* %5
%53 = load i32, i32* %4
%54 = add nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 %55
%57 = load i8, i8* %56
%58 = call i32 @pass_the_meme(i8 signext %57)
store i32 %58, i32* %6
br label %59
59: ; preds = %47
%60 = load i32, i32* %4
%61 = add nsw i32 %60, 1
store i32 %61, i32* %4
br label %44
62: ; preds = %44
%63 = load i32, i32* %5
%64 = mul nsw i32 %63, 16
%65 = load i32, i32* %6
%66 = mul nsw i32 %65, 1
%67 = add nsw i32 %64, %66
store i32 %67, i32* %2
%68 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 6
%69 = load i8, i8* %68
%70 = call i32 @pass_the_meme(i8 signext %69)
store i32 %70, i32* %5
%71 = getelementptr inbounds [8 x i8], [8 x i8]* %7, i64 0, i64 7
%72 = load i8, i8* %71
%73 = call i32 @pass_the_meme(i8 signext %72)
store i32 %73, i32* %6
%74 = load i32, i32* %5
%75 = mul nsw i32 %74, 16
%76 = load i32, i32* %6
%77 = mul nsw i32 %76, 1
%78 = add nsw i32 %75, %77
store i32 %78, i32* %3
%79 = load i32, i32* %1
%80 = load i32, i32* %2
%81 = load i32, i32* %3
%82 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %79, i32 %80, i32 %81)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"rgb(%d, %d, %d)\00"
define void @hexi_rgb() {
%1 = tail call signext i8 (...) @getchar()
%2 = tail call signext i8 (...) @getchar()
%3 = tail call signext i8 (...) @getchar()
%4 = tail call signext i8 (...) @getchar()
%5 = tail call signext i8 (...) @getchar()
%6 = tail call signext i8 (...) @getchar()
%7 = tail call signext i8 (...) @getchar()
%8 = tail call signext i8 (...) @getchar()
%9 = tail call i32 @pass_the_meme(i8 signext %2)
%10 = tail call i32 @pass_the_meme(i8 signext %3)
%11 = tail call i32 @pass_the_meme(i8 signext %3)
%12 = tail call i32 @pass_the_meme(i8 signext %4)
%13 = tail call i32 @pass_the_meme(i8 signext %4)
%14 = tail call i32 @pass_the_meme(i8 signext %5)
%15 = tail call i32 @pass_the_meme(i8 signext %5)
%16 = tail call i32 @pass_the_meme(i8 signext %6)
%17 = shl nsw i32 %11, 4
%18 = add nsw i32 %17, %12
%19 = shl nsw i32 %15, 4
%20 = add nsw i32 %19, %16
%21 = tail call i32 @pass_the_meme(i8 signext %7)
%22 = tail call i32 @pass_the_meme(i8 signext %8)
%23 = shl nsw i32 %21, 4
%24 = add nsw i32 %22, %23
%25 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %18, i32 %20, i32 %24)
ret void
}