// File: FFY00[P]uicc/src/program_uicc.c
// Function: setOPc(uicc_vals&)
void setOPc(struct uicc_vals &values) {
    string key;
    Assert(makeBin(values.key, key) == 16, "can't read a correct key: 16 hexa figures\n");
    string op;
    Assert(makeBin(values.op, op) == 16, "can't read a correct op: 16 hexa figures\n");
    uint8_t opc[16];
    milenage_opc_gen((const uint8_t *)key.c_str(),
                     (const uint8_t *)op.c_str(),
                     opc);

    for (int i=0 ; i<16; i++) {
        char tmp[8];
        sprintf(tmp,"%02hhx",opc[i]);
        values.opc+= tmp;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x33f0
movq -0x8(%rbp), %rsi
addq $0xe8, %rsi
leaq -0x48(%rbp), %rdi
callq 0x3120
jmp 0xbcbe
leaq -0x48(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0xbf90
movl %eax, -0xc0(%rbp)
jmp 0xbcd3
movl -0xc0(%rbp), %eax
cmpl $0x10, %eax
sete %al
xorb $-0x1, %al
movb %al, -0xc1(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x31a0
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0xbcff
jmp 0xbd9f
movq 0x232ca(%rip), %rax     # 0x2efd0
movq (%rax), %rax
movq %rax, -0xd0(%rbp)
callq 0x3040
movl (%rax), %edi
callq 0x30d0
movq -0xd0(%rbp), %rdi
movq %rax, %r9
leaq 0x19197(%rip), %rsi     # 0x24ec4
leaq 0x19233(%rip), %rdx     # 0x24f67
leaq 0x17655(%rip), %rcx     # 0x23390
xorl %eax, %eax
movl $0x12f, %r8d            # imm = 0x12F
callq 0x3410
movq 0x23251(%rip), %rax     # 0x2efa0
movq (%rax), %rdi
callq 0x3350
jmp 0xbd59
movq 0x23270(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3350
jmp 0xbd6a
movl $0x1, %edi
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xbf6f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x31a0
jmp 0xbf6f
jmp 0xbda1
jmp 0xbda3
leaq -0x78(%rbp), %rdi
callq 0x33f0
movq -0x8(%rbp), %rsi
addq $0x88, %rsi
leaq -0x98(%rbp), %rdi
callq 0x3120
jmp 0xbdc5
leaq -0x98(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0xbf90
movl %eax, -0xd4(%rbp)
jmp 0xbddd
movl -0xd4(%rbp), %eax
cmpl $0x10, %eax
sete %al
xorb $-0x1, %al
movb %al, -0xd5(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x31a0
movb -0xd5(%rbp), %al
testb $0x1, %al
jne 0xbe0c
jmp 0xbeaf
movq 0x231bd(%rip), %rax     # 0x2efd0
movq (%rax), %rax
movq %rax, -0xe0(%rbp)
callq 0x3040
movl (%rax), %edi
callq 0x30d0
movq -0xe0(%rbp), %rdi
movq %rax, %r9
leaq 0x19134(%rip), %rsi     # 0x24f6e
leaq 0x19126(%rip), %rdx     # 0x24f67
leaq 0x17548(%rip), %rcx     # 0x23390
xorl %eax, %eax
movl $0x131, %r8d            # imm = 0x131
callq 0x3410
movq 0x23144(%rip), %rax     # 0x2efa0
movq (%rax), %rdi
callq 0x3350
jmp 0xbe66
movq 0x23163(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3350
jmp 0xbe77
movl $0x1, %edi
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0xbf66
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x31a0
jmp 0xbf66
jmp 0xbeb1
jmp 0xbeb3
leaq -0x28(%rbp), %rdi
callq 0x3110
movq %rax, -0xe8(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x3110
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
leaq -0xb0(%rbp), %rdx
callq 0x40b0
jmp 0xbee4
movl $0x0, -0xb4(%rbp)
cmpl $0x10, -0xb4(%rbp)
jge 0xbf4b
movslq -0xb4(%rbp), %rax
movzbl -0xb0(%rbp,%rax), %edx
leaq 0x19101(%rip), %rsi     # 0x2500e
xorl %eax, %eax
leaq -0xbc(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x3090
movq -0xf0(%rbp), %rsi
movq -0x8(%rbp), %rdi
addq $0x68, %rdi
callq 0x3280
jmp 0xbf38
jmp 0xbf3a
movl -0xb4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0xbeee
leaq -0x78(%rbp), %rdi
callq 0x31a0
leaq -0x28(%rbp), %rdi
callq 0x31a0
addq $0xf0, %rsp
popq %rbp
retq
leaq -0x78(%rbp), %rdi
callq 0x31a0
leaq -0x28(%rbp), %rdi
callq 0x31a0
movq -0x50(%rbp), %rdi
callq 0x34b0
nopw %cs:(%rax,%rax)