#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 */
int /*<<< orphan*/ printf(char *, ...);
void printBullsAndCows(int bulls, int cows) {
  if ((bulls == 1) && (cows == 1)) {
    printf("\nYou have 1 bull and 1 cow.\n\n");
  } else {
    if (bulls == 1) {
      printf("\nYou have 1 bull and %d cows.\n\n", cows);
    } else {
      if (cows == 1) {
        printf("\nYou have %d bulls and 1 cow.\n\n", bulls);
      } else {
        printf("\nYou have %d bulls and %d cows.\n\n", bulls, cows);
      }
    }
  }
}


x86 assembly (clang, -O0):
<printBullsAndCows>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1145 <printBullsAndCows+0x35>
cmpl   $0x1,-0x8(%rbp)
jne    1145 <printBullsAndCows+0x35>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a3 <printBullsAndCows+0x93>
cmpl   $0x1,-0x4(%rbp)
jne    1165 <printBullsAndCows+0x55>
mov    -0x8(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <printBullsAndCows+0x8e>
cmpl   $0x1,-0x8(%rbp)
jne    1185 <printBullsAndCows+0x75>
mov    -0x4(%rbp),%esi
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1199 <printBullsAndCows+0x89>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xecc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    119e <printBullsAndCows+0x8e>
jmp    11a3 <printBullsAndCows+0x93>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBullsAndCows>:
mov    %esi,%edx
mov    %edi,%esi
cmp    $0x1,%edi
jne    113a <printBullsAndCows+0x1a>
cmp    $0x1,%edx
jne    113a <printBullsAndCows+0x1a>
lea    0xf2d(%rip),%rdi
jmp    1030 <puts@plt>
cmp    $0x1,%esi
jne    114f <printBullsAndCows+0x2f>
lea    0xeba(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
jmp    1040 <printf@plt>
cmp    $0x1,%edx
jne    1162 <printBullsAndCows+0x42>
lea    0xec5(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>
lea    0xed7(%rip),%rdi
xor    %eax,%eax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"\0AYou have 1 bull and 1 cow.\0A\0A\00"
@.str.1 = [32 x i8] c"\0AYou have 1 bull and %d cows.\0A\0A\00"
@.str.2 = [32 x i8] c"\0AYou have %d bulls and 1 cow.\0A\0A\00"
@.str.3 = [34 x i8] c"\0AYou have %d bulls and %d cows.\0A\0A\00"
define void @printBullsAndCows(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 = icmp eq i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
br label %30
12: ; preds = %7, %2
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %29
18: ; preds = %12
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %3
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %22)
br label %28
24: ; preds = %18
%25 = load i32, i32* %3
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %25, i32 %26)
br label %28
28: ; preds = %24, %21
br label %29
29: ; preds = %28, %15
br label %30
30: ; preds = %29, %10
ret void
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"\0AYou have 1 bull and %d cows.\0A\0A\00"
@.str.2 = [32 x i8] c"\0AYou have %d bulls and 1 cow.\0A\0A\00"
@.str.3 = [34 x i8] c"\0AYou have %d bulls and %d cows.\0A\0A\00"
@str = [29 x i8] c"\0AYou have 1 bull and 1 cow.\0A\00"
define void @printBullsAndCows(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 1
%4 = icmp eq i32 %1, 1
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
br label %16
8: ; preds = %2
br i1 %3, label %9, label %11
9: ; preds = %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %16
11: ; preds = %8
br i1 %4, label %12, label %14
12: ; preds = %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 %0)
br label %16
14: ; preds = %11
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0), i32 %0, i32 %1)
br label %16
16: ; preds = %9, %14, %12, %6
ret void
}