#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 *ReadLines(char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ puts(char *);
int spam_points(char *);
int main() {
  char *p = ReadLines("log1");
  int points = spam_points(p);
  if (points >= 20) {
    puts("High level of spam rank");
  } else if (points > 10) {
    puts("Medium level of spam rank");
  } else if (points < 10) {
    puts("Low level of spam rank");
  }
  if (p != NULL) {
    free(p);
    p = NULL;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <ReadLines@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <spam_points@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x14,-0x14(%rbp)
jl     1186 <main+0x46>
lea    0xe89(%rip),%rdi
call   1050 <puts@plt>
jmp    11c1 <main+0x81>
cmpl   $0xa,-0x14(%rbp)
jle    11a1 <main+0x61>
lea    0xe86(%rip),%rdi
call   1050 <puts@plt>
jmp    11bc <main+0x7c>
cmpl   $0xa,-0x14(%rbp)
jge    11b7 <main+0x77>
lea    0xe85(%rip),%rdi
call   1050 <puts@plt>
jmp    11bc <main+0x7c>
jmp    11c1 <main+0x81>
cmpq   $0x0,-0x10(%rbp)
je     11dd <main+0x9d>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x10(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rdi
call   1040 <ReadLines@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <spam_points@plt>
cmp    $0x13,%eax
jle    1166 <main+0x26>
lea    0xea1(%rip),%rdi
jmp    117d <main+0x3d>
cmp    $0xa,%eax
jle    1174 <main+0x34>
lea    0xeab(%rip),%rdi
jmp    117d <main+0x3d>
je     1182 <main+0x42>
lea    0xeba(%rip),%rdi
call   1050 <puts@plt>
test   %rbx,%rbx
je     118f <main+0x4f>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"log1\00"
@.str.1 = [24 x i8] c"High level of spam rank\00"
@.str.2 = [26 x i8] c"Medium level of spam rank\00"
@.str.3 = [23 x i8] c"Low level of spam rank\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i8* @ReadLines(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @spam_points(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp sge i32 %7, 20
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @puts(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %23
11: ; preds = %0
%12 = load i32, i32* %3
%13 = icmp sgt i32 %12, 10
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %22
16: ; preds = %11
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 10
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %21
21: ; preds = %19, %16
br label %22
22: ; preds = %21, %14
br label %23
23: ; preds = %22, %9
%24 = load i8*, i8** %2
%25 = icmp ne i8* %24, null
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i8*, i8** %2
%28 = call i32 @free(i8* %27)
store i8* null, i8** %2
br label %29
29: ; preds = %26, %23
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"log1\00"
@.str.1 = [24 x i8] c"High level of spam rank\00"
@.str.2 = [26 x i8] c"Medium level of spam rank\00"
@.str.3 = [23 x i8] c"Low level of spam rank\00"
define i32 @main() {
%1 = tail call i8* @ReadLines(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @spam_points(i8* %1)
%3 = icmp sgt i32 %2, 19
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = icmp sgt i32 %2, 10
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = icmp eq i32 %2, 10
br i1 %7, label %11, label %8
8: ; preds = %6, %4, %0
%9 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %6 ]
%10 = tail call i32 @puts(i8* dereferenceable(1) %9)
br label %11
11: ; preds = %8, %6
%12 = icmp eq i8* %1, null
br i1 %12, label %15, label %13
13: ; preds = %11
%14 = tail call i32 @free(i8* %1)
br label %15
15: ; preds = %13, %11
ret i32 0
}