#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 ircsend(int, char *, char *, ...);
scalar_t__ shout_countall(long long *);
int countall(int sock, char **user, char *msg, char *replyto) {
  user = 0;
  msg = 0;
  long long numbered = 0;
  if (shout_countall(&numbered))
    return ircsend(sock,
                   "PRIVMSG %s "
                   ":An error occured in the sqlite3 interface, "
                   "please contact owner",
                   replyto);
  return ircsend(sock,
                 "PRIVMSG %s "
                 ":I have a total of %lld quotes stored",
                 replyto, numbered);
}


x86 assembly (clang, -O0):
<countall>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
call   1030 <shout_countall@plt>
cmp    $0x0,%rax
je     117f <countall+0x5f>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <ircsend@plt>
mov    %eax,-0x4(%rbp)
jmp    119b <countall+0x7b>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xebb(%rip),%rsi
mov    $0x0,%al
call   1040 <ircsend@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countall>:
push   %rbp
push   %rbx
push   %rax
mov    %rcx,%rbx
mov    %edi,%ebp
movq   $0x0,(%rsp)
mov    %rsp,%rdi
call   1030 <shout_countall@plt>
test   %rax,%rax
je     1152 <countall+0x32>
lea    0xebc(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <ircsend@plt>
jmp    1169 <countall+0x49>
mov    (%rsp),%rcx
lea    0xeef(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <ircsend@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [76 x i8] c"PRIVMSG %s :An error occured in the sqlite3 interface, please contact owner\00"
@.str.1 = [49 x i8] c"PRIVMSG %s :I have a total of %lld quotes stored\00"
define i32 @countall(i32 %0, i8** %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8** null, i8*** %7
store i8* null, i8** %8
store i64 0, i64* %10
%11 = call i64 @shout_countall(i64* %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %4
%14 = load i32, i32* %6
%15 = load i8*, i8** %9
%16 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %14, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %15)
store i32 %16, i32* %5
br label %22
17: ; preds = %4
%18 = load i32, i32* %6
%19 = load i8*, i8** %9
%20 = load i64, i64* %10
%21 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %18, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %19, i64 %20)
store i32 %21, i32* %5
br label %22
22: ; preds = %17, %13
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
@.str = [76 x i8] c"PRIVMSG %s :An error occured in the sqlite3 interface, please contact owner\00"
@.str.1 = [49 x i8] c"PRIVMSG %s :I have a total of %lld quotes stored\00"
define i32 @countall(i32 %0, i8** nocapture readnone %1, i8* nocapture readnone %2, i8* %3) {
%5 = alloca i64
%6 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%7 = call i64 @shout_countall(i64* %5)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %0, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %14
11: ; preds = %4
%12 = load i64, i64* %5
%13 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %3, i64 %12)
br label %14
14: ; preds = %11, %9
%15 = phi i32 [ %10, %9 ], [ %13, %11 ]
ret i32 %15
}