start_dev_log(num_CUs, num_IUs, num_AUs) int num_CUs, num_IUs, num_AUs;
{
  log_string("    ");
  log_int(num_CUs);
  log_string(" Colonist Unit");
  if (num_CUs != 1)
    log_char('s');
  if (num_IUs + num_AUs == 0)
    goto done;
  if (num_IUs > 0) {
    if (num_AUs == 0)
      log_string(" and ");
    else
      log_string(", ");
    log_int(num_IUs);
    log_string(" Colonial Mining Unit");
    if (num_IUs != 1)
      log_char('s');
  }
  if (num_AUs > 0) {
    if (num_IUs > 0)
      log_char(',');
    log_string(" and ");
    log_int(num_AUs);
    log_string(" Colonial Manufacturing Unit");
    if (num_AUs != 1)
      log_char('s');
  }
done:
  log_string(" were built");
}


x86 assembly (clang, -O0):
<start_dev_log>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <log_string@plt>
mov    -0x8(%rbp),%edi
mov    $0x0,%al
call   1040 <log_int@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <log_string@plt>
cmpl   $0x1,-0x8(%rbp)
je     117d <start_dev_log+0x4d>
mov    $0x73,%edi
mov    $0x0,%al
call   1050 <log_char@plt>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cmp    $0x0,%eax
jne    1191 <start_dev_log+0x61>
jmp    125f <start_dev_log+0x12f>
cmpl   $0x0,-0xc(%rbp)
jle    11f9 <start_dev_log+0xc9>
cmpl   $0x0,-0x10(%rbp)
jne    11b8 <start_dev_log+0x88>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <log_string@plt>
jmp    11c6 <start_dev_log+0x96>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <log_string@plt>
mov    -0xc(%rbp),%edi
mov    $0x0,%al
call   1040 <log_int@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <log_string@plt>
cmpl   $0x1,-0xc(%rbp)
je     11f4 <start_dev_log+0xc4>
mov    $0x73,%edi
mov    $0x0,%al
call   1050 <log_char@plt>
jmp    11f9 <start_dev_log+0xc9>
cmpl   $0x0,-0x10(%rbp)
jle    125a <start_dev_log+0x12a>
cmpl   $0x0,-0xc(%rbp)
jle    1219 <start_dev_log+0xe9>
mov    $0x2c,%edi
mov    $0x0,%al
call   1050 <log_char@plt>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1030 <log_string@plt>
mov    -0x10(%rbp),%edi
mov    $0x0,%al
call   1040 <log_int@plt>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <log_string@plt>
cmpl   $0x1,-0x10(%rbp)
je     1255 <start_dev_log+0x125>
mov    $0x73,%edi
mov    $0x0,%al
call   1050 <log_char@plt>
jmp    125a <start_dev_log+0x12a>
jmp    125f <start_dev_log+0x12f>
lea    0xdea(%rip),%rdi
mov    $0x0,%al
call   1030 <log_string@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<start_dev_log>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1030 <log_string@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <log_int@plt>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1030 <log_string@plt>
cmp    $0x1,%ebx
je     1171 <start_dev_log+0x41>
mov    $0x73,%edi
xor    %eax,%eax
call   1050 <log_char@plt>
mov    %r14d,%eax
add    %ebp,%eax
je     1214 <start_dev_log+0xe4>
test   %ebp,%ebp
jle    11d7 <start_dev_log+0xa7>
test   %r14d,%r14d
lea    0xe8a(%rip),%rax
lea    0xe89(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1030 <log_string@plt>
mov    %ebp,%edi
xor    %eax,%eax
call   1040 <log_int@plt>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1030 <log_string@plt>
cmp    $0x1,%ebp
je     11c4 <start_dev_log+0x94>
mov    $0x73,%edi
xor    %eax,%eax
call   1050 <log_char@plt>
test   %r14d,%r14d
jle    1214 <start_dev_log+0xe4>
mov    $0x2c,%edi
xor    %eax,%eax
call   1050 <log_char@plt>
jmp    11dc <start_dev_log+0xac>
test   %r14d,%r14d
jle    1214 <start_dev_log+0xe4>
lea    0xe31(%rip),%rdi
xor    %eax,%eax
call   1030 <log_string@plt>
mov    %r14d,%edi
xor    %eax,%eax
call   1040 <log_int@plt>
lea    0xe38(%rip),%rdi
xor    %eax,%eax
call   1030 <log_string@plt>
cmp    $0x1,%r14d
je     1214 <start_dev_log+0xe4>
mov    $0x73,%edi
xor    %eax,%eax
call   1050 <log_char@plt>
lea    0xe35(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <log_string@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
@.str.1 = [15 x i8] c" Colonist Unit\00"
@.str.2 = [6 x i8] c" and \00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [22 x i8] c" Colonial Mining Unit\00"
@.str.5 = [29 x i8] c" Colonial Manufacturing Unit\00"
@.str.6 = [12 x i8] c" were built\00"
define i32 @start_dev_log(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = load i32, i32* %5
%10 = call i32 (i32, ...) bitcast (i32 (...)* @log_int to i32 (i32, ...)*)(i32 %9)
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%12 = load i32, i32* %5
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 (i32, ...) bitcast (i32 (...)* @log_char to i32 (i32, ...)*)(i32 115)
br label %16
16: ; preds = %14, %3
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = add nsw i32 %17, %18
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %16
br label %60
22: ; preds = %16
%23 = load i32, i32* %6
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %41
25: ; preds = %22
%26 = load i32, i32* %7
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %32
30: ; preds = %25
%31 = call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
%33 = load i32, i32* %6
%34 = call i32 (i32, ...) bitcast (i32 (...)* @log_int to i32 (i32, ...)*)(i32 %33)
%35 = call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%36 = load i32, i32* %6
%37 = icmp ne i32 %36, 1
br i1 %37, label %38, label %40
38: ; preds = %32
%39 = call i32 (i32, ...) bitcast (i32 (...)* @log_char to i32 (i32, ...)*)(i32 115)
br label %40
40: ; preds = %38, %32
br label %41
41: ; preds = %40, %22
%42 = load i32, i32* %7
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %59
44: ; preds = %41
%45 = load i32, i32* %6
%46 = icmp sgt i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %44
%48 = call i32 (i32, ...) bitcast (i32 (...)* @log_char to i32 (i32, ...)*)(i32 44)
br label %49
49: ; preds = %47, %44
%50 = call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%51 = load i32, i32* %7
%52 = call i32 (i32, ...) bitcast (i32 (...)* @log_int to i32 (i32, ...)*)(i32 %51)
%53 = call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%54 = load i32, i32* %7
%55 = icmp ne i32 %54, 1
br i1 %55, label %56, label %58
56: ; preds = %49
%57 = call i32 (i32, ...) bitcast (i32 (...)* @log_char to i32 (i32, ...)*)(i32 115)
br label %58
58: ; preds = %56, %49
br label %59
59: ; preds = %58, %41
br label %60
60: ; preds = %59, %21
%61 = call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
%62 = load i32, i32* %4
ret i32 %62
}

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
@.str.1 = [15 x i8] c" Colonist Unit\00"
@.str.2 = [6 x i8] c" and \00"
@.str.3 = [3 x i8] c", \00"
@.str.4 = [22 x i8] c" Colonial Mining Unit\00"
@.str.5 = [29 x i8] c" Colonial Manufacturing Unit\00"
@.str.6 = [12 x i8] c" were built\00"
define i32 @start_dev_log(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @log_int to i32 (i32, ...)*)(i32 %0)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32 %0, 1
br i1 %7, label %10, label %8
8: ; preds = %3
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @log_char to i32 (i32, ...)*)(i32 115)
br label %10
10: ; preds = %8, %3
%11 = sub i32 0, %2
%12 = icmp eq i32 %11, %1
br i1 %12, label %37, label %13
13: ; preds = %10
%14 = icmp sgt i32 %1, 0
br i1 %14, label %15, label %26
15: ; preds = %13
%16 = icmp eq i32 %2, 0
%17 = select i1 %16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%18 = tail call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* %17)
%19 = tail call i32 (i32, ...) bitcast (i32 (...)* @log_int to i32 (i32, ...)*)(i32 %1)
%20 = tail call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%21 = icmp eq i32 %1, 1
br i1 %21, label %24, label %22
22: ; preds = %15
%23 = tail call i32 (i32, ...) bitcast (i32 (...)* @log_char to i32 (i32, ...)*)(i32 115)
br label %24
24: ; preds = %15, %22
%25 = icmp sgt i32 %2, 0
br i1 %25, label %28, label %37
26: ; preds = %13
%27 = icmp sgt i32 %2, 0
br i1 %27, label %30, label %37
28: ; preds = %24
%29 = tail call i32 (i32, ...) bitcast (i32 (...)* @log_char to i32 (i32, ...)*)(i32 44)
br label %30
30: ; preds = %26, %28
%31 = tail call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%32 = tail call i32 (i32, ...) bitcast (i32 (...)* @log_int to i32 (i32, ...)*)(i32 %2)
%33 = tail call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i32 %2, 1
br i1 %34, label %37, label %35
35: ; preds = %30
%36 = tail call i32 (i32, ...) bitcast (i32 (...)* @log_char to i32 (i32, ...)*)(i32 115)
br label %37
37: ; preds = %26, %24, %35, %30, %10
%38 = tail call i32 (i8*, ...) bitcast (i32 (...)* @log_string to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
ret i32 undef
}