#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 */
double decode_fraction(unsigned char const, int /*<<< orphan*/);
int /*<<< orphan*/ get_bits(unsigned char const, int, int);
int decode_color_characteristics(const unsigned char *edid, double *c) {
  c[0] = decode_fraction(edid[0x1b], get_bits(edid[0x19], 6, 7));
  c[1] = decode_fraction(edid[0x1c], get_bits(edid[0x19], 5, 4));
  c[2] = decode_fraction(edid[0x1d], get_bits(edid[0x19], 2, 3));
  c[3] = decode_fraction(edid[0x1e], get_bits(edid[0x19], 0, 1));
  c[4] = decode_fraction(edid[0x1f], get_bits(edid[0x1a], 6, 7));
  c[5] = decode_fraction(edid[0x20], get_bits(edid[0x1a], 4, 5));
  c[6] = decode_fraction(edid[0x21], get_bits(edid[0x1a], 2, 3));
  c[7] = decode_fraction(edid[0x22], get_bits(edid[0x1a], 0, 1));
  return 1;
}


x86 assembly (clang, -O0):
<decode_color_characteristics>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x1b(%rax),%al
mov    %al,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x6,%esi
mov    $0x7,%edx
movzbl 0x19(%rax),%edi
call   1030 <get_bits@plt>
mov    %eax,%esi
mov    -0x18(%rbp),%al
movzbl %al,%edi
call   1040 <decode_fraction@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%al
mov    %al,-0x17(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x5,%esi
mov    $0x4,%edx
movzbl 0x19(%rax),%edi
call   1030 <get_bits@plt>
mov    %eax,%esi
mov    -0x17(%rbp),%al
movzbl %al,%edi
call   1040 <decode_fraction@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    0x1d(%rax),%al
mov    %al,-0x16(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x2,%esi
mov    $0x3,%edx
movzbl 0x19(%rax),%edi
call   1030 <get_bits@plt>
mov    %eax,%esi
mov    -0x16(%rbp),%al
movzbl %al,%edi
call   1040 <decode_fraction@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
mov    0x1e(%rax),%al
mov    %al,-0x15(%rbp)
mov    -0x8(%rbp),%rax
xor    %esi,%esi
mov    $0x1,%edx
movzbl 0x19(%rax),%edi
call   1030 <get_bits@plt>
mov    %eax,%esi
mov    -0x15(%rbp),%al
movzbl %al,%edi
call   1040 <decode_fraction@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x18(%rax)
mov    -0x8(%rbp),%rax
mov    0x1f(%rax),%al
mov    %al,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x6,%esi
mov    $0x7,%edx
movzbl 0x1a(%rax),%edi
call   1030 <get_bits@plt>
mov    %eax,%esi
mov    -0x14(%rbp),%al
movzbl %al,%edi
call   1040 <decode_fraction@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x20(%rax)
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%al
mov    %al,-0x13(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x4,%esi
mov    $0x5,%edx
movzbl 0x1a(%rax),%edi
call   1030 <get_bits@plt>
mov    %eax,%esi
mov    -0x13(%rbp),%al
movzbl %al,%edi
call   1040 <decode_fraction@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x28(%rax)
mov    -0x8(%rbp),%rax
mov    0x21(%rax),%al
mov    %al,-0x12(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x2,%esi
mov    $0x3,%edx
movzbl 0x1a(%rax),%edi
call   1030 <get_bits@plt>
mov    %eax,%esi
mov    -0x12(%rbp),%al
movzbl %al,%edi
call   1040 <decode_fraction@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x30(%rax)
mov    -0x8(%rbp),%rax
mov    0x22(%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
xor    %esi,%esi
mov    $0x1,%edx
movzbl 0x1a(%rax),%edi
call   1030 <get_bits@plt>
mov    %eax,%esi
mov    -0x11(%rbp),%al
movzbl %al,%edi
call   1040 <decode_fraction@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x38(%rax)
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_color_characteristics>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
movzbl 0x1b(%rdi),%ebp
movzbl 0x19(%rdi),%edi
mov    $0x6,%esi
mov    $0x7,%edx
call   1030 <get_bits@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <decode_fraction@plt>
movsd  %xmm0,(%r14)
movzbl 0x1c(%rbx),%ebp
movzbl 0x19(%rbx),%edi
mov    $0x5,%esi
mov    $0x4,%edx
call   1030 <get_bits@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <decode_fraction@plt>
movsd  %xmm0,0x8(%r14)
movzbl 0x1d(%rbx),%ebp
movzbl 0x19(%rbx),%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <get_bits@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <decode_fraction@plt>
movsd  %xmm0,0x10(%r14)
movzbl 0x1e(%rbx),%ebp
movzbl 0x19(%rbx),%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <get_bits@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <decode_fraction@plt>
movsd  %xmm0,0x18(%r14)
movzbl 0x1f(%rbx),%ebp
movzbl 0x1a(%rbx),%edi
mov    $0x6,%esi
mov    $0x7,%edx
call   1030 <get_bits@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <decode_fraction@plt>
movsd  %xmm0,0x20(%r14)
movzbl 0x20(%rbx),%ebp
movzbl 0x1a(%rbx),%edi
mov    $0x4,%esi
mov    $0x5,%edx
call   1030 <get_bits@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <decode_fraction@plt>
movsd  %xmm0,0x28(%r14)
movzbl 0x21(%rbx),%ebp
movzbl 0x1a(%rbx),%edi
mov    $0x2,%esi
mov    $0x3,%edx
call   1030 <get_bits@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <decode_fraction@plt>
movsd  %xmm0,0x30(%r14)
movzbl 0x22(%rbx),%ebp
movzbl 0x1a(%rbx),%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <get_bits@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1040 <decode_fraction@plt>
movsd  %xmm0,0x38(%r14)
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @decode_color_characteristics(i8* %0, double* %1) {
%3 = alloca i8*
%4 = alloca double*
store i8* %0, i8** %3
store double* %1, double** %4
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 27
%7 = load i8, i8* %6
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 25
%10 = load i8, i8* %9
%11 = call i32 @get_bits(i8 zeroext %10, i32 6, i32 7)
%12 = call double @decode_fraction(i8 zeroext %7, i32 %11)
%13 = load double*, double** %4
%14 = getelementptr inbounds double, double* %13, i64 0
store double %12, double* %14
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 28
%17 = load i8, i8* %16
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 25
%20 = load i8, i8* %19
%21 = call i32 @get_bits(i8 zeroext %20, i32 5, i32 4)
%22 = call double @decode_fraction(i8 zeroext %17, i32 %21)
%23 = load double*, double** %4
%24 = getelementptr inbounds double, double* %23, i64 1
store double %22, double* %24
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 29
%27 = load i8, i8* %26
%28 = load i8*, i8** %3
%29 = getelementptr inbounds i8, i8* %28, i64 25
%30 = load i8, i8* %29
%31 = call i32 @get_bits(i8 zeroext %30, i32 2, i32 3)
%32 = call double @decode_fraction(i8 zeroext %27, i32 %31)
%33 = load double*, double** %4
%34 = getelementptr inbounds double, double* %33, i64 2
store double %32, double* %34
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i64 30
%37 = load i8, i8* %36
%38 = load i8*, i8** %3
%39 = getelementptr inbounds i8, i8* %38, i64 25
%40 = load i8, i8* %39
%41 = call i32 @get_bits(i8 zeroext %40, i32 0, i32 1)
%42 = call double @decode_fraction(i8 zeroext %37, i32 %41)
%43 = load double*, double** %4
%44 = getelementptr inbounds double, double* %43, i64 3
store double %42, double* %44
%45 = load i8*, i8** %3
%46 = getelementptr inbounds i8, i8* %45, i64 31
%47 = load i8, i8* %46
%48 = load i8*, i8** %3
%49 = getelementptr inbounds i8, i8* %48, i64 26
%50 = load i8, i8* %49
%51 = call i32 @get_bits(i8 zeroext %50, i32 6, i32 7)
%52 = call double @decode_fraction(i8 zeroext %47, i32 %51)
%53 = load double*, double** %4
%54 = getelementptr inbounds double, double* %53, i64 4
store double %52, double* %54
%55 = load i8*, i8** %3
%56 = getelementptr inbounds i8, i8* %55, i64 32
%57 = load i8, i8* %56
%58 = load i8*, i8** %3
%59 = getelementptr inbounds i8, i8* %58, i64 26
%60 = load i8, i8* %59
%61 = call i32 @get_bits(i8 zeroext %60, i32 4, i32 5)
%62 = call double @decode_fraction(i8 zeroext %57, i32 %61)
%63 = load double*, double** %4
%64 = getelementptr inbounds double, double* %63, i64 5
store double %62, double* %64
%65 = load i8*, i8** %3
%66 = getelementptr inbounds i8, i8* %65, i64 33
%67 = load i8, i8* %66
%68 = load i8*, i8** %3
%69 = getelementptr inbounds i8, i8* %68, i64 26
%70 = load i8, i8* %69
%71 = call i32 @get_bits(i8 zeroext %70, i32 2, i32 3)
%72 = call double @decode_fraction(i8 zeroext %67, i32 %71)
%73 = load double*, double** %4
%74 = getelementptr inbounds double, double* %73, i64 6
store double %72, double* %74
%75 = load i8*, i8** %3
%76 = getelementptr inbounds i8, i8* %75, i64 34
%77 = load i8, i8* %76
%78 = load i8*, i8** %3
%79 = getelementptr inbounds i8, i8* %78, i64 26
%80 = load i8, i8* %79
%81 = call i32 @get_bits(i8 zeroext %80, i32 0, i32 1)
%82 = call double @decode_fraction(i8 zeroext %77, i32 %81)
%83 = load double*, double** %4
%84 = getelementptr inbounds double, double* %83, i64 7
store double %82, double* %84
ret i32 1
}

LLVM IR (-O2):
define i32 @decode_color_characteristics(i8* nocapture %0, double* nocapture writeonly %1) {
%3 = getelementptr inbounds i8, i8* %0, i64 27
%4 = load i8, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 25
%6 = load i8, i8* %5
%7 = tail call i32 @get_bits(i8 zeroext %6, i32 6, i32 7)
%8 = tail call double @decode_fraction(i8 zeroext %4, i32 %7)
store double %8, double* %1
%9 = getelementptr inbounds i8, i8* %0, i64 28
%10 = load i8, i8* %9
%11 = load i8, i8* %5
%12 = tail call i32 @get_bits(i8 zeroext %11, i32 5, i32 4)
%13 = tail call double @decode_fraction(i8 zeroext %10, i32 %12)
%14 = getelementptr inbounds double, double* %1, i64 1
store double %13, double* %14
%15 = getelementptr inbounds i8, i8* %0, i64 29
%16 = load i8, i8* %15
%17 = load i8, i8* %5
%18 = tail call i32 @get_bits(i8 zeroext %17, i32 2, i32 3)
%19 = tail call double @decode_fraction(i8 zeroext %16, i32 %18)
%20 = getelementptr inbounds double, double* %1, i64 2
store double %19, double* %20
%21 = getelementptr inbounds i8, i8* %0, i64 30
%22 = load i8, i8* %21
%23 = load i8, i8* %5
%24 = tail call i32 @get_bits(i8 zeroext %23, i32 0, i32 1)
%25 = tail call double @decode_fraction(i8 zeroext %22, i32 %24)
%26 = getelementptr inbounds double, double* %1, i64 3
store double %25, double* %26
%27 = getelementptr inbounds i8, i8* %0, i64 31
%28 = load i8, i8* %27
%29 = getelementptr inbounds i8, i8* %0, i64 26
%30 = load i8, i8* %29
%31 = tail call i32 @get_bits(i8 zeroext %30, i32 6, i32 7)
%32 = tail call double @decode_fraction(i8 zeroext %28, i32 %31)
%33 = getelementptr inbounds double, double* %1, i64 4
store double %32, double* %33
%34 = getelementptr inbounds i8, i8* %0, i64 32
%35 = load i8, i8* %34
%36 = load i8, i8* %29
%37 = tail call i32 @get_bits(i8 zeroext %36, i32 4, i32 5)
%38 = tail call double @decode_fraction(i8 zeroext %35, i32 %37)
%39 = getelementptr inbounds double, double* %1, i64 5
store double %38, double* %39
%40 = getelementptr inbounds i8, i8* %0, i64 33
%41 = load i8, i8* %40
%42 = load i8, i8* %29
%43 = tail call i32 @get_bits(i8 zeroext %42, i32 2, i32 3)
%44 = tail call double @decode_fraction(i8 zeroext %41, i32 %43)
%45 = getelementptr inbounds double, double* %1, i64 6
store double %44, double* %45
%46 = getelementptr inbounds i8, i8* %0, i64 34
%47 = load i8, i8* %46
%48 = load i8, i8* %29
%49 = tail call i32 @get_bits(i8 zeroext %48, i32 0, i32 1)
%50 = tail call double @decode_fraction(i8 zeroext %47, i32 %49)
%51 = getelementptr inbounds double, double* %1, i64 7
store double %50, double* %51
ret i32 1
}