#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 atoi(char *);
int /*<<< orphan*/ printf(char *, int, int, int);
int /*<<< orphan*/ scanf(char *, char *);
void dec_to_hex() {
  int i = 0;
  int a, b, c;
  char first[20];
  char second[20];
  char third[20];
  scanf("%s", first);
  scanf("%s", second);
  scanf("%s", third);
  for (; i < 4; i++) {
    if (first[i] == ',') {
      first[i] = '\0';
    }
    if (second[i] == ',') {
      second[i] = '\0';
    }
    if (third[i] == ',') {
      third[i] = '\0';
    }
  }
  a = atoi(first);
  b = atoi(second);
  c = atoi(third);
  printf("#%x%x%x", a, b, c);
}


x86 assembly (clang, -O0):
<dec_to_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x50(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x4,-0x4(%rbp)
jge    11dd <dec_to_hex+0xad>
movslq -0x4(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x2c,%eax
jne    1194 <dec_to_hex+0x64>
movslq -0x4(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
movslq -0x4(%rbp),%rax
movsbl -0x50(%rbp,%rax,1),%eax
cmp    $0x2c,%eax
jne    11af <dec_to_hex+0x7f>
movslq -0x4(%rbp),%rax
movb   $0x0,-0x50(%rbp,%rax,1)
movslq -0x4(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x2c,%eax
jne    11ca <dec_to_hex+0x9a>
movslq -0x4(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
jmp    11cf <dec_to_hex+0x9f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    116f <dec_to_hex+0x3f>
lea    -0x30(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x8(%rbp)
lea    -0x50(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
lea    -0x70(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec_to_hex>:
push   %rbp
push   %rbx
sub    $0x58,%rsp
lea    0xec3(%rip),%rbx
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
cmpb   $0x2c,0x40(%rsp)
je     121f <dec_to_hex+0xef>
cmpb   $0x2c,0x20(%rsp)
je     122f <dec_to_hex+0xff>
cmpb   $0x2c,(%rsp)
je     123e <dec_to_hex+0x10e>
cmpb   $0x2c,0x41(%rsp)
je     124d <dec_to_hex+0x11d>
cmpb   $0x2c,0x21(%rsp)
je     125d <dec_to_hex+0x12d>
cmpb   $0x2c,0x1(%rsp)
je     126d <dec_to_hex+0x13d>
cmpb   $0x2c,0x42(%rsp)
je     127d <dec_to_hex+0x14d>
cmpb   $0x2c,0x22(%rsp)
je     128d <dec_to_hex+0x15d>
cmpb   $0x2c,0x2(%rsp)
je     129d <dec_to_hex+0x16d>
cmpb   $0x2c,0x43(%rsp)
je     12ad <dec_to_hex+0x17d>
cmpb   $0x2c,0x23(%rsp)
je     12bd <dec_to_hex+0x18d>
cmpb   $0x2c,0x3(%rsp)
jne    11e6 <dec_to_hex+0xb6>
movb   $0x0,0x3(%rsp)
lea    0x40(%rsp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
lea    0x20(%rsp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    %rsp,%rdi
call   1050 <atoi@plt>
lea    0xdf6(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
add    $0x58,%rsp
pop    %rbx
pop    %rbp
ret
movb   $0x0,0x40(%rsp)
cmpb   $0x2c,0x20(%rsp)
jne    1178 <dec_to_hex+0x48>
movb   $0x0,0x20(%rsp)
cmpb   $0x2c,(%rsp)
jne    1182 <dec_to_hex+0x52>
movb   $0x0,(%rsp)
cmpb   $0x2c,0x41(%rsp)
jne    118d <dec_to_hex+0x5d>
movb   $0x0,0x41(%rsp)
cmpb   $0x2c,0x21(%rsp)
jne    1198 <dec_to_hex+0x68>
movb   $0x0,0x21(%rsp)
cmpb   $0x2c,0x1(%rsp)
jne    11a3 <dec_to_hex+0x73>
movb   $0x0,0x1(%rsp)
cmpb   $0x2c,0x42(%rsp)
jne    11ae <dec_to_hex+0x7e>
movb   $0x0,0x42(%rsp)
cmpb   $0x2c,0x22(%rsp)
jne    11b9 <dec_to_hex+0x89>
movb   $0x0,0x22(%rsp)
cmpb   $0x2c,0x2(%rsp)
jne    11c4 <dec_to_hex+0x94>
movb   $0x0,0x2(%rsp)
cmpb   $0x2c,0x43(%rsp)
jne    11cf <dec_to_hex+0x9f>
movb   $0x0,0x43(%rsp)
cmpb   $0x2c,0x23(%rsp)
jne    11da <dec_to_hex+0xaa>
movb   $0x0,0x23(%rsp)
cmpb   $0x2c,0x3(%rsp)
je     11e1 <dec_to_hex+0xb1>
jmp    11e6 <dec_to_hex+0xb6>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [8 x i8] c"#%x%x%x\00"
define void @dec_to_hex() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = alloca [20 x i8]
store i32 0, i32* %1
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %51, %0
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 4
br i1 %16, label %17, label %54
17: ; preds = %14
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 44
br i1 %23, label %24, label %28
24: ; preds = %17
%25 = load i32, i32* %1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 %26
store i8 0, i8* %27
br label %28
28: ; preds = %24, %17
%29 = load i32, i32* %1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 44
br i1 %34, label %35, label %39
35: ; preds = %28
%36 = load i32, i32* %1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 %37
store i8 0, i8* %38
br label %39
39: ; preds = %35, %28
%40 = load i32, i32* %1
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %41
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 44
br i1 %45, label %46, label %50
46: ; preds = %39
%47 = load i32, i32* %1
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 %48
store i8 0, i8* %49
br label %50
50: ; preds = %46, %39
br label %51
51: ; preds = %50
%52 = load i32, i32* %1
%53 = add nsw i32 %52, 1
store i32 %53, i32* %1
br label %14
54: ; preds = %14
%55 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%56 = call i32 @atoi(i8* %55)
store i32 %56, i32* %2
%57 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%58 = call i32 @atoi(i8* %57)
store i32 %58, i32* %3
%59 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%60 = call i32 @atoi(i8* %59)
store i32 %60, i32* %4
%61 = load i32, i32* %2
%62 = load i32, i32* %3
%63 = load i32, i32* %4
%64 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %61, i32 %62, i32 %63)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [8 x i8] c"#%x%x%x\00"
define void @dec_to_hex() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %6)
%10 = load i8, i8* %4
%11 = icmp eq i8 %10, 44
br i1 %11, label %12, label %13
12: ; preds = %0
store i8 0, i8* %4
br label %13
13: ; preds = %12, %0
%14 = load i8, i8* %5
%15 = icmp eq i8 %14, 44
br i1 %15, label %16, label %17
16: ; preds = %13
store i8 0, i8* %5
br label %17
17: ; preds = %16, %13
%18 = load i8, i8* %6
%19 = icmp eq i8 %18, 44
br i1 %19, label %20, label %21
20: ; preds = %17
store i8 0, i8* %6
br label %21
21: ; preds = %17, %20
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 1
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 44
br i1 %24, label %25, label %26
25: ; preds = %21
store i8 0, i8* %22
br label %26
26: ; preds = %25, %21
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 1
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 44
br i1 %29, label %30, label %31
30: ; preds = %26
store i8 0, i8* %27
br label %31
31: ; preds = %30, %26
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 1
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 44
br i1 %34, label %35, label %36
35: ; preds = %31
store i8 0, i8* %32
br label %36
36: ; preds = %35, %31
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 2
%38 = load i8, i8* %37
%39 = icmp eq i8 %38, 44
br i1 %39, label %40, label %41
40: ; preds = %36
store i8 0, i8* %37
br label %41
41: ; preds = %40, %36
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 2
%43 = load i8, i8* %42
%44 = icmp eq i8 %43, 44
br i1 %44, label %45, label %46
45: ; preds = %41
store i8 0, i8* %42
br label %46
46: ; preds = %45, %41
%47 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 2
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 44
br i1 %49, label %50, label %51
50: ; preds = %46
store i8 0, i8* %47
br label %51
51: ; preds = %50, %46
%52 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 3
%53 = load i8, i8* %52
%54 = icmp eq i8 %53, 44
br i1 %54, label %55, label %56
55: ; preds = %51
store i8 0, i8* %52
br label %56
56: ; preds = %55, %51
%57 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 3
%58 = load i8, i8* %57
%59 = icmp eq i8 %58, 44
br i1 %59, label %60, label %61
60: ; preds = %56
store i8 0, i8* %57
br label %61
61: ; preds = %60, %56
%62 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 3
%63 = load i8, i8* %62
%64 = icmp eq i8 %63, 44
br i1 %64, label %65, label %66
65: ; preds = %61
store i8 0, i8* %62
br label %66
66: ; preds = %65, %61
%67 = call i32 @atoi(i8* %4)
%68 = call i32 @atoi(i8* %5)
%69 = call i32 @atoi(i8* %6)
%70 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %67, i32 %68, i32 %69)
ret void
}