#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 */
int atoi(char *);
int /*<<< orphan*/ infoUserPrints(int, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ safePrefRead(int, char *);
int /*<<< orphan*/ safeRead(int, int *, int);
void userPrints(int sC, const char *user) {
  int i, postsCount;
  char info[513], postType[5], date[33], id[33];
  printf("\n___________________________________________________________________"
         "\n\n");
  for (i = 0; i < 6; i++) {
    memset(info, 0, 513);
    safePrefRead(sC, info);
    infoUserPrints(i, info);
  }
  printf("___________________________________________________________________"
         "\n\n");
  safeRead(sC, &postsCount, sizeof(int));
  printf("%s has %d post(s) \n\n", user, postsCount);
  for (i = 0; i < postsCount; i++) {
    memset(id, 0, 33);
    memset(info, 0, 513);
    memset(postType, 0, 5);
    memset(date, 0, 33);
    safePrefRead(sC, id);
    safePrefRead(sC, info);
    safePrefRead(sC, postType);
    safePrefRead(sC, date);
    switch (atoi(postType)) {
    case 1:
      printf("\033[32m"
             "[ID:%s]"
             "\033[33m"
             "[%s]"
             "\033[32m"
             "[publ]:"
             "\033[0m"
             "%s\n",
             id, date, info);
      break;
    case 2:
      printf("\033[32m"
             "[ID:%s]"
             "\033[33m"
             "[%s]"
             "\033[33m"
             "[frnd]:"
             "\033[0m"
             "%s\n",
             id, date, info);
      break;
    case 3:
      printf("\033[32m"
             "[ID:%s]"
             "\033[33m"
             "[%s]"
             "\033[31m"
             "[cf/f]:"
             "\033[0m"
             "%s\n",
             id, date, info);
      break;
    }
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<userPrints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x6,-0x14(%rbp)
jge    11d0 <userPrints+0x70>
lea    -0x220(%rbp),%rdi
xor    %esi,%esi
mov    $0x201,%edx
call   1060 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0x220(%rbp),%rsi
call   1030 <safePrefRead@plt>
mov    -0x14(%rbp),%edi
lea    -0x220(%rbp),%rsi
call   1050 <infoUserPrints@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1187 <userPrints+0x27>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1070 <safeRead@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%edx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    13a4 <userPrints+0x244>
lea    -0x280(%rbp),%rdi
mov    %rdi,-0x2a8(%rbp)
xor    %esi,%esi
mov    %esi,-0x2b0(%rbp)
mov    $0x21,%edx
mov    %edx,-0x2ac(%rbp)
call   1060 <memset@plt>
mov    -0x2b0(%rbp),%esi
lea    -0x220(%rbp),%rdi
mov    %rdi,-0x2a0(%rbp)
mov    $0x201,%edx
call   1060 <memset@plt>
mov    -0x2b0(%rbp),%esi
lea    -0x225(%rbp),%rdi
mov    %rdi,-0x290(%rbp)
mov    $0x5,%edx
call   1060 <memset@plt>
mov    -0x2b0(%rbp),%esi
mov    -0x2ac(%rbp),%edx
lea    -0x250(%rbp),%rdi
mov    %rdi,-0x298(%rbp)
call   1060 <memset@plt>
mov    -0x2a8(%rbp),%rsi
mov    -0x4(%rbp),%edi
call   1030 <safePrefRead@plt>
mov    -0x2a0(%rbp),%rsi
mov    -0x4(%rbp),%edi
call   1030 <safePrefRead@plt>
mov    -0x290(%rbp),%rsi
mov    -0x4(%rbp),%edi
call   1030 <safePrefRead@plt>
mov    -0x298(%rbp),%rsi
mov    -0x4(%rbp),%edi
call   1030 <safePrefRead@plt>
mov    -0x290(%rbp),%rdi
call   1080 <atoi@plt>
mov    %eax,%ecx
mov    %ecx,-0x284(%rbp)
sub    $0x1,%eax
je     131e <userPrints+0x1be>
jmp    12f6 <userPrints+0x196>
mov    -0x284(%rbp),%eax
sub    $0x2,%eax
je     1346 <userPrints+0x1e6>
jmp    130a <userPrints+0x1aa>
mov    -0x284(%rbp),%eax
sub    $0x3,%eax
je     136e <userPrints+0x20e>
jmp    1391 <userPrints+0x231>
lea    -0x280(%rbp),%rsi
lea    -0x250(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    0xd22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1391 <userPrints+0x231>
lea    -0x280(%rbp),%rsi
lea    -0x250(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    0xd23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1391 <userPrints+0x231>
lea    -0x280(%rbp),%rsi
lea    -0x250(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    0xd24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1396 <userPrints+0x236>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120b <userPrints+0xab>
lea    0xcaf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x2b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<userPrints>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x278,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
lea    0xef3(%rip),%rdi
call   1040 <puts@plt>
lea    0x70(%rsp),%r15
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x201,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <safePrefRead@plt>
xor    %edi,%edi
mov    %r15,%rsi
call   1070 <infoUserPrints@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x201,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <safePrefRead@plt>
mov    $0x1,%edi
mov    %r15,%rsi
call   1070 <infoUserPrints@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x201,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <safePrefRead@plt>
mov    $0x2,%edi
mov    %r15,%rsi
call   1070 <infoUserPrints@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x201,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <safePrefRead@plt>
mov    $0x3,%edi
mov    %r15,%rsi
call   1070 <infoUserPrints@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x201,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <safePrefRead@plt>
mov    $0x4,%edi
mov    %r15,%rsi
call   1070 <infoUserPrints@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x201,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <safePrefRead@plt>
mov    $0x5,%edi
mov    %r15,%rsi
call   1070 <infoUserPrints@plt>
lea    0xe02(%rip),%rdi
call   1040 <puts@plt>
lea    0x4(%rsp),%rsi
mov    %ebx,%edi
mov    $0x4,%edx
call   1090 <safeRead@plt>
mov    0x4(%rsp),%edx
lea    0xd50(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x0,0x4(%rsp)
jle    138a <userPrints+0x20a>
lea    0x10(%rsp),%r14
lea    0x70(%rsp),%r15
lea    0xb(%rsp),%r12
lea    0x40(%rsp),%r13
xor    %ebp,%ebp
jmp    12ed <userPrints+0x16d>
nopl   (%rax)
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jge    138a <userPrints+0x20a>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1080 <memset@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x201,%edx
call   1080 <memset@plt>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x5,%edx
call   1080 <memset@plt>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x21,%edx
call   1080 <memset@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1050 <safePrefRead@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1050 <safePrefRead@plt>
mov    %ebx,%edi
mov    %r12,%rsi
call   1050 <safePrefRead@plt>
mov    %ebx,%edi
mov    %r13,%rsi
call   1050 <safePrefRead@plt>
mov    %r12,%rdi
call   10a0 <atoi@plt>
add    $0xffffffff,%eax
cmp    $0x2,%eax
ja     12e0 <userPrints+0x160>
cltq
lea    0xd6a(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12e0 <userPrints+0x160>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x278,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [71 x i8] c"\0A___________________________________________________________________\0A\0A\00"
@.str.1 = [70 x i8] c"___________________________________________________________________\0A\0A\00"
@.str.2 = [21 x i8] c"%s has %d post(s) \0A\0A\00"
@.str.3 = [41 x i8] c"\1B[32m[ID:%s]\1B[33m[%s]\1B[32m[publ]:\1B[0m%s\0A\00"
@.str.4 = [41 x i8] c"\1B[32m[ID:%s]\1B[33m[%s]\1B[33m[frnd]:\1B[0m%s\0A\00"
@.str.5 = [41 x i8] c"\1B[32m[ID:%s]\1B[33m[%s]\1B[31m[cf/f]:\1B[0m%s\0A\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @userPrints(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [513 x i8]
%8 = alloca [5 x i8]
%9 = alloca [33 x i8]
%10 = alloca [33 x i8]
store i32 %0, i32* %3
store i8* %1, i8** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %12
12: ; preds = %24, %2
%13 = load i32, i32* %5
%14 = icmp slt i32 %13, 6
br i1 %14, label %15, label %27
15: ; preds = %12
%16 = getelementptr inbounds [513 x i8], [513 x i8]* %7, i64 0, i64 0
%17 = call i32 @memset(i8* %16, i32 0, i32 513)
%18 = load i32, i32* %3
%19 = getelementptr inbounds [513 x i8], [513 x i8]* %7, i64 0, i64 0
%20 = call i32 @safePrefRead(i32 %18, i8* %19)
%21 = load i32, i32* %5
%22 = getelementptr inbounds [513 x i8], [513 x i8]* %7, i64 0, i64 0
%23 = call i32 @infoUserPrints(i32 %21, i8* %22)
br label %24
24: ; preds = %15
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %12
27: ; preds = %12
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.1, i64 0, i64 0))
%29 = load i32, i32* %3
%30 = call i32 @safeRead(i32 %29, i32* %6, i32 4)
%31 = load i8*, i8** %4
%32 = load i32, i32* %6
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %31, i32 %32)
store i32 0, i32* %5
br label %34
34: ; preds = %77, %27
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %80
38: ; preds = %34
%39 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%40 = call i32 @memset(i8* %39, i32 0, i32 33)
%41 = getelementptr inbounds [513 x i8], [513 x i8]* %7, i64 0, i64 0
%42 = call i32 @memset(i8* %41, i32 0, i32 513)
%43 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%44 = call i32 @memset(i8* %43, i32 0, i32 5)
%45 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%46 = call i32 @memset(i8* %45, i32 0, i32 33)
%47 = load i32, i32* %3
%48 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%49 = call i32 @safePrefRead(i32 %47, i8* %48)
%50 = load i32, i32* %3
%51 = getelementptr inbounds [513 x i8], [513 x i8]* %7, i64 0, i64 0
%52 = call i32 @safePrefRead(i32 %50, i8* %51)
%53 = load i32, i32* %3
%54 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%55 = call i32 @safePrefRead(i32 %53, i8* %54)
%56 = load i32, i32* %3
%57 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%58 = call i32 @safePrefRead(i32 %56, i8* %57)
%59 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%60 = call i32 @atoi(i8* %59)
switch i32 %60, label %76 [
i32 1, label %61
i32 2, label %66
i32 3, label %71
]
61: ; preds = %38
%62 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%63 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%64 = getelementptr inbounds [513 x i8], [513 x i8]* %7, i64 0, i64 0
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.3, i64 0, i64 0), i8* %62, i8* %63, i8* %64)
br label %76
66: ; preds = %38
%67 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%68 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%69 = getelementptr inbounds [513 x i8], [513 x i8]* %7, i64 0, i64 0
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.4, i64 0, i64 0), i8* %67, i8* %68, i8* %69)
br label %76
71: ; preds = %38
%72 = getelementptr inbounds [33 x i8], [33 x i8]* %10, i64 0, i64 0
%73 = getelementptr inbounds [33 x i8], [33 x i8]* %9, i64 0, i64 0
%74 = getelementptr inbounds [513 x i8], [513 x i8]* %7, i64 0, i64 0
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), i8* %72, i8* %73, i8* %74)
br label %76
76: ; preds = %38, %71, %66, %61
br label %77
77: ; preds = %76
%78 = load i32, i32* %5
%79 = add nsw i32 %78, 1
store i32 %79, i32* %5
br label %34
80: ; preds = %34
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.2 = [21 x i8] c"%s has %d post(s) \0A\0A\00"
@.str.3 = [41 x i8] c"\1B[32m[ID:%s]\1B[33m[%s]\1B[32m[publ]:\1B[0m%s\0A\00"
@.str.4 = [41 x i8] c"\1B[32m[ID:%s]\1B[33m[%s]\1B[33m[frnd]:\1B[0m%s\0A\00"
@.str.5 = [41 x i8] c"\1B[32m[ID:%s]\1B[33m[%s]\1B[31m[cf/f]:\1B[0m%s\0A\00"
@str = [70 x i8] c"\0A___________________________________________________________________\0A\00"
@str.7 = [69 x i8] c"___________________________________________________________________\0A\00"
@reltable.userPrints = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([41 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.userPrints to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([41 x i8]* @.str.4 to i64), i64 ptrtoint ([3 x i32]* @reltable.userPrints to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([41 x i8]* @.str.5 to i64), i64 ptrtoint ([3 x i32]* @reltable.userPrints to i64)) to i32)]
define void @userPrints(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca [513 x i8]
%5 = alloca [5 x i8]
%6 = alloca [33 x i8]
%7 = alloca [33 x i8]
%8 = bitcast i32* %3 to i8*
%9 = getelementptr inbounds [513 x i8], [513 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [33 x i8], [33 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [33 x i8], [33 x i8]* %7, i64 0, i64 0
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
%14 = call i32 @memset(i8* %9, i32 0, i32 513)
%15 = call i32 @safePrefRead(i32 %0, i8* %9)
%16 = call i32 @infoUserPrints(i32 0, i8* %9)
%17 = call i32 @memset(i8* %9, i32 0, i32 513)
%18 = call i32 @safePrefRead(i32 %0, i8* %9)
%19 = call i32 @infoUserPrints(i32 1, i8* %9)
%20 = call i32 @memset(i8* %9, i32 0, i32 513)
%21 = call i32 @safePrefRead(i32 %0, i8* %9)
%22 = call i32 @infoUserPrints(i32 2, i8* %9)
%23 = call i32 @memset(i8* %9, i32 0, i32 513)
%24 = call i32 @safePrefRead(i32 %0, i8* %9)
%25 = call i32 @infoUserPrints(i32 3, i8* %9)
%26 = call i32 @memset(i8* %9, i32 0, i32 513)
%27 = call i32 @safePrefRead(i32 %0, i8* %9)
%28 = call i32 @infoUserPrints(i32 4, i8* %9)
%29 = call i32 @memset(i8* %9, i32 0, i32 513)
%30 = call i32 @safePrefRead(i32 %0, i8* %9)
%31 = call i32 @infoUserPrints(i32 5, i8* %9)
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str.7, i64 0, i64 0))
%33 = call i32 @safeRead(i32 %0, i32* %3, i32 4)
%34 = load i32, i32* %3
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* %1, i32 %34)
%36 = load i32, i32* %3
%37 = icmp sgt i32 %36, 0
br i1 %37, label %38, label %60
38: ; preds = %2, %56
%39 = phi i32 [ %57, %56 ], [ 0, %2 ]
%40 = call i32 @memset(i8* %12, i32 0, i32 33)
%41 = call i32 @memset(i8* %9, i32 0, i32 513)
%42 = call i32 @memset(i8* %10, i32 0, i32 5)
%43 = call i32 @memset(i8* %11, i32 0, i32 33)
%44 = call i32 @safePrefRead(i32 %0, i8* %12)
%45 = call i32 @safePrefRead(i32 %0, i8* %9)
%46 = call i32 @safePrefRead(i32 %0, i8* %10)
%47 = call i32 @safePrefRead(i32 %0, i8* %11)
%48 = call i32 @atoi(i8* %10)
%49 = add i32 %48, -1
%50 = icmp ult i32 %49, 3
br i1 %50, label %51, label %56
51: ; preds = %38
%52 = sext i32 %49 to i64
%53 = shl i64 %52, 2
%54 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.userPrints to i8*), i64 %53)
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %54, i8* %12, i8* %11, i8* %9)
br label %56
56: ; preds = %38, %51
%57 = add nuw nsw i32 %39, 1
%58 = load i32, i32* %3
%59 = icmp slt i32 %57, %58
br i1 %59, label %38, label %60
60: ; preds = %56, %2
%61 = call i32 @putchar(i32 10)
ret void
}