#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void writePolicy(FILE *f, int isTransitive) {
  fprintf(f, "MSD\n");
  if (isTransitive)
    fprintf(f, "TRANSITIVE\n");
  else
    fprintf(f, "INTRANSITIVE\n");
  fprintf(f, "LVL 3\n");
  fprintf(f, "0 l\n");
  fprintf(f, "1 h\n");
  fprintf(f, "2 d\n");
  fprintf(f, "POLICY\n");
  fprintf(f, "0 TO 1\n");
  if (!isTransitive) {
    fprintf(f, "1 TO 2\n");
    fprintf(f, "2 TO 0\n");
  }
}


x86 assembly (clang, -O0):
<writePolicy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed6(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x0,-0xc(%rbp)
je     114e <writePolicy+0x3e>
mov    -0x8(%rbp),%rdi
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
jmp    115e <writePolicy+0x4e>
mov    -0x8(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1030 <fprintf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    11e8 <writePolicy+0xd8>
mov    -0x8(%rbp),%rdi
lea    0xe66(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writePolicy>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xee1(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
test   %ebp,%ebp
je     1143 <writePolicy+0x33>
lea    0xecb(%rip),%rdi
mov    $0xb,%esi
jmp    114f <writePolicy+0x3f>
lea    0xebb(%rip),%rdi
mov    $0xd,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xeb0(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xe9e(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xe8a(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xe76(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xe62(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xe51(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
test   %ebp,%ebp
je     11fd <writePolicy+0xed>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe35(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xe24(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fwrite@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"MSD\0A\00"
@.str.1 = [12 x i8] c"TRANSITIVE\0A\00"
@.str.2 = [14 x i8] c"INTRANSITIVE\0A\00"
@.str.3 = [7 x i8] c"LVL 3\0A\00"
@.str.4 = [5 x i8] c"0 l\0A\00"
@.str.5 = [5 x i8] c"1 h\0A\00"
@.str.6 = [5 x i8] c"2 d\0A\00"
@.str.7 = [8 x i8] c"POLICY\0A\00"
@.str.8 = [8 x i8] c"0 TO 1\0A\00"
@.str.9 = [8 x i8] c"1 TO 2\0A\00"
@.str.10 = [8 x i8] c"2 TO 0\0A\00"
define void @writePolicy(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32*, i32** %3
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %15
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %12, %9
%16 = load i32*, i32** %3
%17 = call i32 @fprintf(i32* %16, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32*, i32** %3
%19 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%20 = load i32*, i32** %3
%21 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%22 = load i32*, i32** %3
%23 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%24 = load i32*, i32** %3
%25 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%26 = load i32*, i32** %3
%27 = call i32 @fprintf(i32* %26, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%28 = load i32, i32* %4
%29 = icmp ne i32 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %15
%31 = load i32*, i32** %3
%32 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%33 = load i32*, i32** %3
%34 = call i32 @fprintf(i32* %33, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
br label %35
35: ; preds = %30, %15
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"MSD\0A\00"
@.str.1 = [12 x i8] c"TRANSITIVE\0A\00"
@.str.2 = [14 x i8] c"INTRANSITIVE\0A\00"
@.str.3 = [7 x i8] c"LVL 3\0A\00"
@.str.4 = [5 x i8] c"0 l\0A\00"
@.str.5 = [5 x i8] c"1 h\0A\00"
@.str.6 = [5 x i8] c"2 d\0A\00"
@.str.7 = [8 x i8] c"POLICY\0A\00"
@.str.8 = [8 x i8] c"0 TO 1\0A\00"
@.str.9 = [8 x i8] c"1 TO 2\0A\00"
@.str.10 = [8 x i8] c"2 TO 0\0A\00"
define void @writePolicy(i32* nocapture %0, i32 %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 4, i64 1, i32* %0)
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i64 11, i64 1, i32* %0)
br label %9
7: ; preds = %2
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i64 13, i64 1, i32* %0)
br label %9
9: ; preds = %7, %5
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 6, i64 1, i32* %0)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i64 4, i64 1, i32* %0)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 4, i64 1, i32* %0)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 4, i64 1, i32* %0)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0), i64 7, i64 1, i32* %0)
%15 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i64 7, i64 1, i32* %0)
br i1 %4, label %16, label %19
16: ; preds = %9
%17 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i64 7, i64 1, i32* %0)
%18 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0), i64 7, i64 1, i32* %0)
br label %19
19: ; preds = %16, %9
ret void
}