#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 */
struct mtwist_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ avoid(struct mtwist_state *);
char *be_advised(struct mtwist_state *);
int /*<<< orphan*/ break_lines(char *, int);
char *cease_fire(struct mtwist_state *);
char *destroyed(struct mtwist_state *);
char *get_lost(struct mtwist_state *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *, char *, char *,
                            char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
char toupper(char);
char *you_will_be(struct mtwist_state *);
void starbase_attack_warning(struct mtwist_state *mt, char *buffer, int buflen,
                             int line_len) {
  char do_avoid[100];
  strcpy(do_avoid, avoid(mt));
  do_avoid[0] = toupper(do_avoid[0]);
  snprintf(buffer, buflen, "%s %s and %s or %s %s\n", be_advised(mt),
           cease_fire(mt), get_lost(mt), you_will_be(mt), destroyed(mt));
  break_lines(buffer, line_len);
}


x86 assembly (clang, -O0):
<starbase_attack_warning>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0xb8(%rbp)
mov    -0x8(%rbp),%rdi
call   10a0 <avoid@plt>
mov    -0xb8(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
movsbl -0x80(%rbp),%edi
call   1040 <toupper@plt>
mov    %al,-0x80(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0xb0(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <be_advised@plt>
mov    %rax,-0xa0(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <cease_fire@plt>
mov    %rax,-0x98(%rbp)
mov    -0x8(%rbp),%rdi
call   10b0 <get_lost@plt>
mov    %rax,-0x90(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <you_will_be@plt>
mov    %rax,-0x88(%rbp)
mov    -0x8(%rbp),%rdi
call   1090 <destroyed@plt>
mov    -0xb0(%rbp),%rdi
mov    -0xa4(%rbp),%esi
mov    -0xa0(%rbp),%rcx
mov    -0x98(%rbp),%r8
mov    -0x90(%rbp),%r9
mov    -0x88(%rbp),%r10
lea    0xd8c(%rip),%rdx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1060 <snprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <break_lines@plt>
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<starbase_attack_warning>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %ecx,0xc(%rsp)
mov    %edx,0x8(%rsp)
mov    %rsi,%r12
mov    %rdi,%rbp
call   10a0 <avoid@plt>
lea    0x10(%rsp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
movsbl 0x10(%rsp),%edi
call   1040 <toupper@plt>
mov    %al,0x10(%rsp)
mov    %rbp,%rdi
call   1080 <be_advised@plt>
mov    %rax,%r13
mov    %rbp,%rdi
call   1050 <cease_fire@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   10b0 <get_lost@plt>
mov    %rax,%r14
mov    %rbp,%rdi
call   1070 <you_will_be@plt>
mov    %rax,%r15
mov    %rbp,%rdi
call   1090 <destroyed@plt>
lea    0xdea(%rip),%rdx
mov    %r12,%rdi
mov    0x8(%rsp),%esi
mov    %r13,%rcx
mov    %rbx,%r8
mov    %r14,%r9
push   %rax
push   %r15
call   1060 <snprintf@plt>
add    $0x10,%rsp
mov    %r12,%rdi
mov    0xc(%rsp),%esi
call   10c0 <break_lines@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mtwist_state = type { i32 }
@.str = [23 x i8] c"%s %s and %s or %s %s\0A\00"
define void @starbase_attack_warning(%struct.mtwist_state* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca %struct.mtwist_state*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [100 x i8]
store %struct.mtwist_state* %0, %struct.mtwist_state** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%11 = load %struct.mtwist_state*, %struct.mtwist_state** %5
%12 = call i32 @avoid(%struct.mtwist_state* %11)
%13 = call i32 @strcpy(i8* %10, i32 %12)
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%15 = load i8, i8* %14
%16 = call signext i8 @toupper(i8 signext %15)
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
store i8 %16, i8* %17
%18 = load i8*, i8** %6
%19 = load i32, i32* %7
%20 = load %struct.mtwist_state*, %struct.mtwist_state** %5
%21 = call i8* @be_advised(%struct.mtwist_state* %20)
%22 = load %struct.mtwist_state*, %struct.mtwist_state** %5
%23 = call i8* @cease_fire(%struct.mtwist_state* %22)
%24 = load %struct.mtwist_state*, %struct.mtwist_state** %5
%25 = call i8* @get_lost(%struct.mtwist_state* %24)
%26 = load %struct.mtwist_state*, %struct.mtwist_state** %5
%27 = call i8* @you_will_be(%struct.mtwist_state* %26)
%28 = load %struct.mtwist_state*, %struct.mtwist_state** %5
%29 = call i8* @destroyed(%struct.mtwist_state* %28)
%30 = call i32 @snprintf(i8* %18, i32 %19, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %23, i8* %25, i8* %27, i8* %29)
%31 = load i8*, i8** %6
%32 = load i32, i32* %8
%33 = call i32 @break_lines(i8* %31, i32 %32)
ret void
}

LLVM IR (-O2):
%struct.mtwist_state = type { i32 }
@.str = [23 x i8] c"%s %s and %s or %s %s\0A\00"
define void @starbase_attack_warning(%struct.mtwist_state* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%7 = tail call i32 @avoid(%struct.mtwist_state* %0)
%8 = call i32 @strcpy(i8* %6, i32 %7)
%9 = load i8, i8* %6
%10 = call signext i8 @toupper(i8 signext %9)
store i8 %10, i8* %6
%11 = call i8* @be_advised(%struct.mtwist_state* %0)
%12 = call i8* @cease_fire(%struct.mtwist_state* %0)
%13 = call i8* @get_lost(%struct.mtwist_state* %0)
%14 = call i8* @you_will_be(%struct.mtwist_state* %0)
%15 = call i8* @destroyed(%struct.mtwist_state* %0)
%16 = call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12, i8* %13, i8* %14, i8* %15)
%17 = call i32 @break_lines(i8* %1, i32 %3)
ret void
}