#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 timeval {
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ e_f(char *, int, int);
int /*<<< orphan*/ exit(int);
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void spin(void) {
  struct timeval start_time;
  struct timeval end_time;
  unsigned int loop = 0;
  if (gettimeofday(&start_time, NULL) == -1) {
    e_f("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/ayyucedemirbas/Minix-Source-Code/refs/heads/"
        "master/minix-master/minix/tests/test75.c",
        34, (1));
    exit(1);
  }
  end_time = start_time;
  do {
    if ((++loop % 3000000000) == 0) {
      if (gettimeofday(&end_time, NULL) == -1) {
        e_f("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/ayyucedemirbas/Minix-Source-Code/refs/"
            "heads/master/minix-master/minix/tests/test75.c",
            41, (1));
        exit(1);
      }
    }
  } while (start_time.tv_sec + 10 > end_time.tv_sec);
}


x86 assembly (clang, -O0):
<spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x14(%rbp)
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
jne    1175 <spin+0x45>
lea    0xea4(%rip),%rdi
mov    $0x22,%esi
mov    $0x1,%edx
call   1040 <e_f@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    %eax,%eax
mov    $0xb2d05e00,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
jne    11d7 <spin+0xa7>
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
jne    11d2 <spin+0xa2>
lea    0xe47(%rip),%rdi
mov    $0x29,%esi
mov    $0x1,%edx
call   1040 <e_f@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    11d7 <spin+0xa7>
jmp    11dc <spin+0xac>
mov    -0x8(%rbp),%rax
add    $0xa,%rax
cmp    -0x10(%rbp),%rax
jg     117d <spin+0x4d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spin>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
je     11b5 <spin+0x85>
mov    0x8(%rsp),%rax
mov    %rax,(%rsp)
lea    0xa(%rax),%rbx
mov    $0x4d2fa201,%ebp
mov    %rsp,%r14
jmp    1168 <spin+0x38>
add    $0x1,%ebp
cmp    %rax,%rbx
jle    118c <spin+0x5c>
mov    %ebp,%ecx
add    $0xb2d05e00,%ecx
cmovae %ebp,%ecx
test   %ecx,%ecx
jne    1160 <spin+0x30>
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cmp    $0xffffffff,%eax
je     1195 <spin+0x65>
mov    (%rsp),%rax
jmp    1160 <spin+0x30>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe64(%rip),%rdi
mov    $0x29,%esi
mov    $0x1,%edx
call   1040 <e_f@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xe44(%rip),%rdi
mov    $0x22,%esi
jmp    11a1 <spin+0x71>

LLVM IR (-O0):
%struct.timeval = type { i64 }
@.str = [175 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ayyucedemirbas/Minix-Source-Code/refs/heads/master/minix-master/minix/tests/test75.c\00"
define void @spin() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = alloca i32
store i32 0, i32* %3
%4 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 @e_f(i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str, i64 0, i64 0), i32 34, i32 1)
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = bitcast %struct.timeval* %2 to i8*
%11 = bitcast %struct.timeval* %1 to i8*
br label %12
12: ; preds = %26, %9
%13 = load i32, i32* %3
%14 = add i32 %13, 1
store i32 %14, i32* %3
%15 = zext i32 %14 to i64
%16 = srem i64 %15, 3000000000
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %12
%19 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = call i32 @e_f(i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str, i64 0, i64 0), i32 41, i32 1)
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %18
br label %25
25: ; preds = %24, %12
br label %26
26: ; preds = %25
%27 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%28 = load i64, i64* %27
%29 = add nsw i64 %28, 10
%30 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%31 = load i64, i64* %30
%32 = icmp sgt i64 %29, %31
br i1 %32, label %12, label %33
33: ; preds = %26
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
@.str = [175 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ayyucedemirbas/Minix-Source-Code/refs/heads/master/minix-master/minix/tests/test75.c\00"
define void @spin() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timeval* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = tail call i32 @e_f(i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str, i64 0, i64 0), i32 34, i32 1)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%13 = load i64, i64* %11
store i64 %13, i64* %12
%14 = add nsw i64 %13, 10
br label %15
15: ; preds = %31, %10
%16 = phi i64 [ %13, %10 ], [ %32, %31 ]
%17 = phi i32 [ 0, %10 ], [ %18, %31 ]
%18 = add i32 %17, 1
%19 = icmp ult i32 %18, -1294967296
%20 = add i32 %17, 1294967297
%21 = select i1 %19, i32 %18, i32 %20
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %31
23: ; preds = %15
%24 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%25 = icmp eq i32 %24, -1
br i1 %25, label %28, label %26
26: ; preds = %23
%27 = load i64, i64* %12
br label %31
28: ; preds = %23
%29 = tail call i32 @e_f(i8* getelementptr inbounds ([175 x i8], [175 x i8]* @.str, i64 0, i64 0), i32 41, i32 1)
%30 = tail call i32 @exit(i32 1)
unreachable
31: ; preds = %26, %15
%32 = phi i64 [ %27, %26 ], [ %16, %15 ]
%33 = icmp sgt i64 %14, %32
br i1 %33, label %15, label %34
34: ; preds = %31
ret void
}