#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*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ stderr;
void sesc_simulation_mark_id(int id) {
  static int marks[256];
  static int first = 1;
  int i;
  if (first) {
    for (i = 0; i < 256; i++)
      marks[i] = 0;
    first = 0;
  }
  fprintf(stderr, "sesc_simulation_mark(%d) %d (native)", id, marks[id % 256]);
  marks[id % 256]++;
}


x86 assembly (clang, -O0):
<sesc_simulation_mark_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,0x2f06(%rip)
je     1166 <sesc_simulation_mark_id+0x56>
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    115c <sesc_simulation_mark_id+0x4c>
movslq -0x8(%rbp),%rcx
lea    0x2ef9(%rip),%rax
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <sesc_simulation_mark_id+0x1f>
movl   $0x0,0x2ec2(%rip)
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    -0xc(%rbp),%edx
movslq %eax,%rcx
lea    0x2eb1(%rip),%rax
mov    (%rax,%rcx,4),%ecx
lea    0xe67(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
movslq %edx,%rcx
lea    0x2e8d(%rip),%rax
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
lea    0x2e80(%rip),%rax
mov    %edx,(%rax,%rcx,4)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sesc_simulation_mark_id>:
push   %r15
push   %r14
push   %rbx
mov    %edi,%ebx
cmpb   $0x0,0x3312(%rip)
jne    114a <sesc_simulation_mark_id+0x2a>
lea    0x2f09(%rip),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1030 <memset@plt>
movb   $0x1,0x32f6(%rip)
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
lea    0xff(%rbx),%eax
test   %ebx,%ebx
cmovns %ebx,%eax
and    $0xffffff00,%eax
mov    %ebx,%ecx
sub    %eax,%ecx
movslq %ecx,%r14
lea    0x2ecf(%rip),%r15
mov    (%r15,%r14,4),%ecx
lea    0xe84(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
addl   $0x1,(%r15,%r14,4)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@sesc_simulation_mark_id.marks = internal global [256 x i32] zeroinitializer
@sesc_simulation_mark_id.first = internal global i32 1
@stderr = global i32 0
@.str = [37 x i8] c"sesc_simulation_mark(%d) %d (native)\00"
define void @sesc_simulation_mark_id(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* @sesc_simulation_mark_id.first
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %18
6: ; preds = %1
store i32 0, i32* %3
br label %7
7: ; preds = %14, %6
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 256
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [256 x i32], [256 x i32]* @sesc_simulation_mark_id.marks, i64 0, i64 %12
store i32 0, i32* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %7
17: ; preds = %7
store i32 0, i32* @sesc_simulation_mark_id.first
br label %18
18: ; preds = %17, %1
%19 = load i32, i32* @stderr
%20 = load i32, i32* %2
%21 = load i32, i32* %2
%22 = srem i32 %21, 256
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [256 x i32], [256 x i32]* @sesc_simulation_mark_id.marks, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %20, i32 %25)
%27 = load i32, i32* %2
%28 = srem i32 %27, 256
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [256 x i32], [256 x i32]* @sesc_simulation_mark_id.marks, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
store i32 %32, i32* %30
ret void
}

LLVM IR (-O2):
@sesc_simulation_mark_id.marks = internal unnamed_addr global [256 x i32] zeroinitializer
@sesc_simulation_mark_id.first = internal unnamed_addr global i1 false
@stderr = global i32 0
@.str = [37 x i8] c"sesc_simulation_mark(%d) %d (native)\00"
define void @sesc_simulation_mark_id(i32 %0) {
%2 = load i1, i1* @sesc_simulation_mark_id.first
br i1 %2, label %4, label %3
3: ; preds = %1
store i1 true, i1* @sesc_simulation_mark_id.first
br label %4
4: ; preds = %3, %1
%5 = load i32, i32* @stderr
%6 = srem i32 %0, 256
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [256 x i32], [256 x i32]* @sesc_simulation_mark_id.marks, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %9)
%11 = load i32, i32* %8
%12 = add nsw i32 %11, 1
store i32 %12, i32* %8
ret void
}