#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 */
char *Create_Campaign_Aircraft(int);
char *Create_Campaign_Arrive_Objective(int, int);
char *Create_Campaign_Description(int);
int /*<<< orphan*/ *Create_Campaign_File();
char *Create_Campaign_Pickup_Objective(int);
char *Create_Campaign_Scenery();
int Create_Campaign_Start_Point();
char *Create_Campaign_Weather();
char *Get_Location_Symbol(int);
char *Place_Campaign_Humans(int, int *);
char *Place_Campaign_Ship();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int rand();
int Create_Campaign() {
  FILE *camp_file;
  char *objective_string, *temp_string;
  int start_point;
  int objective_type, all_arrivals = 1;
  int number_of_objectives;
  int done_description = 0;
  int destination[5];
  int count;
  camp_file = Create_Campaign_File();
  if (!camp_file)
    return 0;
  memset(destination, 0, 5 * sizeof(int));
  start_point = Create_Campaign_Start_Point();
  number_of_objectives = (rand() % 3) + 3;
  count = 0;
  while (count < number_of_objectives) {
    if (count < (number_of_objectives - 1))
      objective_type = rand() % 2;
    else
      objective_type = 0;
    if (objective_type == 0) {
      int done;
      int temp_place;
      do {
        temp_place = (rand() % 5) + 1;
        if ((count == 0) && (temp_place == start_point))
          done = 0;
        else if ((count > 0) && (temp_place == destination[count - 1]))
          done = 0;
        else
          done = 1;
      } while (!done);
      destination[count] = temp_place;
    } else
      destination[count] = 6;
    count++;
  }
  count = 0;
  while (count < number_of_objectives) {
    if (destination[count] == 6) {
      objective_string =
          Create_Campaign_Pickup_Objective(destination[count + 1]);
      all_arrivals = 0;
    } else
      objective_string = Create_Campaign_Arrive_Objective(
          destination[count], destination[count + 1]);
    if (!done_description) {
      temp_string = Create_Campaign_Description(destination[0]);
      if (temp_string) {
        fprintf(camp_file, "%s\n", temp_string);
        free(temp_string);
      }
      temp_string = Create_Campaign_Weather();
      if (temp_string) {
        fprintf(camp_file, "%s\n", temp_string);
        free(temp_string);
      }
      temp_string = Create_Campaign_Scenery();
      if (temp_string) {
        fprintf(camp_file, "%s\n", temp_string);
        free(temp_string);
      }
      temp_string = Place_Campaign_Ship();
      if (temp_string) {
        fprintf(camp_file, "%s\n", temp_string);
        free(temp_string);
      }
      temp_string = Get_Location_Symbol(start_point);
      if (temp_string) {
        fprintf(camp_file, "mission_begin_at %s\n", temp_string);
        free(temp_string);
      }
      done_description = 1;
    }
    if (objective_string) {
      fprintf(camp_file, "%s\n", objective_string);
      free(objective_string);
    }
    count++;
  }
  temp_string = Place_Campaign_Humans(start_point, destination);
  if (temp_string) {
    fprintf(camp_file, "%s\n", temp_string);
    free(temp_string);
  }
  temp_string = Create_Campaign_Aircraft(all_arrivals);
  if (temp_string) {
    fprintf(camp_file, "%s\n", temp_string);
    free(temp_string);
  }
  fclose(camp_file);
  return 1;
}


