#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 TIMER {
  int dummy;
};
struct FIFO32 {
  int dummy;
};

/* Variables and functions */
struct TIMER *timer_alloc();
int /*<<< orphan*/ timer_init(struct TIMER *, struct FIFO32 *, int);
int /*<<< orphan*/ timer_settime(struct TIMER *, int);
void set490(struct FIFO32 *fifo, int mode) {
  int i;
  struct TIMER *timer;
  if (mode != 0) {
    for (i = 0; i < 490; i++) {
      timer = timer_alloc();
      timer_init(timer, fifo, 1024 + i);
      timer_settime(timer, 100 * 60 * 60 * 24 * 50 + i * 100);
    }
  }
  return;
}


x86 assembly (clang, -O0):
<set490>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11a4 <set490+0x74>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1ea,-0x10(%rbp)
jge    119f <set490+0x6f>
mov    $0x0,%al
call   1040 <timer_alloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%edx
add    $0x400,%edx
call   1050 <timer_init@plt>
mov    -0x18(%rbp),%rdi
imul   $0x64,-0x10(%rbp),%esi
add    $0x19bfcc00,%esi
call   1030 <timer_settime@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1150 <set490+0x20>
jmp    11a4 <set490+0x74>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set490>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
je     117f <set490+0x4f>
mov    %rdi,%r14
mov    $0x400,%ebp
mov    $0x19bfcc00,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <timer_alloc@plt>
mov    %rax,%r15
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1050 <timer_init@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <timer_settime@plt>
add    $0x1,%ebp
add    $0x64,%ebx
cmp    $0x5ea,%ebp
jne    1150 <set490+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.FIFO32 = type { i32 }
%struct.TIMER = type { i32 }
define void @set490(%struct.FIFO32* %0, i32 %1) {
%3 = alloca %struct.FIFO32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.TIMER*
store %struct.FIFO32* %0, %struct.FIFO32** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %29
9: ; preds = %2
store i32 0, i32* %5
br label %10
10: ; preds = %25, %9
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 490
br i1 %12, label %13, label %28
13: ; preds = %10
%14 = call %struct.TIMER* (...) @timer_alloc()
store %struct.TIMER* %14, %struct.TIMER** %6
%15 = load %struct.TIMER*, %struct.TIMER** %6
%16 = load %struct.FIFO32*, %struct.FIFO32** %3
%17 = load i32, i32* %5
%18 = add nsw i32 1024, %17
%19 = call i32 @timer_init(%struct.TIMER* %15, %struct.FIFO32* %16, i32 %18)
%20 = load %struct.TIMER*, %struct.TIMER** %6
%21 = load i32, i32* %5
%22 = mul nsw i32 %21, 100
%23 = add nsw i32 432000000, %22
%24 = call i32 @timer_settime(%struct.TIMER* %20, i32 %23)
br label %25
25: ; preds = %13
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %10
28: ; preds = %10
br label %29
29: ; preds = %28, %2
ret void
}

LLVM IR (-O2):
%struct.FIFO32 = type { i32 }
%struct.TIMER = type { i32 }
define void @set490(%struct.FIFO32* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %14, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %12, %4 ], [ 0, %2 ]
%6 = tail call %struct.TIMER* (...) @timer_alloc()
%7 = add nuw nsw i32 %5, 1024
%8 = tail call i32 @timer_init(%struct.TIMER* %6, %struct.FIFO32* %0, i32 %7)
%9 = mul nuw nsw i32 %5, 100
%10 = add nuw nsw i32 %9, 432000000
%11 = tail call i32 @timer_settime(%struct.TIMER* %6, i32 %10)
%12 = add nuw nsw i32 %5, 1
%13 = icmp eq i32 %12, 490
br i1 %13, label %14, label %4
14: ; preds = %4, %2
ret void
}