#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 /*<<< orphan*/ init_metrics(char *, char *, char *, char *, char *, char *,
                                char *, char *, char *);
int /*<<< orphan*/ record_event(char *, char *, char *, int);
int /*<<< orphan*/ record_floating_point_event(char *, char *, char *, int);
int /*<<< orphan*/ sleep(int);
int main() {
  init_metrics("myapp", "1.0", "default", "c", "en-us", "pi", "LAMP", "linux",
               "redhat");
  for (int i = 0; i < 21; i++) {
    record_event("test", "click", "order", i);
    record_floating_point_event("test", "click", "order", i * .1);
    sleep(1);
  }
  sleep(45);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb2(%rip),%rdi
lea    0xeb1(%rip),%rsi
lea    0xeae(%rip),%rdx
lea    0xeaf(%rip),%rcx
lea    0xeaa(%rip),%r8
lea    0xea9(%rip),%r9
lea    0xea5(%rip),%r11
lea    0xea3(%rip),%r10
lea    0xea2(%rip),%rax
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <init_metrics@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x15,-0x8(%rbp)
jge    1216 <main+0xd6>
mov    -0x8(%rbp),%ecx
lea    0xe7b(%rip),%rdi
lea    0xe79(%rip),%rsi
lea    0xe78(%rip),%rdx
call   1050 <record_event@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xe24(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
lea    0xe4c(%rip),%rdi
lea    0xe4a(%rip),%rsi
lea    0xe49(%rip),%rdx
call   1040 <record_floating_point_event@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a8 <main+0x68>
mov    $0x2d,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
sub    $0x8,%rsp
lea    0xee5(%rip),%rax
lea    0xed8(%rip),%rbx
lea    0xecc(%rip),%r10
lea    0xea8(%rip),%rdi
lea    0xea7(%rip),%rsi
lea    0xea4(%rip),%rdx
lea    0xea5(%rip),%rcx
lea    0xea0(%rip),%r8
lea    0xe9f(%rip),%r9
push   %rax
push   %rbx
push   %r10
call   1030 <init_metrics@plt>
add    $0x20,%rsp
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
lea    0xe95(%rip),%r14
lea    0xe93(%rip),%r15
lea    0xe92(%rip),%r12
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %ebx,%ecx
call   1050 <record_event@plt>
movsd  (%rsp),%xmm0
mulsd  0xe23(%rip),%xmm0
cvttsd2si %xmm0,%ecx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1040 <record_floating_point_event@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
movsd  (%rsp),%xmm0
addsd  0xe02(%rip),%xmm0
movsd  %xmm0,(%rsp)
add    $0x1,%ebx
cmp    $0x15,%ebx
jne    11c0 <main+0x80>
mov    $0x2d,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"myapp\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [8 x i8] c"default\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [6 x i8] c"en-us\00"
@.str.5 = [3 x i8] c"pi\00"
@.str.6 = [5 x i8] c"LAMP\00"
@.str.7 = [6 x i8] c"linux\00"
@.str.8 = [7 x i8] c"redhat\00"
@.str.9 = [5 x i8] c"test\00"
@.str.10 = [6 x i8] c"click\00"
@.str.11 = [6 x i8] c"order\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @init_metrics(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
store i32 0, i32* %2
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 21
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @record_event(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = fmul double %11, 1.000000e-01
%13 = fptosi double %12 to i32
%14 = call i32 @record_floating_point_event(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %13)
%15 = call i32 @sleep(i32 1)
br label %16
16: ; preds = %7
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %4
19: ; preds = %4
%20 = call i32 @sleep(i32 45)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"myapp\00"
@.str.1 = [4 x i8] c"1.0\00"
@.str.2 = [8 x i8] c"default\00"
@.str.3 = [2 x i8] c"c\00"
@.str.4 = [6 x i8] c"en-us\00"
@.str.5 = [3 x i8] c"pi\00"
@.str.6 = [5 x i8] c"LAMP\00"
@.str.7 = [6 x i8] c"linux\00"
@.str.8 = [7 x i8] c"redhat\00"
@.str.9 = [5 x i8] c"test\00"
@.str.10 = [6 x i8] c"click\00"
@.str.11 = [6 x i8] c"order\00"
define i32 @main() {
%1 = tail call i32 @init_metrics(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
br label %4
2: ; preds = %4
%3 = tail call i32 @sleep(i32 45)
ret i32 0
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %12, %4 ]
%6 = tail call i32 @record_event(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %5)
%7 = sitofp i32 %5 to double
%8 = fmul double %7, 1.000000e-01
%9 = fptosi double %8 to i32
%10 = tail call i32 @record_floating_point_event(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %9)
%11 = tail call i32 @sleep(i32 1)
%12 = add nuw nsw i32 %5, 1
%13 = icmp eq i32 %12, 21
br i1 %13, label %2, label %4
}