x86 assembly (clang, -O0):
<Create_Campaign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x1,-0x2c(%rbp)
movl   $0x0,-0x34(%rbp)
mov    $0x0,%al
call   1100 <Create_Campaign_File@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1238 <Create_Campaign+0x38>
movl   $0x0,-0x4(%rbp)
jmp    158b <Create_Campaign+0x38b>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
mov    $0x0,%al
call   1090 <Create_Campaign_Start_Point@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
add    $0x3,%edx
mov    %edx,-0x30(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1367 <Create_Campaign+0x167>
mov    -0x54(%rbp),%eax
mov    -0x30(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12a2 <Create_Campaign+0xa2>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0x28(%rbp)
jmp    12a9 <Create_Campaign+0xa9>
movl   $0x0,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    134d <Create_Campaign+0x14d>
jmp    12b8 <Create_Campaign+0xb8>
mov    $0x0,%al
call   1120 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x5c(%rbp)
cmpl   $0x0,-0x54(%rbp)
jne    12ef <Create_Campaign+0xef>
mov    -0x5c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    12ef <Create_Campaign+0xef>
movl   $0x0,-0x58(%rbp)
jmp    1327 <Create_Campaign+0x127>
cmpl   $0x0,-0x54(%rbp)
jle    131b <Create_Campaign+0x11b>
mov    -0x5c(%rbp),%eax
mov    -0x54(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
jne    131b <Create_Campaign+0x11b>
movl   $0x0,-0x58(%rbp)
jmp    1322 <Create_Campaign+0x122>
movl   $0x1,-0x58(%rbp)
jmp    1327 <Create_Campaign+0x127>
jmp    132c <Create_Campaign+0x12c>
cmpl   $0x0,-0x58(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12b8 <Create_Campaign+0xb8>
mov    -0x5c(%rbp),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x50(%rbp,%rax,4)
jmp    1359 <Create_Campaign+0x159>
movslq -0x54(%rbp),%rax
movl   $0x6,-0x50(%rbp,%rax,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    126e <Create_Campaign+0x6e>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    150f <Create_Campaign+0x30f>
movslq -0x54(%rbp),%rax
cmpl   $0x6,-0x50(%rbp,%rax,4)
jne    13aa <Create_Campaign+0x1aa>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%edi
call   10d0 <Create_Campaign_Pickup_Objective@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
jmp    13c7 <Create_Campaign+0x1c7>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%edi
mov    -0x54(%rbp),%eax
add    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,4),%esi
call   10a0 <Create_Campaign_Arrive_Objective@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x34(%rbp)
jne    14d9 <Create_Campaign+0x2d9>
mov    -0x50(%rbp),%edi
call   10c0 <Create_Campaign_Description@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1405 <Create_Campaign+0x205>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xc1a(%rip),%rsi
call   10e0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <Create_Campaign_Weather@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1438 <Create_Campaign+0x238>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xbe7(%rip),%rsi
call   10e0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1110 <Create_Campaign_Scenery@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     146b <Create_Campaign+0x26b>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xbb4(%rip),%rsi
call   10e0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1050 <Place_Campaign_Ship@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     149e <Create_Campaign+0x29e>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xb81(%rip),%rsi
call   10e0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%edi
call   1070 <Get_Location_Symbol@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     14d2 <Create_Campaign+0x2d2>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xb3c(%rip),%rsi
call   10e0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x34(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1501 <Create_Campaign+0x301>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xb1e(%rip),%rsi
call   10e0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    136e <Create_Campaign+0x16e>
mov    -0x24(%rbp),%edi
lea    -0x50(%rbp),%rsi
call   10f0 <Place_Campaign_Humans@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1547 <Create_Campaign+0x347>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xad8(%rip),%rsi
call   10e0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x2c(%rbp),%edi
call   1080 <Create_Campaign_Aircraft@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     157b <Create_Campaign+0x37b>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xaa4(%rip),%rsi
call   10e0 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1060 <fclose@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Create_Campaign>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   1100 <Create_Campaign_File@plt>
test   %rax,%rax
je     14cc <Create_Campaign+0x2cc>
mov    %rax,%r15
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
xor    %eax,%eax
call   1090 <Create_Campaign_Start_Point@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   1120 <rand@plt>
cltq
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %eax,%r13d
sub    %ecx,%r13d
add    $0x3,%r13d
neg    %ecx
lea    (%rax,%rcx,1),%r14d
add    $0x2,%r14d
xor    %ebx,%ebx
jmp    128d <Create_Campaign+0x8d>
cs nopw 0x0(%rax,%rax,1)
mov    %ecx,0x10(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    %r13,%rbx
je     12ee <Create_Campaign+0xee>
cmp    %r14,%rbx
jae    12a2 <Create_Campaign+0xa2>
xor    %eax,%eax
call   1120 <rand@plt>
mov    $0x6,%ecx
test   $0x1,%al
jne    1280 <Create_Campaign+0x80>
lea    -0x1(%rbx),%ebp
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1120 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
add    %eax,%ecx
add    $0x1,%ecx
test   %rbx,%rbx
jne    12e1 <Create_Campaign+0xe1>
cmp    %r12d,%ecx
je     12b0 <Create_Campaign+0xb0>
test   %rbx,%rbx
je     1280 <Create_Campaign+0x80>
cmp    0x10(%rsp,%rbp,4),%ecx
je     12b0 <Create_Campaign+0xb0>
jmp    1280 <Create_Campaign+0x80>
cmp    $0x2,%r13d
mov    $0x1,%eax
movl   $0x1,0xc(%rsp)
cmovl  %eax,%r13d
mov    %r13,0x30(%rsp)
mov    $0x1,%bl
lea    0xd00(%rip),%rbp
xor    %r13d,%r13d
mov    %r15,%r14
mov    %rbp,%r15
jmp    1331 <Create_Campaign+0x131>
nopl   0x0(%rax)
add    $0x1,%r13
xor    %ebx,%ebx
cmp    %r13,0x30(%rsp)
je     1465 <Create_Campaign+0x265>
mov    0x10(%rsp,%r13,4),%edi
mov    0x14(%rsp,%r13,4),%esi
cmp    $0x6,%edi
jne    1360 <Create_Campaign+0x160>
mov    %esi,%edi
call   10d0 <Create_Campaign_Pickup_Objective@plt>
mov    %rax,%rbp
movl   $0x0,0xc(%rsp)
test   $0x1,%bl
jne    1371 <Create_Campaign+0x171>
jmp    1441 <Create_Campaign+0x241>
nopl   0x0(%rax)
call   10a0 <Create_Campaign_Arrive_Objective@plt>
mov    %rax,%rbp
test   $0x1,%bl
je     1441 <Create_Campaign+0x241>
mov    %rbp,0x28(%rsp)
mov    %r15,%rbp
mov    0x10(%rsp),%edi
call   10c0 <Create_Campaign_Description@plt>
test   %rax,%rax
je     13a0 <Create_Campaign+0x1a0>
mov    %rax,%r15
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1040 <Create_Campaign_Weather@plt>
test   %rax,%rax
mov    %rbp,%r15
je     13c8 <Create_Campaign+0x1c8>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1110 <Create_Campaign_Scenery@plt>
test   %rax,%rax
mov    0x28(%rsp),%rbp
je     13f2 <Create_Campaign+0x1f2>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1050 <Place_Campaign_Ship@plt>
test   %rax,%rax
je     1417 <Create_Campaign+0x217>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r12d,%edi
call   1070 <Get_Location_Symbol@plt>
test   %rax,%rax
je     1441 <Create_Campaign+0x241>
mov    %rax,%rbx
mov    %r14,%rdi
lea    0xbcf(%rip),%rsi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
test   %rbp,%rbp
je     1320 <Create_Campaign+0x120>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   10e0 <fprintf@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
jmp    1320 <Create_Campaign+0x120>
lea    0x10(%rsp),%rsi
mov    %r12d,%edi
call   10f0 <Place_Campaign_Humans@plt>
test   %rax,%rax
je     1494 <Create_Campaign+0x294>
mov    %rax,%rbx
lea    0xb90(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0xc(%rsp),%edi
call   1080 <Create_Campaign_Aircraft@plt>
test   %rax,%rax
je     14bf <Create_Campaign+0x2bf>
mov    %rax,%rbx
lea    0xb65(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   10e0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [21 x i8] c"mission_begin_at %s\0A\00"
define i32 @Create_Campaign() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [5 x i32]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 1, i32* %7
store i32 0, i32* %9
%14 = call i32* (...) @Create_Campaign_File()
store i32* %14, i32** %2
%15 = load i32*, i32** %2
%16 = icmp ne i32* %15, null
br i1 %16, label %18, label %17
17: ; preds = %0
store i32 0, i32* %1
br label %208
18: ; preds = %0
%19 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%20 = call i32 @memset(i32* %19, i32 0, i32 20)
%21 = call i32 (...) @Create_Campaign_Start_Point()
store i32 %21, i32* %5
%22 = call i32 (...) @rand()
%23 = srem i32 %22, 3
%24 = add nsw i32 %23, 3
store i32 %24, i32* %8
store i32 0, i32* %11
br label %25
25: ; preds = %81, %18
%26 = load i32, i32* %11
%27 = load i32, i32* %8
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %84
29: ; preds = %25
%30 = load i32, i32* %11
%31 = load i32, i32* %8
%32 = sub nsw i32 %31, 1
%33 = icmp slt i32 %30, %32
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = call i32 (...) @rand()
%36 = srem i32 %35, 2
store i32 %36, i32* %6
br label %38
37: ; preds = %29
store i32 0, i32* %6
br label %38
38: ; preds = %37, %34
%39 = load i32, i32* %6
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %77
41: ; preds = %38
br label %42
42: ; preds = %68, %41
%43 = call i32 (...) @rand()
%44 = srem i32 %43, 5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %13
%46 = load i32, i32* %11
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %42
%49 = load i32, i32* %13
%50 = load i32, i32* %5
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %53
52: ; preds = %48
store i32 0, i32* %12
br label %67
53: ; preds = %48, %42
%54 = load i32, i32* %11
%55 = icmp sgt i32 %54, 0
br i1 %55, label %56, label %65
56: ; preds = %53
%57 = load i32, i32* %13
%58 = load i32, i32* %11
%59 = sub nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %60
%62 = load i32, i32* %61
%63 = icmp eq i32 %57, %62
br i1 %63, label %64, label %65
64: ; preds = %56
store i32 0, i32* %12
br label %66
65: ; preds = %56, %53
store i32 1, i32* %12
br label %66
66: ; preds = %65, %64
br label %67
67: ; preds = %66, %52
br label %68
68: ; preds = %67
%69 = load i32, i32* %12
%70 = icmp ne i32 %69, 0
%71 = xor i1 %70, true
br i1 %71, label %42, label %72
72: ; preds = %68
%73 = load i32, i32* %13
%74 = load i32, i32* %11
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %75
store i32 %73, i32* %76
br label %81
77: ; preds = %38
%78 = load i32, i32* %11
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %79
store i32 6, i32* %80
br label %81
81: ; preds = %77, %72
%82 = load i32, i32* %11
%83 = add nsw i32 %82, 1
store i32 %83, i32* %11
br label %25
84: ; preds = %25
store i32 0, i32* %11
br label %85
85: ; preds = %179, %84
%86 = load i32, i32* %11
%87 = load i32, i32* %8
%88 = icmp slt i32 %86, %87
br i1 %88, label %89, label %182
89: ; preds = %85
%90 = load i32, i32* %11
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %91
%93 = load i32, i32* %92
%94 = icmp eq i32 %93, 6
br i1 %94, label %95, label %102
95: ; preds = %89
%96 = load i32, i32* %11
%97 = add nsw i32 %96, 1
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %98
%100 = load i32, i32* %99
%101 = call i8* @Create_Campaign_Pickup_Objective(i32 %100)
store i8* %101, i8** %3
store i32 0, i32* %7
br label %113
102: ; preds = %89
%103 = load i32, i32* %11
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %104
%106 = load i32, i32* %105
%107 = load i32, i32* %11
%108 = add nsw i32 %107, 1
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 %109
%111 = load i32, i32* %110
%112 = call i8* @Create_Campaign_Arrive_Objective(i32 %106, i32 %111)
store i8* %112, i8** %3
br label %113
113: ; preds = %102, %95
%114 = load i32, i32* %9
%115 = icmp ne i32 %114, 0
br i1 %115, label %170, label %116
116: ; preds = %113
%117 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%118 = load i32, i32* %117
%119 = call i8* @Create_Campaign_Description(i32 %118)
store i8* %119, i8** %4
%120 = load i8*, i8** %4
%121 = icmp ne i8* %120, null
br i1 %121, label %122, label %128
122: ; preds = %116
%123 = load i32*, i32** %2
%124 = load i8*, i8** %4
%125 = call i32 @fprintf(i32* %123, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %124)
%126 = load i8*, i8** %4
%127 = call i32 @free(i8* %126)
br label %128
128: ; preds = %122, %116
%129 = call i8* (...) @Create_Campaign_Weather()
store i8* %129, i8** %4
%130 = load i8*, i8** %4
%131 = icmp ne i8* %130, null
br i1 %131, label %132, label %138
132: ; preds = %128
%133 = load i32*, i32** %2
%134 = load i8*, i8** %4
%135 = call i32 @fprintf(i32* %133, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %134)
%136 = load i8*, i8** %4
%137 = call i32 @free(i8* %136)
br label %138
138: ; preds = %132, %128
%139 = call i8* (...) @Create_Campaign_Scenery()
store i8* %139, i8** %4
%140 = load i8*, i8** %4
%141 = icmp ne i8* %140, null
br i1 %141, label %142, label %148
142: ; preds = %138
%143 = load i32*, i32** %2
%144 = load i8*, i8** %4
%145 = call i32 @fprintf(i32* %143, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %144)
%146 = load i8*, i8** %4
%147 = call i32 @free(i8* %146)
br label %148
148: ; preds = %142, %138
%149 = call i8* (...) @Place_Campaign_Ship()
store i8* %149, i8** %4
%150 = load i8*, i8** %4
%151 = icmp ne i8* %150, null
br i1 %151, label %152, label %158
152: ; preds = %148
%153 = load i32*, i32** %2
%154 = load i8*, i8** %4
%155 = call i32 @fprintf(i32* %153, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %154)
%156 = load i8*, i8** %4
%157 = call i32 @free(i8* %156)
br label %158
158: ; preds = %152, %148
%159 = load i32, i32* %5
%160 = call i8* @Get_Location_Symbol(i32 %159)
store i8* %160, i8** %4
%161 = load i8*, i8** %4
%162 = icmp ne i8* %161, null
br i1 %162, label %163, label %169
163: ; preds = %158
%164 = load i32*, i32** %2
%165 = load i8*, i8** %4
%166 = call i32 @fprintf(i32* %164, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %165)
%167 = load i8*, i8** %4
%168 = call i32 @free(i8* %167)
br label %169
169: ; preds = %163, %158
store i32 1, i32* %9
br label %170
170: ; preds = %169, %113
%171 = load i8*, i8** %3
%172 = icmp ne i8* %171, null
br i1 %172, label %173, label %179
173: ; preds = %170
%174 = load i32*, i32** %2
%175 = load i8*, i8** %3
%176 = call i32 @fprintf(i32* %174, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %175)
%177 = load i8*, i8** %3
%178 = call i32 @free(i8* %177)
br label %179
179: ; preds = %173, %170
%180 = load i32, i32* %11
%181 = add nsw i32 %180, 1
store i32 %181, i32* %11
br label %85
182: ; preds = %85
%183 = load i32, i32* %5
%184 = getelementptr inbounds [5 x i32], [5 x i32]* %10, i64 0, i64 0
%185 = call i8* @Place_Campaign_Humans(i32 %183, i32* %184)
store i8* %185, i8** %4
%186 = load i8*, i8** %4
%187 = icmp ne i8* %186, null
br i1 %187, label %188, label %194
188: ; preds = %182
%189 = load i32*, i32** %2
%190 = load i8*, i8** %4
%191 = call i32 @fprintf(i32* %189, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %190)
%192 = load i8*, i8** %4
%193 = call i32 @free(i8* %192)
br label %194
194: ; preds = %188, %182
%195 = load i32, i32* %7
%196 = call i8* @Create_Campaign_Aircraft(i32 %195)
store i8* %196, i8** %4
%197 = load i8*, i8** %4
%198 = icmp ne i8* %197, null
br i1 %198, label %199, label %205
199: ; preds = %194
%200 = load i32*, i32** %2
%201 = load i8*, i8** %4
%202 = call i32 @fprintf(i32* %200, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %201)
%203 = load i8*, i8** %4
%204 = call i32 @free(i8* %203)
br label %205
205: ; preds = %199, %194
%206 = load i32*, i32** %2
%207 = call i32 @fclose(i32* %206)
store i32 1, i32* %1
br label %208
208: ; preds = %205, %17
%209 = load i32, i32* %1
ret i32 %209
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [21 x i8] c"mission_begin_at %s\0A\00"
define i32 @Create_Campaign() {
%1 = alloca [5 x i32]
%2 = bitcast [5 x i32]* %1 to i8*
%3 = tail call i32* (...) @Create_Campaign_File()
%4 = icmp eq i32* %3, null
br i1 %4, label %116, label %5
5: ; preds = %0
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%7 = call i32 @memset(i32* %6, i32 0, i32 20)
%8 = call i32 (...) @Create_Campaign_Start_Point()
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 3
%11 = add nsw i32 %10, 3
%12 = add nsw i32 %10, 2
%13 = zext i32 %12 to i64
%14 = zext i32 %11 to i64
br label %18
15: ; preds = %41
%16 = call i32 @llvm.smax.i32(i32 %11, i32 1)
%17 = zext i32 %16 to i64
br label %46
18: ; preds = %5, %41
%19 = phi i64 [ 0, %5 ], [ %44, %41 ]
%20 = icmp ult i64 %19, %13
br i1 %20, label %21, label %25
21: ; preds = %18
%22 = call i32 (...) @rand()
%23 = and i32 %22, 1
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %41
25: ; preds = %18, %21
%26 = add nuw i64 %19, 4294967295
%27 = and i64 %26, 4294967295
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %27
%29 = icmp eq i64 %19, 0
br label %30
30: ; preds = %40, %25
%31 = call i32 (...) @rand()
%32 = srem i32 %31, 5
%33 = add nsw i32 %32, 1
%34 = icmp eq i32 %33, %8
%35 = select i1 %29, i1 %34, i1 false
br i1 %35, label %40, label %36
36: ; preds = %30
br i1 %29, label %41, label %37
37: ; preds = %36
%38 = load i32, i32* %28
%39 = icmp eq i32 %33, %38
br i1 %39, label %40, label %41
40: ; preds = %37, %30
br label %30
41: ; preds = %37, %36, %21
%42 = phi i32 [ 6, %21 ], [ %33, %36 ], [ %33, %37 ]
%43 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %19
store i32 %42, i32* %43
%44 = add nuw nsw i64 %19, 1
%45 = icmp eq i64 %44, %14
br i1 %45, label %15, label %18
46: ; preds = %15, %99
%47 = phi i64 [ 0, %15 ], [ %100, %99 ]
%48 = phi i1 [ true, %15 ], [ false, %99 ]
%49 = phi i32 [ 1, %15 ], [ %61, %99 ]
%50 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %47
%51 = load i32, i32* %50
%52 = icmp eq i32 %51, 6
%53 = add nuw nsw i64 %47, 1
%54 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %53
%55 = load i32, i32* %54
br i1 %52, label %56, label %58
56: ; preds = %46
%57 = call i8* @Create_Campaign_Pickup_Objective(i32 %55)
br label %60
58: ; preds = %46
%59 = call i8* @Create_Campaign_Arrive_Objective(i32 %51, i32 %55)
br label %60
60: ; preds = %58, %56
%61 = phi i32 [ 0, %56 ], [ %49, %58 ]
%62 = phi i8* [ %57, %56 ], [ %59, %58 ]
br i1 %48, label %63, label %94
63: ; preds = %60
%64 = load i32, i32* %6
%65 = call i8* @Create_Campaign_Description(i32 %64)
%66 = icmp eq i8* %65, null
br i1 %66, label %70, label %67
67: ; preds = %63
%68 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %65)
%69 = call i32 @free(i8* %65)
br label %70
70: ; preds = %67, %63
%71 = call i8* (...) @Create_Campaign_Weather()
%72 = icmp eq i8* %71, null
br i1 %72, label %76, label %73
73: ; preds = %70
%74 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %71)
%75 = call i32 @free(i8* %71)
br label %76
76: ; preds = %73, %70
%77 = call i8* (...) @Create_Campaign_Scenery()
%78 = icmp eq i8* %77, null
br i1 %78, label %82, label %79
79: ; preds = %76
%80 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %77)
%81 = call i32 @free(i8* %77)
br label %82
82: ; preds = %79, %76
%83 = call i8* (...) @Place_Campaign_Ship()
%84 = icmp eq i8* %83, null
br i1 %84, label %88, label %85
85: ; preds = %82
%86 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %83)
%87 = call i32 @free(i8* %83)
br label %88
88: ; preds = %85, %82
%89 = call i8* @Get_Location_Symbol(i32 %8)
%90 = icmp eq i8* %89, null
br i1 %90, label %94, label %91
91: ; preds = %88
%92 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %89)
%93 = call i32 @free(i8* %89)
br label %94
94: ; preds = %88, %91, %60
%95 = icmp eq i8* %62, null
br i1 %95, label %99, label %96
96: ; preds = %94
%97 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %62)
%98 = call i32 @free(i8* %62)
br label %99
99: ; preds = %96, %94
%100 = add nuw nsw i64 %47, 1
%101 = icmp eq i64 %100, %17
br i1 %101, label %102, label %46
102: ; preds = %99
%103 = call i8* @Place_Campaign_Humans(i32 %8, i32* %6)
%104 = icmp eq i8* %103, null
br i1 %104, label %108, label %105
105: ; preds = %102
%106 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %103)
%107 = call i32 @free(i8* %103)
br label %108
108: ; preds = %105, %102
%109 = call i8* @Create_Campaign_Aircraft(i32 %61)
%110 = icmp eq i8* %109, null
br i1 %110, label %114, label %111
111: ; preds = %108
%112 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %109)
%113 = call i32 @free(i8* %109)
br label %114
114: ; preds = %111, %108
%115 = call i32 @fclose(i32* %3)
br label %116
116: ; preds = %0, %114
%117 = phi i32 [ 1, %114 ], [ 0, %0 ]
ret i32 %117
}