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

/* Variables and functions */
int /*<<< orphan*/ tracecmd_set_cpu_to_timestamp(struct tracecmd_input *, int,
                                                 unsigned long long);
void set_cpu_time(struct tracecmd_input *handle, int percpu,
                  unsigned long long start, int cpu, int cpus) {
  if (percpu) {
    tracecmd_set_cpu_to_timestamp(handle, cpu, start);
    return;
  }
  for (cpu = 0; cpu < cpus; cpu++)
    tracecmd_set_cpu_to_timestamp(handle, cpu, start);
  return;
}


x86 assembly (clang, -O0):
<set_cpu_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1149 <set_cpu_time+0x39>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <tracecmd_set_cpu_to_timestamp@plt>
jmp    117f <set_cpu_time+0x6f>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    117a <set_cpu_time+0x6a>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <tracecmd_set_cpu_to_timestamp@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <set_cpu_time+0x40>
jmp    117f <set_cpu_time+0x6f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_cpu_time>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rdi,%rbp
test   %esi,%esi
je     1138 <set_cpu_time+0x28>
mov    %rbp,%rdi
mov    %ecx,%esi
mov    %r15,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <tracecmd_set_cpu_to_timestamp@plt>
mov    %r8d,%r14d
test   %r8d,%r8d
jle    1165 <set_cpu_time+0x55>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r15,%rdx
call   1030 <tracecmd_set_cpu_to_timestamp@plt>
add    $0x1,%ebx
cmp    %ebx,%r14d
jne    1150 <set_cpu_time+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tracecmd_input = type { i32 }
define void @set_cpu_time(%struct.tracecmd_input* %0, i32 %1, i64 %2, i32 %3, i32 %4) {
%6 = alloca %struct.tracecmd_input*
%7 = alloca i32
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
store %struct.tracecmd_input* %0, %struct.tracecmd_input** %6
store i32 %1, i32* %7
store i64 %2, i64* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %7
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %5
%14 = load %struct.tracecmd_input*, %struct.tracecmd_input** %6
%15 = load i32, i32* %9
%16 = load i64, i64* %8
%17 = call i32 @tracecmd_set_cpu_to_timestamp(%struct.tracecmd_input* %14, i32 %15, i64 %16)
br label %32
18: ; preds = %5
store i32 0, i32* %9
br label %19
19: ; preds = %28, %18
%20 = load i32, i32* %9
%21 = load i32, i32* %10
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %31
23: ; preds = %19
%24 = load %struct.tracecmd_input*, %struct.tracecmd_input** %6
%25 = load i32, i32* %9
%26 = load i64, i64* %8
%27 = call i32 @tracecmd_set_cpu_to_timestamp(%struct.tracecmd_input* %24, i32 %25, i64 %26)
br label %28
28: ; preds = %23
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %19
31: ; preds = %19
br label %32
32: ; preds = %31, %13
ret void
}

LLVM IR (-O2):
%struct.tracecmd_input = type { i32 }
define void @set_cpu_time(%struct.tracecmd_input* %0, i32 %1, i64 %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %1, 0
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = icmp sgt i32 %4, 0
br i1 %8, label %11, label %16
9: ; preds = %5
%10 = tail call i32 @tracecmd_set_cpu_to_timestamp(%struct.tracecmd_input* %0, i32 %3, i64 %2)
br label %16
11: ; preds = %7, %11
%12 = phi i32 [ %14, %11 ], [ 0, %7 ]
%13 = tail call i32 @tracecmd_set_cpu_to_timestamp(%struct.tracecmd_input* %0, i32 %12, i64 %2)
%14 = add nuw nsw i32 %12, 1
%15 = icmp eq i32 %14, %4
br i1 %15, label %16, label %11
16: ; preds = %11, %7, %9
ret void
}