#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 */
typedef int uint32_t;

/* Variables and functions */
void Delay1ms(uint32_t n) {
  uint32_t volatile time;
  while (n) {
    time = 72724 * 2 / 91;
    while (time) {
      time--;
    }
    n--;
  }
}


x86 assembly (clang, -O0):
<Delay1ms>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1140 <Delay1ms+0x40>
movl   $0x63e,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    $0x0,%eax
je     1132 <Delay1ms+0x32>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1118 <Delay1ms+0x18>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <Delay1ms+0x7>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Delay1ms>:
test   %edi,%edi
je     1134 <Delay1ms+0x34>
mov    %edi,%eax
test   $0x1,%dil
je     112f <Delay1ms+0x2f>
movl   $0x63e,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
je     112c <Delay1ms+0x2c>
nopl   0x0(%rax,%rax,1)
addl   $0xffffffff,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
jne    1120 <Delay1ms+0x20>
lea    -0x1(%rdi),%eax
cmp    $0x1,%edi
jne    1145 <Delay1ms+0x45>
ret
cs nopw 0x0(%rax,%rax,1)
nop
add    $0xfffffffe,%eax
je     1134 <Delay1ms+0x34>
movl   $0x63e,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
je     116c <Delay1ms+0x6c>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
addl   $0xffffffff,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
jne    1160 <Delay1ms+0x60>
movl   $0x63e,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
je     1140 <Delay1ms+0x40>
nopl   0x0(%rax,%rax,1)
addl   $0xffffffff,-0x4(%rsp)
cmpl   $0x0,-0x4(%rsp)
jne    1180 <Delay1ms+0x80>
jmp    1140 <Delay1ms+0x40>

LLVM IR (-O0):
define void @Delay1ms(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %14, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %17
7: ; preds = %4
store volatile i32 1598, i32* %3
br label %8
8: ; preds = %11, %7
%9 = load volatile i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load volatile i32, i32* %3
%13 = add nsw i32 %12, -1
store volatile i32 %13, i32* %3
br label %8
14: ; preds = %8
%15 = load i32, i32* %2
%16 = add nsw i32 %15, -1
store i32 %16, i32* %2
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @Delay1ms(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = icmp eq i32 %0, 0
br i1 %4, label %41, label %5
5: ; preds = %1
%6 = and i32 %0, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %18, label %8
8: ; preds = %5
store volatile i32 1598, i32* %2
%9 = load volatile i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %8, %11
%12 = load volatile i32, i32* %2
%13 = add nsw i32 %12, -1
store volatile i32 %13, i32* %2
%14 = load volatile i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %11
16: ; preds = %11, %8
%17 = add nsw i32 %0, -1
br label %18
18: ; preds = %16, %5
%19 = phi i32 [ %0, %5 ], [ %17, %16 ]
%20 = icmp eq i32 %0, 1
br i1 %20, label %41, label %21
21: ; preds = %18, %38
%22 = phi i32 [ %39, %38 ], [ %19, %18 ]
store volatile i32 1598, i32* %2
%23 = load volatile i32, i32* %2
%24 = icmp eq i32 %23, 0
br i1 %24, label %30, label %25
25: ; preds = %21, %25
%26 = load volatile i32, i32* %2
%27 = add nsw i32 %26, -1
store volatile i32 %27, i32* %2
%28 = load volatile i32, i32* %2
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %25
30: ; preds = %25, %21
store volatile i32 1598, i32* %2
%31 = load volatile i32, i32* %2
%32 = icmp eq i32 %31, 0
br i1 %32, label %38, label %33
33: ; preds = %30, %33
%34 = load volatile i32, i32* %2
%35 = add nsw i32 %34, -1
store volatile i32 %35, i32* %2
%36 = load volatile i32, i32* %2
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %33
38: ; preds = %33, %30
%39 = add nsw i32 %22, -2
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %21
41: ; preds = %18, %38, %1
ret void
}