// File: FFY00[P]uicc/src/program_uicc.c
// Function: readUSIMvalues(char*)
bool readUSIMvalues(char *port) {
    vector<string> res;
    USIM USIMcard;
    string ATR;
    Assert((ATR=USIMcard.open(port))!="", "Failed to open %s", port);
    //dump_hex("ATR", ATR);
    res=USIMcard.readFile("ICCID");
    string iccid=bcdToAscii(res[0]);
    cout << "ICCID: " << iccid <<endl;

    if (!luhn( iccid))
        printf("WARNING: iccid luhn encoding of last digit not done \n");

    USIMcard.openUSIM();
    cout << "USIM IMSI: " << USIMcard.decodeIMSI(USIMcard.readFile("IMSI")[0]) << endl;
    res=USIMcard.readFile("PLMN selector with Access Technology");
    //cout << "USIM PLMN selector: " << bcdToAscii(res[0]) <<endl;
    // Show only the first isdn (might be several)
    vector<string> x=USIMcard.readFile("MSISDN");
    cout << "USIM MSISDN: " << USIMcard.decodeISDN(USIMcard.readFile("MSISDN")[0]) <<endl;
    res=USIMcard.readFile("Service Provider Name");
    cout << "USIM Service Provider Name: " << printable(res[0].substr(1)) <<endl;
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x3f0, %rsp            # imm = 0x3F0
movq %rdi, -0x8(%rbp)
leaq -0x20(%rbp), %rdi
callq 0xec50
leaq -0x70(%rbp), %rdi
callq 0xf870
jmp 0x4613
leaq -0xa0(%rbp), %rdi
callq 0x33f0
movq -0x8(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xe9b0
jmp 0x4635
leaq -0xa0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x3390
movq %rax, %rdi
leaq 0x21612(%rip), %rsi     # 0x25c64
callq 0xe980
movb %al, -0x341(%rbp)
jmp 0x465f
movb -0x341(%rbp), %al
xorb $-0x1, %al
movb %al, -0x342(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x31a0
movb -0x342(%rbp), %al
testb $0x1, %al
jne 0x4688
jmp 0x4746
movq 0x2a941(%rip), %rax     # 0x2efd0
movq (%rax), %rax
movq %rax, -0x350(%rbp)
callq 0x3040
movl (%rax), %edi
callq 0x30d0
movq -0x350(%rbp), %rdi
movq %rax, %r9
movq -0x8(%rbp), %rcx
movq %rsp, %rax
movq %rcx, (%rax)
leaq 0x1ed07(%rip), %rsi     # 0x233c7
leaq 0x1ed89(%rip), %rdx     # 0x23450
leaq 0x1ecc2(%rip), %rcx     # 0x23390
xorl %eax, %eax
movl $0x3a, %r8d
callq 0x3410
movq 0x2a8be(%rip), %rax     # 0x2efa0
movq (%rax), %rdi
callq 0x3350
jmp 0x46ec
movq 0x2a8dd(%rip), %rax     # 0x2efd0
movq (%rax), %rdi
callq 0x3350
jmp 0x46fd
movl $0x1, %edi
callq 0x3370
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4f81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4f6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xc0(%rbp), %rdi
callq 0x31a0
jmp 0x4f6c
jmp 0x4748
jmp 0x474a
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x358(%rbp)
callq 0x34d0
movq -0x358(%rbp), %rdx
leaq 0x1ecf4(%rip), %rsi     # 0x2345f
leaq -0xf8(%rbp), %rdi
callq 0x33e0
jmp 0x4779
leaq -0xd8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
callq 0xf8b0
jmp 0x4792
leaq -0x20(%rbp), %rdi
movq %rdi, -0x360(%rbp)
leaq -0xd8(%rbp), %rsi
movq %rsi, -0x368(%rbp)
callq 0x10470
movq -0x368(%rbp), %rdi
callq 0xf6b0
leaq -0xf8(%rbp), %rdi
callq 0x31a0
leaq -0xf9(%rbp), %rdi
callq 0x3300
movq -0x360(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xf690
movq %rax, %rsi
leaq -0x140(%rbp), %rdi
callq 0x3120
jmp 0x47f5
leaq -0x120(%rbp), %rdi
leaq -0x140(%rbp), %rsi
callq 0x4fa0
jmp 0x480a
leaq -0x140(%rbp), %rdi
callq 0x31a0
movq 0x2a7ab(%rip), %rdi     # 0x2efc8
leaq 0x1ec41(%rip), %rsi     # 0x23465
callq 0x3290
movq %rax, -0x370(%rbp)
jmp 0x4832
movq -0x370(%rbp), %rdi
leaq -0x120(%rbp), %rsi
callq 0x3260
movq %rax, -0x378(%rbp)
jmp 0x484e
movq -0x378(%rbp), %rdi
movq 0x2a754(%rip), %rsi     # 0x2efb0
callq 0x32e0
jmp 0x4863
leaq -0x120(%rbp), %rdi
callq 0x5120
movb %al, -0x379(%rbp)
jmp 0x4877
movb -0x379(%rbp), %al
testb $0x1, %al
jne 0x48fa
jmp 0x4883
leaq 0x1ebe3(%rip), %rdi     # 0x2346d
xorl %eax, %eax
callq 0x3050
jmp 0x4893
jmp 0x48fa
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x48bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x31a0
leaq -0xf9(%rbp), %rdi
callq 0x3300
jmp 0x4f6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x140(%rbp), %rdi
callq 0x31a0
jmp 0x4f6c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4f60
leaq -0x70(%rbp), %rdi
callq 0x104a0
jmp 0x4905
movq 0x2a6bc(%rip), %rdi     # 0x2efc8
leaq 0x1eb90(%rip), %rsi     # 0x234a3
callq 0x3290
movq %rax, -0x388(%rbp)
jmp 0x4921
leaq -0x1b9(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x34d0
movq -0x390(%rbp), %rdx
leaq 0x1ea6c(%rip), %rsi     # 0x233ae
leaq -0x1b8(%rbp), %rdi
callq 0x33e0
jmp 0x4950
leaq -0x198(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x1b8(%rbp), %rdx
callq 0xf8b0
jmp 0x4969
xorl %eax, %eax
movl %eax, %esi
leaq -0x198(%rbp), %rdi
callq 0xf690
movq %rax, %rsi
leaq -0x180(%rbp), %rdi
callq 0x3120
jmp 0x498a
leaq -0x160(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x180(%rbp), %rdx
callq 0xec70
jmp 0x49a3
movq -0x388(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x3260
movq %rax, -0x398(%rbp)
jmp 0x49bf
movq -0x398(%rbp), %rdi
movq 0x2a5e3(%rip), %rsi     # 0x2efb0
callq 0x32e0
jmp 0x49d4
leaq -0x160(%rbp), %rdi
callq 0x31a0
leaq -0x180(%rbp), %rdi
callq 0x31a0
leaq -0x198(%rbp), %rdi
callq 0xf6b0
leaq -0x1b8(%rbp), %rdi
callq 0x31a0
leaq -0x1b9(%rbp), %rdi
callq 0x3300
leaq -0x1f9(%rbp), %rdi
movq %rdi, -0x3a0(%rbp)
callq 0x34d0
movq -0x3a0(%rbp), %rdx
leaq 0x1fc67(%rip), %rsi     # 0x24698
leaq -0x1f8(%rbp), %rdi
callq 0x33e0
jmp 0x4a3f
leaq -0x1d8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x1f8(%rbp), %rdx
callq 0xf8b0
jmp 0x4a58
leaq -0x20(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
movq %rsi, -0x3b0(%rbp)
callq 0x10470
movq -0x3b0(%rbp), %rdi
callq 0xf6b0
leaq -0x1f8(%rbp), %rdi
callq 0x31a0
leaq -0x1f9(%rbp), %rdi
callq 0x3300
leaq -0x239(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x34d0
movq -0x3a8(%rbp), %rdx
leaq 0x1e90c(%rip), %rsi     # 0x233c0
leaq -0x238(%rbp), %rdi
callq 0x33e0
jmp 0x4ac2
leaq -0x218(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x238(%rbp), %rdx
callq 0xf8b0
jmp 0x4adb
leaq -0x238(%rbp), %rdi
callq 0x31a0
leaq -0x239(%rbp), %rdi
callq 0x3300
movq 0x2a4ce(%rip), %rdi     # 0x2efc8
leaq 0x1e9ae(%rip), %rsi     # 0x234af
callq 0x3290
movq %rax, -0x3b8(%rbp)
jmp 0x4b0f
leaq -0x2b9(%rbp), %rdi
movq %rdi, -0x3c0(%rbp)
callq 0x34d0
movq -0x3c0(%rbp), %rdx
leaq 0x1e890(%rip), %rsi     # 0x233c0
leaq -0x2b8(%rbp), %rdi
callq 0x33e0
jmp 0x4b3e
leaq -0x298(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x2b8(%rbp), %rdx
callq 0xf8b0
jmp 0x4b57
xorl %eax, %eax
movl %eax, %esi
leaq -0x298(%rbp), %rdi
callq 0xf690
movq %rax, %rsi
leaq -0x280(%rbp), %rdi
callq 0x3120
jmp 0x4b78
leaq -0x260(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x280(%rbp), %rdx
callq 0xf710
jmp 0x4b91
movq -0x3b8(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x3260
movq %rax, -0x3c8(%rbp)
jmp 0x4bad
movq -0x3c8(%rbp), %rdi
movq 0x2a3f5(%rip), %rsi     # 0x2efb0
callq 0x32e0
jmp 0x4bc2
leaq -0x260(%rbp), %rdi
callq 0x31a0
leaq -0x280(%rbp), %rdi
callq 0x31a0
leaq -0x298(%rbp), %rdi
callq 0xf6b0
leaq -0x2b8(%rbp), %rdi
callq 0x31a0
leaq -0x2b9(%rbp), %rdi
callq 0x3300
leaq -0x2f9(%rbp), %rdi
movq %rdi, -0x3d0(%rbp)
callq 0x34d0
movq -0x3d0(%rbp), %rdx
leaq 0x1e89e(%rip), %rsi     # 0x234bd
leaq -0x2f8(%rbp), %rdi
callq 0x33e0
jmp 0x4c2d
leaq -0x2d8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
leaq -0x2f8(%rbp), %rdx
callq 0xf8b0
jmp 0x4c46
leaq -0x20(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
movq %rsi, -0x3e0(%rbp)
callq 0x10470
movq -0x3e0(%rbp), %rdi
callq 0xf6b0
leaq -0x2f8(%rbp), %rdi
callq 0x31a0
leaq -0x2f9(%rbp), %rdi
callq 0x3300
movq 0x2a340(%rip), %rdi     # 0x2efc8
leaq 0x1e844(%rip), %rsi     # 0x234d3
callq 0x3290
movq %rax, -0x3d8(%rbp)
jmp 0x4c9d
xorl %eax, %eax
movl %eax, %esi
leaq -0x20(%rbp), %rdi
callq 0xf690
movq %rax, %rsi
leaq -0x340(%rbp), %rdi
movl $0x1, %edx
movq $-0x1, %rcx
callq 0x32c0
jmp 0x4cc7
leaq -0x320(%rbp), %rdi
leaq -0x340(%rbp), %rsi
callq 0x5190
jmp 0x4cdc
movq -0x3d8(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x3260
movq %rax, -0x3e8(%rbp)
jmp 0x4cf8
movq -0x3e8(%rbp), %rdi
movq 0x2a2aa(%rip), %rsi     # 0x2efb0
callq 0x32e0
jmp 0x4d0d
leaq -0x320(%rbp), %rdi
callq 0x31a0
leaq -0x340(%rbp), %rdi
callq 0x31a0
leaq -0x218(%rbp), %rdi
callq 0xf6b0
leaq -0x120(%rbp), %rdi
callq 0x31a0
leaq -0xa0(%rbp), %rdi
callq 0x31a0
leaq -0x70(%rbp), %rdi
callq 0x10950
leaq -0x20(%rbp), %rdi
callq 0xf6b0
movb $0x1, %al
andb $0x1, %al
addq $0x3f0, %rsp            # imm = 0x3F0
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4ddc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4dd0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4dc4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4db8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x160(%rbp), %rdi
callq 0x31a0
leaq -0x180(%rbp), %rdi
callq 0x31a0
leaq -0x198(%rbp), %rdi
callq 0xf6b0
leaq -0x1b8(%rbp), %rdi
callq 0x31a0
leaq -0x1b9(%rbp), %rdi
callq 0x3300
jmp 0x4f60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4e13
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x31a0
leaq -0x1f9(%rbp), %rdi
callq 0x3300
jmp 0x4f60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4e4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x238(%rbp), %rdi
callq 0x31a0
leaq -0x239(%rbp), %rdi
callq 0x3300
jmp 0x4f60
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4f54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4ee0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4ed4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4ec8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4ebc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x31a0
leaq -0x280(%rbp), %rdi
callq 0x31a0
leaq -0x298(%rbp), %rdi
callq 0xf6b0
leaq -0x2b8(%rbp), %rdi
callq 0x31a0
leaq -0x2b9(%rbp), %rdi
callq 0x3300
jmp 0x4f54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4f14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0x31a0
leaq -0x2f9(%rbp), %rdi
callq 0x3300
jmp 0x4f54
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x4f48
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x31a0
leaq -0x340(%rbp), %rdi
callq 0x31a0
leaq -0x218(%rbp), %rdi
callq 0xf6b0
leaq -0x120(%rbp), %rdi
callq 0x31a0
leaq -0xa0(%rbp), %rdi
callq 0x31a0
leaq -0x70(%rbp), %rdi
callq 0x10950
leaq -0x20(%rbp), %rdi
callq 0xf6b0
movq -0x78(%rbp), %rdi
callq 0x34b0
nopw %cs:(%rax,%rax)