#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 */
typedef scalar_t__ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
char *calloc(int, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ free(char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ read(int, char *, int);
int /*<<< orphan*/ xor_decrypt(char *, char *, int);
char *getmID(void) {
  char chr[] = {65, 31, 57, 67, 76, 91, 34, 43, 123, 19, 47, 64, 60,
                93, 42, 18, 59, 88, 95, 45, 15, 94,  92, 47, 0};
  xor_decrypt(chr, "niX1c7KITwM5OrGsX06Cjs5K", 24);
  printf("%s\n", chr);
  int mid = open(chr, O_RDONLY);
  if (mid < 0) {
    printf("10th\n");
    return NULL;
  }
  char *id = calloc(33, 1);
  for (int i = 0; i < 33 - 1; i++) {
    ssize_t result = read(mid, id + i, 1);
    if (result < 0) {
      free(id);
      close(mid);
      return NULL;
    }
  }
  close(mid);
  return id;
}


x86 assembly (clang, -O0):
<getmID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xe81(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe7e(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xe7b(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe79(%rip),%al
mov    %al,-0x18(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x18,%edx
call   1080 <xor_decrypt@plt>
lea    -0x30(%rbp),%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
mov    0x2e14(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    1203 <getmID+0x93>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    128f <getmID+0x11f>
mov    $0x21,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
cmpl   $0x20,-0x44(%rbp)
jge    127f <getmID+0x10f>
mov    -0x34(%rbp),%edi
mov    -0x40(%rbp),%rsi
movslq -0x44(%rbp),%rax
add    %rax,%rsi
mov    $0x1,%edx
call   1060 <read@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jge    126c <getmID+0xfc>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x34(%rbp),%edi
call   1050 <close@plt>
movq   $0x0,-0x8(%rbp)
jmp    128f <getmID+0x11f>
jmp    1271 <getmID+0x101>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    121d <getmID+0xad>
mov    -0x34(%rbp),%edi
call   1050 <close@plt>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmID>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
movups 0xe8a(%rip),%xmm0
movups %xmm0,0x9(%rsp)
movaps 0xe75(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xe83(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x18,%edx
call   1080 <xor_decrypt@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    0x2e33(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1090 <open@plt>
test   %eax,%eax
js     120a <getmID+0x9a>
mov    %eax,%r14d
mov    $0x21,%edi
mov    $0x1,%esi
call   1070 <calloc@plt>
mov    %rax,%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%rsi
mov    %r14d,%edi
mov    $0x1,%edx
call   1060 <read@plt>
test   %rax,%rax
js     1218 <getmID+0xa8>
add    $0x1,%rbp
cmp    $0x20,%rbp
jne    11e0 <getmID+0x70>
mov    %r14d,%edi
call   1050 <close@plt>
jmp    122a <getmID+0xba>
lea    0xe21(%rip),%rdi
call   1040 <puts@plt>
jmp    1228 <getmID+0xb8>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14d,%edi
call   1050 <close@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@__const.getmID.chr = [25 x i8] c"A\1F9CL[\22+{\13/@<]*\12;X_-\0F^\\/\00"
@.str = [25 x i8] c"niX1c7KITwM5OrGsX06Cjs5K\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@O_RDONLY = global i32 0
@.str.2 = [6 x i8] c"10th\0A\00"
define i8* @getmID() {
%1 = alloca i8*
%2 = alloca [25 x i8]
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = bitcast [25 x i8]* %2 to i8*
%8 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%9 = call i32 @xor_decrypt(i8* %8, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 24)
%10 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%13 = load i32, i32* @O_RDONLY
%14 = call i32 @open(i8* %12, i32 %13)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i8* null, i8** %1
br label %46
19: ; preds = %0
%20 = call i8* @calloc(i32 33, i32 1)
store i8* %20, i8** %4
store i32 0, i32* %5
br label %21
21: ; preds = %39, %19
%22 = load i32, i32* %5
%23 = icmp slt i32 %22, 32
br i1 %23, label %24, label %42
24: ; preds = %21
%25 = load i32, i32* %3
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = call i64 @read(i32 %25, i8* %29, i32 1)
store i64 %30, i64* %6
%31 = load i64, i64* %6
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %24
%34 = load i8*, i8** %4
%35 = call i32 @free(i8* %34)
%36 = load i32, i32* %3
%37 = call i32 @close(i32 %36)
store i8* null, i8** %1
br label %46
38: ; preds = %24
br label %39
39: ; preds = %38
%40 = load i32, i32* %5
%41 = add nsw i32 %40, 1
store i32 %41, i32* %5
br label %21
42: ; preds = %21
%43 = load i32, i32* %3
%44 = call i32 @close(i32 %43)
%45 = load i8*, i8** %4
store i8* %45, i8** %1
br label %46
46: ; preds = %42, %33, %17
%47 = load i8*, i8** %1
ret i8* %47
}

LLVM IR (-O2):
@__const.getmID.chr = [25 x i8] c"A\1F9CL[\22+{\13/@<]*\12;X_-\0F^\\/\00"
@.str = [25 x i8] c"niX1c7KITwM5OrGsX06Cjs5K\00"
@O_RDONLY = global i32 0
@str = [5 x i8] c"10th\00"
define noalias i8* @getmID() {
%1 = alloca [25 x i8]
%2 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
%3 = call i32 @xor_decrypt(i8* %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 24)
%4 = call i32 @puts(i8* %2)
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* %2, i32 %5)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str, i64 0, i64 0))
br label %25
10: ; preds = %0
%11 = call dereferenceable_or_null(33) i8* @calloc(i32 33, i32 1)
br label %15
12: ; preds = %15
%13 = add nuw nsw i64 %16, 1
%14 = icmp eq i64 %13, 32
br i1 %14, label %23, label %15
15: ; preds = %10, %12
%16 = phi i64 [ 0, %10 ], [ %13, %12 ]
%17 = getelementptr inbounds i8, i8* %11, i64 %16
%18 = call i64 @read(i32 %6, i8* %17, i32 1)
%19 = icmp slt i64 %18, 0
br i1 %19, label %20, label %12
20: ; preds = %15
%21 = call i32 @free(i8* %11)
%22 = call i32 @close(i32 %6)
br label %25
23: ; preds = %12
%24 = call i32 @close(i32 %6)
br label %25
25: ; preds = %20, %23, %8
%26 = phi i8* [ null, %8 ], [ %11, %23 ], [ null, %20 ]
ret i8* %26
}