#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 tms {
  int tms_utime;
  int tms_stime;
  int tms_cutime;
  int tms_cstime;
};

/* Variables and functions */
int clock();
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ times(struct tms *);
int main() {
  struct tms tmstmp;
  times(&tmstmp);
  printf("before:%d,%d,%d,%d clock=%d\n", tmstmp.tms_utime, tmstmp.tms_stime,
         tmstmp.tms_cutime, tmstmp.tms_cstime, clock());
  for (int i = 0; i < 0x100; i++) {
    printf("%d\t", i);
    for (int j = 0; j < 0xfffff; j++)
      ;
  }
  times(&tmstmp);
  printf("after:%d,%d,%d,%d clock=%d\n", tmstmp.tms_utime, tmstmp.tms_stime,
         tmstmp.tms_cutime, tmstmp.tms_cstime, clock());
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x18(%rbp),%rdi
call   1050 <times@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    %eax,%r9d
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x100,-0x1c(%rbp)
jge    11e4 <main+0xb4>
mov    -0x1c(%rbp),%esi
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0xfffff,-0x20(%rbp)
jge    11d1 <main+0xa1>
jmp    11c3 <main+0x93>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11b1 <main+0x81>
jmp    11d6 <main+0xa6>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    118c <main+0x5c>
lea    -0x18(%rbp),%rdi
call   1050 <times@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    $0x0,%al
call   1030 <clock@plt>
mov    -0x40(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    %eax,%r9d
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
call   1050 <times@plt>
mov    0x8(%rsp),%ebx
mov    0xc(%rsp),%ebp
mov    0x10(%rsp),%r14d
mov    0x14(%rsp),%r15d
xor    %eax,%eax
call   1030 <clock@plt>
lea    0xe9c(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    $0x100,%ebp
jne    1190 <main+0x60>
lea    0x8(%rsp),%rdi
call   1050 <times@plt>
mov    0x8(%rsp),%ebx
mov    0xc(%rsp),%ebp
mov    0x10(%rsp),%r14d
mov    0x14(%rsp),%r15d
xor    %eax,%eax
call   1030 <clock@plt>
lea    0xe50(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tms = type { i32, i32, i32, i32 }
@.str = [29 x i8] c"before:%d,%d,%d,%d clock=%d\0A\00"
@.str.1 = [4 x i8] c"%d\09\00"
@.str.2 = [28 x i8] c"after:%d,%d,%d,%d clock=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tms
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @times(%struct.tms* %2)
%6 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 0
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 2
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 3
%13 = load i32, i32* %12
%14 = call i32 (...) @clock()
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %9, i32 %11, i32 %13, i32 %14)
store i32 0, i32* %3
br label %16
16: ; preds = %30, %0
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 256
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = load i32, i32* %3
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
store i32 0, i32* %4
br label %22
22: ; preds = %26, %19
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 1048575
br i1 %24, label %25, label %29
25: ; preds = %22
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %22
29: ; preds = %22
br label %30
30: ; preds = %29
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %16
33: ; preds = %16
%34 = call i32 @times(%struct.tms* %2)
%35 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 0
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 1
%38 = load i32, i32* %37
%39 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 2
%40 = load i32, i32* %39
%41 = getelementptr inbounds %struct.tms, %struct.tms* %2, i32 0, i32 3
%42 = load i32, i32* %41
%43 = call i32 (...) @clock()
%44 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %36, i32 %38, i32 %40, i32 %42, i32 %43)
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
%struct.tms = type { i32, i32, i32, i32 }
@.str = [29 x i8] c"before:%d,%d,%d,%d clock=%d\0A\00"
@.str.1 = [4 x i8] c"%d\09\00"
@.str.2 = [28 x i8] c"after:%d,%d,%d,%d clock=%d\0A\00"
define i32 @main() {
%1 = alloca %struct.tms
%2 = bitcast %struct.tms* %1 to i8*
%3 = call i32 @times(%struct.tms* %1)
%4 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 2
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.tms, %struct.tms* %1, i64 0, i32 3
%11 = load i32, i32* %10
%12 = tail call i32 (...) @clock()
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7, i32 %9, i32 %11, i32 %12)
br label %22
14: ; preds = %22
%15 = call i32 @times(%struct.tms* %1)
%16 = load i32, i32* %4
%17 = load i32, i32* %6
%18 = load i32, i32* %8
%19 = load i32, i32* %10
%20 = tail call i32 (...) @clock()
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17, i32 %18, i32 %19, i32 %20)
ret i32 0
22: ; preds = %0, %22
%23 = phi i32 [ 0, %0 ], [ %25, %22 ]
%24 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%25 = add nuw nsw i32 %23, 1
%26 = icmp eq i32 %25, 256
br i1 %26, label %14, label %22
}