#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*/ strcmp;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
scalar_t__ capitalize_nth_character(char *, int);
scalar_t__ concatenate(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int run_all_tests() {
  int tests_passed = 0, tests_failed = 0;
  assert((((strcmp)(concatenate("tree", "dog"), "treedog")) == (0)));
  tests_passed++;
  assert((((strcmp)(capitalize_nth_character("dog", 1), "Dog")) == (0)));
  tests_passed++;
  assert((((strcmp)(capitalize_nth_character("Hello", 1), "Hello")) == (0)));
  tests_passed++;
  assert((((strcmp)(capitalize_nth_character("bushes", 3), "buShes")) == (0)));
  tests_passed++;
  assert((((strcmp)(concatenate(("!"), ("what")), "!what")) == (0)));
  tests_passed++;
  assert((((strcmp)(concatenate(("what"), ("!")), "what!")) == (0)));
  tests_passed++;
  printf("Tests Passed: %d\n", tests_passed);
  printf("Tests Failed: %d\n", tests_failed);
  return tests_failed;
}


x86 assembly (clang, -O0):
<run_all_tests>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xea3(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1050 <concatenate@plt>
lea    0xe95(%rip),%rax
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xe7c(%rip),%rdi
mov    $0x1,%esi
call   1060 <capitalize_nth_character@plt>
lea    0xe6f(%rip),%rax
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xe56(%rip),%rdi
mov    $0x1,%esi
call   1060 <capitalize_nth_character@plt>
lea    0xe45(%rip),%rax
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xe2e(%rip),%rdi
mov    $0x3,%esi
call   1060 <capitalize_nth_character@plt>
lea    0xe24(%rip),%rax
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xe18(%rip),%rdi
lea    0xe08(%rip),%rsi
call   1050 <concatenate@plt>
lea    0xdfb(%rip),%rax
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xddf(%rip),%rdi
lea    0xde1(%rip),%rsi
call   1050 <concatenate@plt>
lea    0xdd1(%rip),%rax
test   %eax,%eax
sete   %al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xdb7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xdba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_all_tests>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
lea    0xeb7(%rip),%rbx
mov    %rbx,%rsi
call   1050 <concatenate@plt>
lea    0xea4(%rip),%rax
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <capitalize_nth_character@plt>
lea    0xe8b(%rip),%rax
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe7b(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
call   1060 <capitalize_nth_character@plt>
xor    %edi,%edi
test   %ebx,%ebx
sete   %dil
call   1040 <assert@plt>
lea    0xe60(%rip),%rdi
mov    $0x3,%esi
call   1060 <capitalize_nth_character@plt>
lea    0xe56(%rip),%rax
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe53(%rip),%r14
lea    0xe43(%rip),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <concatenate@plt>
lea    0xe30(%rip),%rax
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <concatenate@plt>
lea    0xe17(%rip),%rax
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
lea    0xe09(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0xe0a(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"tree\00"
@.str.1 = [4 x i8] c"dog\00"
@.str.2 = [8 x i8] c"treedog\00"
@.str.3 = [4 x i8] c"Dog\00"
@.str.4 = [6 x i8] c"Hello\00"
@.str.5 = [7 x i8] c"bushes\00"
@.str.6 = [7 x i8] c"buShes\00"
@.str.7 = [2 x i8] c"!\00"
@.str.8 = [5 x i8] c"what\00"
@.str.9 = [6 x i8] c"!what\00"
@.str.10 = [6 x i8] c"what!\00"
@.str.11 = [18 x i8] c"Tests Passed: %d\0A\00"
@.str.12 = [18 x i8] c"Tests Failed: %d\0A\00"
define i32 @run_all_tests() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i64 @concatenate(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([8 x i8]* @.str.2 to i32), i32 0) to i32))
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = call i64 @capitalize_nth_character(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%8 = call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([4 x i8]* @.str.3 to i32), i32 0) to i32))
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = call i64 @capitalize_nth_character(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 1)
%12 = call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([6 x i8]* @.str.4 to i32), i32 0) to i32))
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
%15 = call i64 @capitalize_nth_character(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 3)
%16 = call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([7 x i8]* @.str.6 to i32), i32 0) to i32))
%17 = load i32, i32* %1
%18 = add nsw i32 %17, 1
store i32 %18, i32* %1
%19 = call i64 @concatenate(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%20 = call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([6 x i8]* @.str.9 to i32), i32 0) to i32))
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
%23 = call i64 @concatenate(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%24 = call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([6 x i8]* @.str.10 to i32), i32 0) to i32))
%25 = load i32, i32* %1
%26 = add nsw i32 %25, 1
store i32 %26, i32* %1
%27 = load i32, i32* %1
%28 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@.str = [5 x i8] c"tree\00"
@.str.1 = [4 x i8] c"dog\00"
@.str.2 = [8 x i8] c"treedog\00"
@.str.3 = [4 x i8] c"Dog\00"
@.str.4 = [6 x i8] c"Hello\00"
@.str.5 = [7 x i8] c"bushes\00"
@.str.6 = [7 x i8] c"buShes\00"
@.str.7 = [2 x i8] c"!\00"
@.str.8 = [5 x i8] c"what\00"
@.str.9 = [6 x i8] c"!what\00"
@.str.10 = [6 x i8] c"what!\00"
@.str.11 = [18 x i8] c"Tests Passed: %d\0A\00"
@.str.12 = [18 x i8] c"Tests Failed: %d\0A\00"
define i32 @run_all_tests() {
%1 = tail call i64 @concatenate(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([8 x i8]* @.str.2 to i32), i32 0) to i32))
%3 = tail call i64 @capitalize_nth_character(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%4 = tail call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([4 x i8]* @.str.3 to i32), i32 0) to i32))
%5 = tail call i64 @capitalize_nth_character(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32 1)
%6 = tail call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([6 x i8]* @.str.4 to i32), i32 0) to i32))
%7 = tail call i64 @capitalize_nth_character(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 3)
%8 = tail call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([7 x i8]* @.str.6 to i32), i32 0) to i32))
%9 = tail call i64 @concatenate(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%10 = tail call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([6 x i8]* @.str.9 to i32), i32 0) to i32))
%11 = tail call i64 @concatenate(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%12 = tail call i32 @assert(i32 zext (i1 icmp eq (i32 ptrtoint ([6 x i8]* @.str.10 to i32), i32 0) to i32))
%13 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.11, i64 0, i64 0), i32 6)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.12, i64 0, i64 0), i32 0)
ret i32 0
}