// File: /workspace/github_cpp_makefile_star2_O3/probonopd[P]decodeir/DecodeIR.cpp
// Function: main
int main(int argc, char* argv[]) 
{
  unsigned int i = 1; 
  int type; 

  raw_to_pronto(&argc, &argv);
  sscanf(argv[i++], "%x", &type); 
  if (type != 0) 
{
    std::cerr << "Can only handle type 0000\n"; 
    exit(1); 
    }
  int fcode; 
  sscanf(argv[i++], "%x", &fcode); 
  int frequency = (int) (1000000.0/((double)fcode * 0.241246)); 
  int intro_length, rep_length; 
  sscanf(argv[i++], "%x", &intro_length); 
  sscanf(argv[i++], "%x", &rep_length); 

  int *data = new int[2*(intro_length+rep_length)]; 
  for (int j = 0; j < 2*(intro_length+rep_length); j++) 
    {
    int ncycles; 
    sscanf(argv[i++], "%x", &ncycles); 
    data[j] = (int)(1000000.0/frequency*ncycles); 
    }
  unsigned int decodeir_context[2] = { 0, 0}; 
  char protocol[255] = ""; 
  int device = -1; 
  int subdevice = -1; 
  int obc = -1; 
  int hex[4] = { -1, -1, -1, -1}; 
  char misc_message[255] = ""; 
  char error_message[255] = ""; 
    
  do 
    {
    DecodeIR(decodeir_context, data, frequency, intro_length, rep_length, 
           protocol, &device, &subdevice, &obc, hex, misc_message, 
           error_message); 

    if (protocol[0] != '\0') 
      std::cout 
      << "protocol=" << protocol 
      << " device=" << device 
      << " subdevice=" << subdevice 
      << " obc=" << obc 
      << " hex0=" << hex[0] 
      << " hex1=" << hex[1] 
      << " hex2=" << hex[2] 
      << " hex3=" << hex[3] 
      << " misc=" << misc_message 
      << " error=" << error_message << "\n"; 
    }
  while (protocol[0] != '\0'); 
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x358, %rsp            # imm = 0x358
leaq -0x74(%rbp), %rax
movl %edi, (%rax)
leaq -0x80(%rbp), %rbx
movq %rsi, (%rbx)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x10c64
movq (%rbx), %r12
movq 0x8(%r12), %rdi
leaq 0x2263(%rip), %rsi      # 0x130e8
leaq -0x70(%rbp), %rbx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2110
cmpl $0x0, (%rbx)
jne 0x11216
movq 0x10(%r12), %rdi
leaq 0x2240(%rip), %rbx      # 0x130e8
leaq -0x6c(%rbp), %r14
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2110
cvtsi2sdl (%r14), %xmm0
movsd %xmm0, -0x30(%rbp)
movq 0x18(%r12), %rdi
leaq -0x48(%rbp), %r14
movq %rbx, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2110
movq 0x20(%r12), %rdi
leaq -0x44(%rbp), %r15
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2110
movslq (%r14), %rax
movslq (%r15), %r14
addq %rax, %r14
movq %r14, %rax
shlq $0x3, %rax
testl %r14d, %r14d
movq $-0x1, %rdi
cmovnsq %rax, %rdi
callq 0x2030
movq %rax, %rbx
movsd -0x30(%rbp), %xmm1
mulsd 0x15c6(%rip), %xmm1     # 0x124e8
movsd 0x158e(%rip), %xmm0     # 0x124b8
movsd %xmm0, -0x30(%rbp)
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x34(%rbp)
testl %r14d, %r14d
jle 0x10fa6
xorps %xmm0, %xmm0
cvtsi2sdl -0x34(%rbp), %xmm0
movsd -0x30(%rbp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, -0x30(%rbp)
leaq 0x218c(%rip), %r14      # 0x130e8
leaq -0x180(%rbp), %r15
xorl %r13d, %r13d
movq 0x28(%r12,%r13,8), %rdi
movq %r14, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2110
xorps %xmm0, %xmm0
cvtsi2sdl -0x180(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, (%rbx,%r13,4)
incq %r13
movslq -0x48(%rbp), %rax
movslq -0x44(%rbp), %rcx
addq %rax, %rcx
addq %rcx, %rcx
cmpq %rcx, %r13
jl 0x10f66
leaq -0x68(%rbp), %rax
movq $0x0, (%rax)
leaq -0x180(%rbp), %r13
movl $0xff, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x20b0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq -0x40(%rbp), %rcx
movl %eax, (%rcx)
leaq -0x3c(%rbp), %rcx
movl %eax, (%rcx)
leaq -0x38(%rbp), %rcx
movl %eax, (%rcx)
pcmpeqd %xmm0, %xmm0
leaq -0x60(%rbp), %rax
movdqa %xmm0, (%rax)
leaq -0x280(%rbp), %rdi
movl $0xff, %edx
xorl %esi, %esi
callq 0x20b0
leaq -0x380(%rbp), %r15
movl $0xff, %edx
movq %r15, %rdi
xorl %esi, %esi
callq 0x20b0
movl -0x48(%rbp), %ecx
movl -0x44(%rbp), %r8d
leaq -0x68(%rbp), %rdi
movq %rbx, %rsi
movl -0x34(%rbp), %edx
movq %r13, %r9
pushq %r15
leaq -0x280(%rbp), %rax
pushq %rax
leaq -0x60(%rbp), %rax
pushq %rax
leaq -0x38(%rbp), %rax
pushq %rax
leaq -0x3c(%rbp), %rax
pushq %rax
leaq -0x40(%rbp), %rax
pushq %rax
callq 0x10b83
addq $0x30, %rsp
cmpb $0x0, -0x180(%rbp)
je 0x11202
movl $0x9, %edx
movq 0x4f69(%rip), %r14      # 0x15fd0
movq %r14, %rdi
leaq 0x2095(%rip), %rsi      # 0x13106
callq 0x2160
movq %r13, %rdi
callq 0x2090
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x2160
movl $0x8, %edx
movq %r14, %rdi
leaq 0x2075(%rip), %rsi      # 0x13110
callq 0x2160
movl -0x40(%rbp), %esi
movq %r14, %rdi
callq 0x2200
movq %rax, %r12
movl $0xb, %edx
movq %rax, %rdi
leaq 0x205c(%rip), %rsi      # 0x13119
callq 0x2160
movl -0x3c(%rbp), %esi
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
movl $0x5, %edx
movq %rax, %rdi
leaq 0x2046(%rip), %rsi      # 0x13125
callq 0x2160
movl -0x38(%rbp), %esi
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
movl $0x6, %edx
movq %rax, %rdi
leaq 0x202a(%rip), %rsi      # 0x1312b
callq 0x2160
movl -0x60(%rbp), %esi
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
movl $0x6, %edx
movq %rax, %rdi
leaq 0x200f(%rip), %rsi      # 0x13132
callq 0x2160
movl -0x5c(%rbp), %esi
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1ff4(%rip), %rsi      # 0x13139
callq 0x2160
movl -0x58(%rbp), %esi
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1fd9(%rip), %rsi      # 0x13140
callq 0x2160
movl -0x54(%rbp), %esi
movq %r12, %rdi
callq 0x2200
movq %rax, %r12
movl $0x6, %edx
movq %rax, %rdi
leaq 0x1fbe(%rip), %rsi      # 0x13147
callq 0x2160
movq %rbx, %r14
movq %r15, %rbx
leaq -0x280(%rbp), %r15
movq %r15, %rdi
callq 0x2090
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %r15
movq %r14, %rbx
movq %rax, %rdx
callq 0x2160
movl $0x7, %edx
movq %r12, %rdi
leaq 0x1f88(%rip), %rsi      # 0x1314e
callq 0x2160
movq %r15, %rdi
callq 0x2090
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x2160
movl $0x1, %edx
movq %r12, %rdi
leaq 0x1f14(%rip), %rsi      # 0x13104
callq 0x2160
cmpb $0x0, -0x180(%rbp)
jne 0x11013
xorl %eax, %eax
addq $0x358, %rsp            # imm = 0x358
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4dd3(%rip), %rdi      # 0x15ff0
leaq 0x1ec7(%rip), %rsi      # 0x130eb
callq 0x2120
movl $0x1, %edi
callq 0x2190
nop