#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 Cmd_Argc();
int /*<<< orphan*/ Cmd_Argv(int);
int Com_Milliseconds();
int /*<<< orphan*/ Com_Printf(char *);
int atoi(int /*<<< orphan*/);
void Com_Freeze_f(void) {
  int s;
  int start, now;
  if (Cmd_Argc() != 2) {
    Com_Printf("freeze <seconds>\n");
    return;
  }
  s = atoi(Cmd_Argv(1)) * 1000;
  start = Com_Milliseconds();
  while (1) {
    now = Com_Milliseconds();
    if (now - start > s) {
      break;
    }
  }
}


x86 assembly (clang, -O0):
<Com_Freeze_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <Cmd_Argc@plt>
cmp    $0x2,%eax
je     1179 <Com_Freeze_f+0x29>
lea    0xe91(%rip),%rdi
call   1050 <Com_Printf@plt>
jmp    11c0 <Com_Freeze_f+0x70>
mov    $0x1,%edi
call   1060 <Cmd_Argv@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
imul   $0x3e8,%eax,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <Com_Milliseconds@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <Com_Milliseconds@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    11bb <Com_Freeze_f+0x6b>
jmp    11c0 <Com_Freeze_f+0x70>
jmp    119d <Com_Freeze_f+0x4d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Com_Freeze_f>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <Cmd_Argc@plt>
cmp    $0x2,%eax
jne    1194 <Com_Freeze_f+0x44>
mov    $0x1,%edi
call   1060 <Cmd_Argv@plt>
mov    %eax,%edi
call   1070 <atoi@plt>
imul   $0x3e8,%eax,%ebp
xor    %eax,%eax
call   1040 <Com_Milliseconds@plt>
mov    %eax,%ebx
nop
xor    %eax,%eax
call   1040 <Com_Milliseconds@plt>
sub    %ebx,%eax
cmp    %ebp,%eax
jle    1180 <Com_Freeze_f+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe65(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <Com_Printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"freeze <seconds>\0A\00"
define void @Com_Freeze_f() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @Cmd_Argc()
%5 = icmp ne i32 %4, 2
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @Com_Printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %22
8: ; preds = %0
%9 = call i32 @Cmd_Argv(i32 1)
%10 = call i32 @atoi(i32 %9)
%11 = mul nsw i32 %10, 1000
store i32 %11, i32* %1
%12 = call i32 (...) @Com_Milliseconds()
store i32 %12, i32* %2
br label %13
13: ; preds = %8, %21
%14 = call i32 (...) @Com_Milliseconds()
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = load i32, i32* %2
%17 = sub nsw i32 %15, %16
%18 = load i32, i32* %1
%19 = icmp sgt i32 %17, %18
br i1 %19, label %20, label %21
20: ; preds = %13
br label %22
21: ; preds = %13
br label %13
22: ; preds = %6, %20
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"freeze <seconds>\0A\00"
define void @Com_Freeze_f() {
%1 = tail call i32 (...) @Cmd_Argc()
%2 = icmp eq i32 %1, 2
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @Com_Printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %14
5: ; preds = %0
%6 = tail call i32 @Cmd_Argv(i32 1)
%7 = tail call i32 @atoi(i32 %6)
%8 = mul nsw i32 %7, 1000
%9 = tail call i32 (...) @Com_Milliseconds()
br label %10
10: ; preds = %10, %5
%11 = tail call i32 (...) @Com_Milliseconds()
%12 = sub nsw i32 %11, %9
%13 = icmp sgt i32 %12, %8
br i1 %13, label %14, label %10
14: ; preds = %10, %3
ret void
}