#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 LOG_INFO;
int LOG_NOTICE;
int /*<<< orphan*/ syslog(int, char *, unsigned long, char *);
void showProcessedEvts(unsigned long processedEvts) {
  static unsigned long keepProcessedEvts = 0;
  int level;
  char *notice;
  if (processedEvts > keepProcessedEvts) {
    level = LOG_INFO;
    notice = "";
  } else {
    level = LOG_NOTICE;
    notice = ", \ano new events arrived";
  }
  syslog(level, "%5u events processed %-30s\r", processedEvts, notice);
}


x86 assembly (clang, -O0):
<showProcessedEvts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmp    0x2f09(%rip),%rax
jbe    1149 <showProcessedEvts+0x39>
mov    0x2ea4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xef4(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1160 <showProcessedEvts+0x50>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
lea    0xea4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xea7(%rip),%rsi
call   1030 <syslog@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showProcessedEvts>:
mov    %rdi,%rdx
test   %rdi,%rdi
lea    0xee3(%rip),%rax
lea    0xf10(%rip),%rcx
mov    0x2ead(%rip),%rsi
cmove  0x2ead(%rip),%rsi
cmove  %rax,%rcx
mov    (%rsi),%edi
lea    0xed9(%rip),%rsi
jmp    1030 <syslog@plt>

LLVM IR (-O0):
@showProcessedEvts.keepProcessedEvts = internal global i64 0
@LOG_INFO = global i32 0
@.str = [1 x i8] zeroinitializer
@LOG_NOTICE = global i32 0
@.str.1 = [25 x i8] c", \07no new events arrived\00"
@.str.2 = [28 x i8] c"%5u events processed %-30s\0D\00"
define void @showProcessedEvts(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i8*
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = load i64, i64* @showProcessedEvts.keepProcessedEvts
%7 = icmp ugt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* @LOG_INFO
store i32 %9, i32* %3
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %4
br label %12
10: ; preds = %1
%11 = load i32, i32* @LOG_NOTICE
store i32 %11, i32* %3
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %4
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* %3
%14 = load i64, i64* %2
%15 = load i8*, i8** %4
%16 = call i32 @syslog(i32 %13, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %14, i8* %15)
ret void
}

LLVM IR (-O2):
@LOG_INFO = global i32 0
@.str = [1 x i8] zeroinitializer
@LOG_NOTICE = global i32 0
@.str.1 = [25 x i8] c", \07no new events arrived\00"
@.str.2 = [28 x i8] c"%5u events processed %-30s\0D\00"
define void @showProcessedEvts(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
%4 = load i32, i32* @LOG_NOTICE
%5 = load i32, i32* @LOG_INFO
%6 = select i1 %2, i32 %4, i32 %5
%7 = tail call i32 @syslog(i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 %0, i8* %3)
ret void
}