#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_countkey(char *, long long *);
char *strchr(char *, char);
int countkey(int sock, char **user, char *msg, char *replyto) {
  char *parm = strchr(msg, ' ');
  if (!parm || !(++parm))
    return ircsend(sock,
                   "NOTICE %s "
                   ":no parameter specified",
                   user[0]);
  long long numbered = 0;
  if (shout_countkey(parm, &numbered))
    return ircsend(sock,
                   "PRIVMSG %s "
                   ":An error occured in the sqlite3 interface, "
                   "please contact owner",
                   replyto);
  return ircsend(sock,
                 "PRIVMSG %s "
                 ":%lld quotes found for specified key",
                 replyto, numbered, parm);
}


x86 assembly (clang, -O0):
<countkey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     117a <countkey+0x4a>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    119a <countkey+0x6a>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1050 <ircsend@plt>
mov    %eax,-0x4(%rbp)
jmp    11f6 <countkey+0xc6>
movq   $0x0,-0x30(%rbp)
mov    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <shout_countkey@plt>
cmp    $0x0,%rax
je     11d6 <countkey+0xa6>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    0xe5b(%rip),%rsi
mov    $0x0,%al
call   1050 <ircsend@plt>
mov    %eax,-0x4(%rbp)
jmp    11f6 <countkey+0xc6>
mov    -0x8(%rbp),%edi
mov    -0x20(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%r8
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1050 <ircsend@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countkey>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rsi,%rbp
mov    %edi,%r15d
mov    %rdx,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1187 <countkey+0x57>
mov    %rax,%rbx
add    $0x1,%rbx
movq   $0x0,(%rsp)
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <shout_countkey@plt>
test   %rax,%rax
je     11a6 <countkey+0x76>
lea    0xeaa(%rip),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <ircsend@plt>
jmp    11c1 <countkey+0x91>
mov    0x0(%rbp),%rdx
lea    0xe6e(%rip),%rsi
mov    %r15d,%edi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <ircsend@plt>
mov    (%rsp),%rcx
lea    0xebd(%rip),%rsi
mov    %r15d,%edi
mov    %r14,%rdx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <ircsend@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"NOTICE %s :no parameter specified\00"
@.str.1 = [76 x i8] c"PRIVMSG %s :An error occured in the sqlite3 interface, please contact owner\00"
@.str.2 = [48 x i8] c"PRIVMSG %s :%lld quotes found for specified key\00"
define i32 @countkey(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 i8*
%11 = alloca i64
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%12 = load i8*, i8** %8
%13 = call i8* @strchr(i8* %12, i8 signext 32)
store i8* %13, i8** %10
%14 = load i8*, i8** %10
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %20
16: ; preds = %4
%17 = load i8*, i8** %10
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %10
%19 = icmp ne i8* %18, null
br i1 %19, label %26, label %20
20: ; preds = %16, %4
%21 = load i32, i32* %6
%22 = load i8**, i8*** %7
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %21, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %24)
store i32 %25, i32* %5
br label %40
26: ; preds = %16
store i64 0, i64* %11
%27 = load i8*, i8** %10
%28 = call i64 @shout_countkey(i8* %27, i64* %11)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load i32, i32* %6
%32 = load i8*, i8** %9
%33 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %31, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0), i8* %32)
store i32 %33, i32* %5
br label %40
34: ; preds = %26
%35 = load i32, i32* %6
%36 = load i8*, i8** %9
%37 = load i64, i64* %11
%38 = load i8*, i8** %10
%39 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %35, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* %36, i64 %37, i8* %38)
store i32 %39, i32* %5
br label %40
40: ; preds = %34, %30, %20
%41 = load i32, i32* %5
ret i32 %41
}

LLVM IR (-O2):
@.str = [34 x i8] c"NOTICE %s :no parameter specified\00"
@.str.1 = [76 x i8] c"PRIVMSG %s :An error occured in the sqlite3 interface, please contact owner\00"
@.str.2 = [48 x i8] c"PRIVMSG %s :%lld quotes found for specified key\00"
define i32 @countkey(i32 %0, i8** nocapture %1, i8* %2, i8* %3) {
%5 = alloca i64
%6 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 32)
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %4
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%11 = call i64 @shout_countkey(i8* %9, i64* %5)
%12 = icmp eq i64 %11, 0
br i1 %12, label %18, label %16
13: ; preds = %4
%14 = load i8*, i8** %1
%15 = tail call i32 (i32, i8*, i8*, ...) @ircsend(i32 %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %14)
br label %23
16: ; preds = %8
%17 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %0, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %21
18: ; preds = %8
%19 = load i64, i64* %5
%20 = call i32 (i32, i8*, i8*, ...) @ircsend(i32 %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* %3, i64 %19, i8* %9)
br label %21
21: ; preds = %18, %16
%22 = phi i32 [ %17, %16 ], [ %20, %18 ]
br label %23
23: ; preds = %21, %13
%24 = phi i32 [ %22, %21 ], [ %15, %13 ]
ret i32 %24
}