#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 tc_vote {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ tc_vote_notvalid(struct tc_vote const *);
int /*<<< orphan*/ tc_vote_print_M(struct tc_vote const *);
int /*<<< orphan*/ tc_vote_print_cols(struct tc_vote const *);
int /*<<< orphan*/ tc_vote_print_rows(struct tc_vote const *);
int tc_vote_print(const struct tc_vote *ptr) {
  if (!ptr || tc_vote_notvalid(ptr))
    return -1;
  tc_vote_print_M(ptr);
  printf("\n");
  tc_vote_print_rows(ptr);
  printf("\n");
  tc_vote_print_cols(ptr);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<tc_vote_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117a <tc_vote_print+0x2a>
mov    -0x10(%rbp),%rdi
call   1060 <tc_vote_notvalid@plt>
cmp    $0x0,%rax
je     1186 <tc_vote_print+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    11cc <tc_vote_print+0x7c>
mov    -0x10(%rbp),%rdi
call   1070 <tc_vote_print_M@plt>
lea    0xe6a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <tc_vote_print_rows@plt>
lea    0xe55(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <tc_vote_print_cols@plt>
lea    0xe40(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tc_vote_print>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffff,%ebp
test   %rdi,%rdi
je     11a2 <tc_vote_print+0x52>
mov    %rdi,%rbx
call   1060 <tc_vote_notvalid@plt>
test   %rax,%rax
jne    11a2 <tc_vote_print+0x52>
mov    %rbx,%rdi
call   1070 <tc_vote_print_M@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <tc_vote_print_rows@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1040 <tc_vote_print_cols@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.tc_vote = type { i32 }
@.str = [2 x i8] c"\0A\00"
define i32 @tc_vote_print(%struct.tc_vote* %0) {
%2 = alloca i32
%3 = alloca %struct.tc_vote*
store %struct.tc_vote* %0, %struct.tc_vote** %3
%4 = load %struct.tc_vote*, %struct.tc_vote** %3
%5 = icmp ne %struct.tc_vote* %4, null
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load %struct.tc_vote*, %struct.tc_vote** %3
%8 = call i64 @tc_vote_notvalid(%struct.tc_vote* %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6, %1
store i32 -1, i32* %2
br label %21
11: ; preds = %6
%12 = load %struct.tc_vote*, %struct.tc_vote** %3
%13 = call i32 @tc_vote_print_M(%struct.tc_vote* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = load %struct.tc_vote*, %struct.tc_vote** %3
%16 = call i32 @tc_vote_print_rows(%struct.tc_vote* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = load %struct.tc_vote*, %struct.tc_vote** %3
%19 = call i32 @tc_vote_print_cols(%struct.tc_vote* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %21
21: ; preds = %11, %10
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
%struct.tc_vote = type { i32 }
define i32 @tc_vote_print(%struct.tc_vote* %0) {
%2 = icmp eq %struct.tc_vote* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = tail call i64 @tc_vote_notvalid(%struct.tc_vote* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = tail call i32 @tc_vote_print_M(%struct.tc_vote* %0)
%8 = tail call i32 @putchar(i32 10)
%9 = tail call i32 @tc_vote_print_rows(%struct.tc_vote* %0)
%10 = tail call i32 @putchar(i32 10)
%11 = tail call i32 @tc_vote_print_cols(%struct.tc_vote* %0)
%12 = tail call i32 @putchar(i32 10)
br label %13
13: ; preds = %1, %3, %6
%14 = phi i32 [ 0, %6 ], [ -1, %3 ], [ -1, %1 ]
ret i32 %14
}