#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 /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ Close(int);
int /*<<< orphan*/ O_RDONLY;
int Open_fmt(int /*<<< orphan*/, char *, int /*<<< orphan*/);
int /*<<< orphan*/ Read(int, char *, int);
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, unsigned long *);
char *strtok(char *, char *);
void Get_utime_and_stime(pid_t pid, unsigned long int *utime,
                         unsigned long int *stime) {
  enum { BUFSIZE = 8192 };
  char s[BUFSIZE], *p;
  int i, fd;
  assert(utime != NULL);
  assert(stime != NULL);
  fd = Open_fmt(O_RDONLY, "/proc/%d/stat", pid);
  Read(fd, s, BUFSIZE);
  Close(fd);
  for (i = 0; i < 13; i++) {
    p = strtok((i == 0) ? s : NULL, " ");
    assert(s != NULL);
  }
  p = strtok(NULL, " ");
  sscanf(p, "%lu", utime);
  p = strtok(NULL, " ");
  sscanf(p, "%lu", stime);
}


x86 assembly (clang, -O0):
<Get_utime_and_stime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2040,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xe53(%rip),%rsi
call   1080 <Open_fmt@plt>
mov    %eax,-0x2030(%rbp)
mov    -0x2030(%rbp),%edi
lea    -0x2020(%rbp),%rsi
mov    $0x2000,%edx
call   1030 <Read@plt>
mov    -0x2030(%rbp),%edi
call   1060 <Close@plt>
movl   $0x0,-0x202c(%rbp)
cmpl   $0xd,-0x202c(%rbp)
jge    1265 <Get_utime_and_stime+0x105>
cmpl   $0x0,-0x202c(%rbp)
jne    1211 <Get_utime_and_stime+0xb1>
lea    -0x2020(%rbp),%rax
mov    %rax,-0x2038(%rbp)
jmp    121f <Get_utime_and_stime+0xbf>
xor    %eax,%eax
mov    %rax,-0x2038(%rbp)
jmp    121f <Get_utime_and_stime+0xbf>
mov    -0x2038(%rbp),%rdi
lea    0xde1(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x2028(%rbp)
lea    -0x2020(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x202c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x202c(%rbp)
jmp    11e4 <Get_utime_and_stime+0x84>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd9e(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x2028(%rbp)
mov    -0x2028(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xd82(%rip),%rsi
call   1050 <sscanf@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd70(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x2028(%rbp)
mov    -0x2028(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xd54(%rip),%rsi
call   1050 <sscanf@plt>
add    $0x2040,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_utime_and_stime>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x2008,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %edi,%ebx
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1040 <assert@plt>
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1040 <assert@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
mov    %ebx,%edx
call   1080 <Open_fmt@plt>
mov    %eax,%ebx
mov    %rsp,%r12
mov    %eax,%edi
mov    %r12,%rsi
mov    $0x2000,%edx
call   1030 <Read@plt>
mov    %ebx,%edi
call   1060 <Close@plt>
lea    0xe43(%rip),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    $0x1,%edi
call   1040 <assert@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
lea    0xd2f(%rip),%r12
mov    %rax,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1050 <sscanf@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1070 <strtok@plt>
mov    %rax,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1050 <sscanf@plt>
add    $0x2008,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [14 x i8] c"/proc/%d/stat\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [4 x i8] c"%lu\00"
define void @Get_utime_and_stime(i32 %0, i64* %1, i64* %2) {
%4 = alloca i32
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca [8192 x i8]
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %4
store i64* %1, i64** %5
store i64* %2, i64** %6
%11 = load i64*, i64** %5
%12 = icmp ne i64* %11, null
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i64*, i64** %6
%16 = icmp ne i64* %15, null
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i32, i32* @O_RDONLY
%20 = load i32, i32* %4
%21 = call i32 @Open_fmt(i32 %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %20)
store i32 %21, i32* %10
%22 = load i32, i32* %10
%23 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%24 = call i32 @Read(i32 %22, i8* %23, i32 8192)
%25 = load i32, i32* %10
%26 = call i32 @Close(i32 %25)
store i32 0, i32* %9
br label %27
27: ; preds = %43, %3
%28 = load i32, i32* %9
%29 = icmp slt i32 %28, 13
br i1 %29, label %30, label %46
30: ; preds = %27
%31 = load i32, i32* %9
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
br label %36
35: ; preds = %30
br label %36
36: ; preds = %35, %33
%37 = phi i8* [ %34, %33 ], [ null, %35 ]
%38 = call i8* @strtok(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %38, i8** %8
%39 = getelementptr inbounds [8192 x i8], [8192 x i8]* %7, i64 0, i64 0
%40 = icmp ne i8* %39, null
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
br label %43
43: ; preds = %36
%44 = load i32, i32* %9
%45 = add nsw i32 %44, 1
store i32 %45, i32* %9
br label %27
46: ; preds = %27
%47 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %47, i8** %8
%48 = load i8*, i8** %8
%49 = load i64*, i64** %5
%50 = call i32 @sscanf(i8* %48, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %49)
%51 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %51, i8** %8
%52 = load i8*, i8** %8
%53 = load i64*, i64** %6
%54 = call i32 @sscanf(i8* %52, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %53)
ret void
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [14 x i8] c"/proc/%d/stat\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [4 x i8] c"%lu\00"
define void @Get_utime_and_stime(i32 %0, i64* %1, i64* %2) {
%4 = alloca [8192 x i8]
%5 = getelementptr inbounds [8192 x i8], [8192 x i8]* %4, i64 0, i64 0
%6 = icmp ne i64* %1, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = icmp ne i64* %2, null
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = load i32, i32* @O_RDONLY
%13 = tail call i32 @Open_fmt(i32 %12, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %0)
%14 = call i32 @Read(i32 %13, i8* %5, i32 8192)
%15 = call i32 @Close(i32 %13)
%16 = call i8* @strtok(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @assert(i32 1)
%18 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 @assert(i32 1)
%20 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @assert(i32 1)
%22 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @assert(i32 1)
%24 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @assert(i32 1)
%26 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = call i32 @assert(i32 1)
%28 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @assert(i32 1)
%30 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%31 = call i32 @assert(i32 1)
%32 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @assert(i32 1)
%34 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = call i32 @assert(i32 1)
%36 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @assert(i32 1)
%38 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @assert(i32 1)
%40 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%41 = call i32 @assert(i32 1)
%42 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%43 = call i32 @sscanf(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %1)
%44 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%45 = call i32 @sscanf(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64* %2)
ret void
}