#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 sscanf(char *, char *, char *, char *, long long *, long long *,
           long long *);
void read_swift_domain_value(char *buf, long long *r1, long long *r2,
                             long long *r3) {
  int ret;
  char token[1024], hit_dumb[32];
  long long req, miss, rt;
  ret = sscanf(buf, "%s%s%lld%lld%lld", token, hit_dumb, &req, &miss, &rt);
  if (ret != 5) {
    return;
  }
  if (rt < 0)
    rt = 0;
  *r1 += req;
  *r2 += miss;
  *r3 += rt;
  *r1 = *r1 < 0LL ? 0LL : *r1;
  *r2 = *r2 < 0LL ? 0LL : *r2;
  *r3 = *r3 < 0LL ? 0LL : *r3;
}


x86 assembly (clang, -O0):
<read_swift_domain_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x490,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x430(%rbp),%rdx
lea    -0x450(%rbp),%rcx
lea    0xebc(%rip),%rsi
lea    -0x458(%rbp),%r8
lea    -0x460(%rbp),%r9
lea    -0x468(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <sscanf@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
je     1174 <read_swift_domain_value+0x64>
jmp    1268 <read_swift_domain_value+0x158>
cmpq   $0x0,-0x468(%rbp)
jge    118d <read_swift_domain_value+0x7d>
movq   $0x0,-0x468(%rbp)
mov    -0x458(%rbp),%rcx
mov    -0x10(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x460(%rbp),%rcx
mov    -0x18(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x468(%rbp),%rcx
mov    -0x20(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
jge    11dc <read_swift_domain_value+0xcc>
xor    %eax,%eax
mov    %rax,-0x470(%rbp)
jmp    11ea <read_swift_domain_value+0xda>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x470(%rbp)
mov    -0x470(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jge    1214 <read_swift_domain_value+0x104>
xor    %eax,%eax
mov    %rax,-0x478(%rbp)
jmp    1222 <read_swift_domain_value+0x112>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x478(%rbp)
mov    -0x478(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
jge    124c <read_swift_domain_value+0x13c>
xor    %eax,%eax
mov    %rax,-0x480(%rbp)
jmp    125a <read_swift_domain_value+0x14a>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x480(%rbp)
mov    -0x480(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
add    $0x490,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_swift_domain_value>:
push   %r15
push   %r14
push   %rbx
sub    $0x440,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
lea    0x8(%rsp),%rax
mov    %rax,(%rsp)
lea    0xecb(%rip),%rsi
lea    0x40(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x10(%rsp),%r9
call   1030 <sscanf@plt>
cmp    $0x5,%eax
jne    119b <read_swift_domain_value+0x8b>
mov    0x8(%rsp),%rax
xor    %ecx,%ecx
test   %rax,%rax
cmovs  %rcx,%rax
mov    0x18(%rsp),%rdx
add    %rdx,(%rbx)
mov    0x10(%rsp),%rdx
add    %rdx,(%r15)
add    %rax,(%r14)
mov    (%rbx),%rax
test   %rax,%rax
cmovs  %rcx,%rax
mov    %rax,(%rbx)
mov    (%r15),%rax
test   %rax,%rax
cmovs  %rcx,%rax
mov    %rax,(%r15)
mov    (%r14),%rax
test   %rax,%rax
cmovns %rax,%rcx
mov    %rcx,(%r14)
add    $0x440,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"%s%s%lld%lld%lld\00"
define void @read_swift_domain_value(i8* %0, i64* %1, i64* %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca i32
%10 = alloca [1024 x i8]
%11 = alloca [32 x i8]
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
store i8* %0, i8** %5
store i64* %1, i64** %6
store i64* %2, i64** %7
store i64* %3, i64** %8
%15 = load i8*, i8** %5
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %11, i64 0, i64 0
%18 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17, i64* %12, i64* %13, i64* %14)
store i32 %18, i32* %9
%19 = load i32, i32* %9
%20 = icmp ne i32 %19, 5
br i1 %20, label %21, label %22
21: ; preds = %4
br label %69
22: ; preds = %4
%23 = load i64, i64* %14
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %26
25: ; preds = %22
store i64 0, i64* %14
br label %26
26: ; preds = %25, %22
%27 = load i64, i64* %12
%28 = load i64*, i64** %6
%29 = load i64, i64* %28
%30 = add nsw i64 %29, %27
store i64 %30, i64* %28
%31 = load i64, i64* %13
%32 = load i64*, i64** %7
%33 = load i64, i64* %32
%34 = add nsw i64 %33, %31
store i64 %34, i64* %32
%35 = load i64, i64* %14
%36 = load i64*, i64** %8
%37 = load i64, i64* %36
%38 = add nsw i64 %37, %35
store i64 %38, i64* %36
%39 = load i64*, i64** %6
%40 = load i64, i64* %39
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %26
br label %46
43: ; preds = %26
%44 = load i64*, i64** %6
%45 = load i64, i64* %44
br label %46
46: ; preds = %43, %42
%47 = phi i64 [ 0, %42 ], [ %45, %43 ]
%48 = load i64*, i64** %6
store i64 %47, i64* %48
%49 = load i64*, i64** %7
%50 = load i64, i64* %49
%51 = icmp slt i64 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %46
br label %56
53: ; preds = %46
%54 = load i64*, i64** %7
%55 = load i64, i64* %54
br label %56
56: ; preds = %53, %52
%57 = phi i64 [ 0, %52 ], [ %55, %53 ]
%58 = load i64*, i64** %7
store i64 %57, i64* %58
%59 = load i64*, i64** %8
%60 = load i64, i64* %59
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %56
br label %66
63: ; preds = %56
%64 = load i64*, i64** %8
%65 = load i64, i64* %64
br label %66
66: ; preds = %63, %62
%67 = phi i64 [ 0, %62 ], [ %65, %63 ]
%68 = load i64*, i64** %8
store i64 %67, i64* %68
br label %69
69: ; preds = %66, %21
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"%s%s%lld%lld%lld\00"
define void @read_swift_domain_value(i8* nocapture %0, i64* nocapture %1, i64* nocapture %2, i64* nocapture %3) {
%5 = alloca [1024 x i8]
%6 = alloca [32 x i8]
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%12 = bitcast i64* %7 to i8*
%13 = bitcast i64* %8 to i8*
%14 = bitcast i64* %9 to i8*
%15 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %10, i8* %11, i64* %7, i64* %8, i64* %9)
%16 = icmp eq i32 %15, 5
br i1 %16, label %17, label %38
17: ; preds = %4
%18 = load i64, i64* %9
%19 = icmp sgt i64 %18, 0
%20 = select i1 %19, i64 %18, i64 0
%21 = load i64, i64* %7
%22 = load i64, i64* %1
%23 = add nsw i64 %22, %21
store i64 %23, i64* %1
%24 = load i64, i64* %8
%25 = load i64, i64* %2
%26 = add nsw i64 %25, %24
store i64 %26, i64* %2
%27 = load i64, i64* %3
%28 = add nsw i64 %27, %20
store i64 %28, i64* %3
%29 = load i64, i64* %1
%30 = icmp sgt i64 %29, 0
%31 = select i1 %30, i64 %29, i64 0
store i64 %31, i64* %1
%32 = load i64, i64* %2
%33 = icmp sgt i64 %32, 0
%34 = select i1 %33, i64 %32, i64 0
store i64 %34, i64* %2
%35 = load i64, i64* %3
%36 = icmp sgt i64 %35, 0
%37 = select i1 %36, i64 %35, i64 0
store i64 %37, i64* %3
br label %38
38: ; preds = %4, %17
ret void
}