#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 */
char *get_stats(short);
int /*<<< orphan*/ sscanf(char *, char *, unsigned long *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void get_mail_stats(short dropping_id, unsigned long *readers, char *str1,
                    char *str2) {
  char mail_stats[(26) + 1];
  int i;
  strcpy(mail_stats, get_stats(dropping_id));
  for (i = 0; mail_stats[i] != '\0'; i++) {
    switch (mail_stats[i]) {
    case '*':
      if (mail_stats[i + 1] == '?' || mail_stats[i - 1] == '?')
        break;
    case 'I':
    case 'P':
    case 'p':
      mail_stats[i] = ' ';
      break;
    }
  }
  sscanf(mail_stats, "%lu %s %s", readers, str1, str2);
  if (strcmp(str1, "ACC") == 0)
    strcpy(str1, "-");
}


x86 assembly (clang, -O0):
<get_mail_stats>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x50(%rbp)
movswl -0x2(%rbp),%edi
call   1050 <get_stats@plt>
mov    -0x50(%rbp),%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x44(%rbp)
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x0,%eax
je     1230 <get_mail_stats+0xf0>
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
mov    %eax,-0x54(%rbp)
sub    $0x2a,%eax
je     11de <get_mail_stats+0x9e>
jmp    11ab <get_mail_stats+0x6b>
mov    -0x54(%rbp),%eax
sub    $0x49,%eax
je     1214 <get_mail_stats+0xd4>
jmp    11bc <get_mail_stats+0x7c>
mov    -0x54(%rbp),%eax
sub    $0x50,%eax
je     1214 <get_mail_stats+0xd4>
jmp    11cd <get_mail_stats+0x8d>
mov    -0x54(%rbp),%eax
sub    $0x70,%eax
je     1214 <get_mail_stats+0xd4>
jmp    121d <get_mail_stats+0xdd>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x3f,%eax
je     120a <get_mail_stats+0xca>
mov    -0x44(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x3f,%eax
jne    120f <get_mail_stats+0xcf>
jmp    121d <get_mail_stats+0xdd>
jmp    1214 <get_mail_stats+0xd4>
movslq -0x44(%rbp),%rax
movb   $0x20,-0x40(%rbp,%rax,1)
jmp    1222 <get_mail_stats+0xe2>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    117f <get_mail_stats+0x3f>
lea    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xdb9(%rip),%rsi
call   1060 <sscanf@plt>
mov    -0x18(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1276 <get_mail_stats+0x136>
mov    -0x18(%rbp),%rdi
lea    0xd9d(%rip),%rsi
call   1030 <strcpy@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mail_stats>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
call   1050 <get_stats@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <strcpy@plt>
mov    (%rsp),%dl
test   %dl,%dl
je     11bc <get_mail_stats+0x7c>
mov    $0x1,%eax
movabs $0x8000000081,%rcx
jmp    119b <get_mail_stats+0x5b>
nop
bt     %rsi,%rcx
jae    11a6 <get_mail_stats+0x66>
movb   $0x20,(%rbx)
mov    %eax,%edx
lea    (%rsp,%rdx,1),%rbx
movzbl (%rsp,%rdx,1),%edx
add    $0x1,%rax
test   %dl,%dl
je     11bc <get_mail_stats+0x7c>
movsbl %dl,%edx
lea    -0x49(%rdx),%esi
cmp    $0x27,%esi
jbe    1180 <get_mail_stats+0x40>
cmp    $0x2a,%edx
jne    1189 <get_mail_stats+0x49>
mov    %eax,%edx
cmpb   $0x3f,(%rsp,%rdx,1)
je     1189 <get_mail_stats+0x49>
cmpb   $0x3f,-0x2(%rsp,%rax,1)
jne    1186 <get_mail_stats+0x46>
jmp    1189 <get_mail_stats+0x49>
lea    0xe3d(%rip),%rsi
mov    %rsp,%rdi
mov    %r15,%rdx
mov    %r12,%rcx
mov    %r14,%r8
call   1060 <sscanf@plt>
lea    0xe2f(%rip),%rsi
mov    %r12,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    11f7 <get_mail_stats+0xb7>
lea    0xe1f(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcpy@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%lu %s %s\00"
@.str.1 = [4 x i8] c"ACC\00"
@.str.2 = [2 x i8] c"-\00"
define void @get_mail_stats(i16 signext %0, i64* %1, i8* %2, i8* %3) {
%5 = alloca i16
%6 = alloca i64*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [27 x i8]
%10 = alloca i32
store i16 %0, i16* %5
store i64* %1, i64** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = getelementptr inbounds [27 x i8], [27 x i8]* %9, i64 0, i64 0
%12 = load i16, i16* %5
%13 = call i8* @get_stats(i16 signext %12)
%14 = call i32 @strcpy(i8* %11, i8* %13)
store i32 0, i32* %10
br label %15
15: ; preds = %51, %4
%16 = load i32, i32* %10
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [27 x i8], [27 x i8]* %9, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %54
22: ; preds = %15
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [27 x i8], [27 x i8]* %9, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
switch i32 %27, label %50 [
i32 42, label %28
i32 73, label %46
i32 80, label %46
i32 112, label %46
]
28: ; preds = %22
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [27 x i8], [27 x i8]* %9, i64 0, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 63
br i1 %35, label %44, label %36
36: ; preds = %28
%37 = load i32, i32* %10
%38 = sub nsw i32 %37, 1
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [27 x i8], [27 x i8]* %9, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 63
br i1 %43, label %44, label %45
44: ; preds = %36, %28
br label %50
45: ; preds = %36
br label %46
46: ; preds = %22, %22, %22, %45
%47 = load i32, i32* %10
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [27 x i8], [27 x i8]* %9, i64 0, i64 %48
store i8 32, i8* %49
br label %50
50: ; preds = %22, %46, %44
br label %51
51: ; preds = %50
%52 = load i32, i32* %10
%53 = add nsw i32 %52, 1
store i32 %53, i32* %10
br label %15
54: ; preds = %15
%55 = getelementptr inbounds [27 x i8], [27 x i8]* %9, i64 0, i64 0
%56 = load i64*, i64** %6
%57 = load i8*, i8** %7
%58 = load i8*, i8** %8
%59 = call i32 @sscanf(i8* %55, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64* %56, i8* %57, i8* %58)
%60 = load i8*, i8** %7
%61 = call i64 @strcmp(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %54
%64 = load i8*, i8** %7
%65 = call i32 @strcpy(i8* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %66
66: ; preds = %63, %54
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%lu %s %s\00"
@.str.1 = [4 x i8] c"ACC\00"
@.str.2 = [2 x i8] c"-\00"
define void @get_mail_stats(i16 signext %0, i64* %1, i8* %2, i8* %3) {
%5 = alloca [27 x i8]
%6 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 0
%7 = tail call i8* @get_stats(i16 signext %0)
%8 = call i32 @strcpy(i8* %6, i8* %7)
%9 = load i8, i8* %6
%10 = icmp eq i8 %9, 0
br i1 %10, label %34, label %11
11: ; preds = %4, %28
%12 = phi i64 [ %29, %28 ], [ 0, %4 ]
%13 = phi i8 [ %32, %28 ], [ %9, %4 ]
%14 = phi i8* [ %31, %28 ], [ %6, %4 ]
%15 = sext i8 %13 to i32
switch i32 %15, label %28 [
i32 42, label %16
i32 73, label %27
i32 80, label %27
i32 112, label %27
]
16: ; preds = %11
%17 = add i64 %12, 1
%18 = and i64 %17, 4294967295
%19 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 63
br i1 %21, label %28, label %22
22: ; preds = %16
%23 = add nsw i64 %12, -1
%24 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 63
br i1 %26, label %28, label %27
27: ; preds = %22, %11, %11, %11
store i8 32, i8* %14
br label %28
28: ; preds = %27, %11, %22, %16
%29 = add nuw i64 %12, 1
%30 = and i64 %29, 4294967295
%31 = getelementptr inbounds [27 x i8], [27 x i8]* %5, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %34, label %11
34: ; preds = %28, %4
%35 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i64* %1, i8* %2, i8* %3)
%36 = call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %34
%39 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %40
40: ; preds = %38, %34
ret void
}