#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 /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int memcmp(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *, unsigned int);
scalar_t__ sscanf(char *, char *, unsigned int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  char buf[512];
  char fname[100];
  unsigned int addr, naddr;
  *fname = 0;
  while (fgets(buf, 511, stdin)) {
    char *p1 = strtok(buf, " \t\n");
    char *p2;
    char *p3;
    int match = 0;
    match = memcmp(buf, "     000", 8);
    if (p1)
      p2 = strtok(NULL, " \t\n");
    if (p2)
      p3 = strtok(NULL, " \t\n");
    if (match || p1 == NULL || p2 == NULL || p3 == NULL)
      continue;
    if (strcmp(p3, fname)) {
      if (sscanf(p1, "%x", &naddr) == 0)
        fprintf(stderr, "Bad address '%s'\n", p1);
      if (*fname)
        printf("%-24s: %d\n", fname, naddr - addr);
      addr = naddr;
      strcpy(fname, p3);
    }
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x0,-0x280(%rbp)
lea    -0x210(%rbp),%rdi
mov    0x2e2a(%rip),%rax
mov    (%rax),%edx
mov    $0x1ff,%esi
call   1060 <fgets@plt>
cmp    $0x0,%rax
je     1349 <main+0x1b9>
lea    -0x210(%rbp),%rdi
lea    0xe1e(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x290(%rbp)
movl   $0x0,-0x2a4(%rbp)
lea    -0x210(%rbp),%rdi
lea    0xdfe(%rip),%rsi
mov    $0x8,%edx
call   1050 <memcmp@plt>
mov    %eax,-0x2a4(%rbp)
cmpq   $0x0,-0x290(%rbp)
je     123b <main+0xab>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdd1(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x298(%rbp)
cmpq   $0x0,-0x298(%rbp)
je     1260 <main+0xd0>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdac(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x2a0(%rbp)
cmpl   $0x0,-0x2a4(%rbp)
jne    1297 <main+0x107>
cmpq   $0x0,-0x290(%rbp)
je     1297 <main+0x107>
cmpq   $0x0,-0x298(%rbp)
je     1297 <main+0x107>
cmpq   $0x0,-0x2a0(%rbp)
jne    129c <main+0x10c>
jmp    11b0 <main+0x20>
mov    -0x2a0(%rbp),%rdi
lea    -0x280(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     1344 <main+0x1b4>
mov    -0x290(%rbp),%rdi
lea    0xd46(%rip),%rsi
lea    -0x288(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x0,%rax
jne    12f9 <main+0x169>
mov    0x2cf4(%rip),%rax
mov    (%rax),%edi
mov    -0x290(%rbp),%rdx
lea    0xd1c(%rip),%rsi
call   1080 <fprintf@plt>
cmpb   $0x0,-0x280(%rbp)
je     1325 <main+0x195>
lea    -0x280(%rbp),%rsi
mov    -0x288(%rbp),%edx
sub    -0x284(%rbp),%edx
lea    0xd02(%rip),%rdi
call   1040 <printf@plt>
mov    -0x288(%rbp),%eax
mov    %eax,-0x284(%rbp)
lea    -0x280(%rbp),%rdi
mov    -0x2a0(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11b0 <main+0x20>
xor    %edi,%edi
call   10b0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x288,%rsp
movb   $0x0,0x10(%rsp)
mov    0x2e3b(%rip),%rax
mov    (%rax),%edx
lea    0x80(%rsp),%rdi
mov    $0x1ff,%esi
call   1060 <fgets@plt>
test   %rax,%rax
jne    11cd <main+0x3d>
xor    %edi,%edi
call   10b0 <exit@plt>
lea    0xe2c(%rip),%r12
lea    0x80(%rsp),%rbp
lea    0x10(%rsp),%rbx
jmp    1218 <main+0x88>
mov    0x8(%rsp),%eax
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r13,%r12
mov    (%rsp),%r13
mov    0x2de4(%rip),%rax
mov    (%rax),%edx
mov    %rbp,%rdi
mov    $0x1ff,%esi
call   1060 <fgets@plt>
test   %rax,%rax
je     11c6 <main+0x36>
mov    %rbp,%rdi
mov    %r12,%rsi
call   10a0 <strtok@plt>
mov    %rax,%r14
mov    %rbp,%rdi
lea    0xdd4(%rip),%rsi
mov    $0x8,%edx
call   1050 <memcmp@plt>
mov    %eax,%r15d
test   %r14,%r14
je     124f <main+0xbf>
xor    %edi,%edi
mov    %r12,%rsi
call   10a0 <strtok@plt>
mov    %rax,%r13
test   %r13,%r13
je     11fd <main+0x6d>
mov    %r13,(%rsp)
xor    %edi,%edi
mov    %r12,%r13
mov    %r12,%rsi
call   10a0 <strtok@plt>
test   %r15d,%r15d
jne    11f6 <main+0x66>
test   %r14,%r14
je     11f6 <main+0x66>
mov    %rax,%r12
test   %rax,%rax
je     11f6 <main+0x66>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11f6 <main+0x66>
mov    %r14,%rdi
lea    0xd74(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1090 <sscanf@plt>
test   %rax,%rax
je     12b4 <main+0x124>
cmpb   $0x0,0x10(%rsp)
jne    12d7 <main+0x147>
jmp    11e3 <main+0x53>
mov    0x2d1d(%rip),%rax
mov    (%rax),%edi
lea    0xd4c(%rip),%rsi
mov    %r14,%rdx
call   1080 <fprintf@plt>
cmpb   $0x0,0x10(%rsp)
je     11e3 <main+0x53>
mov    0x8(%rsp),%edx
sub    0xc(%rsp),%edx
lea    0xd3c(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
jmp    11e3 <main+0x53>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [4 x i8] c" \09\0A\00"
@.str.1 = [9 x i8] c" 000\00"
@.str.2 = [3 x i8] c"%x\00"
@stderr = global i32 0
@.str.3 = [18 x i8] c"Bad address '%s'\0A\00"
@.str.4 = [11 x i8] c"%-24s: %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [512 x i8]
%7 = alloca [100 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
store i8 0, i8* %14
br label %15
15: ; preds = %75, %46, %2
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%17 = load i32, i32* @stdin
%18 = call i64 @fgets(i8* %16, i32 511, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %76
20: ; preds = %15
%21 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%22 = call i8* @strtok(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %22, i8** %10
store i32 0, i32* %13
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %6, i64 0, i64 0
%24 = call i32 @memcmp(i8* %23, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
store i32 %24, i32* %13
%25 = load i8*, i8** %10
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %28, i8** %11
br label %29
29: ; preds = %27, %20
%30 = load i8*, i8** %11
%31 = icmp ne i8* %30, null
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %33, i8** %12
br label %34
34: ; preds = %32, %29
%35 = load i32, i32* %13
%36 = icmp ne i32 %35, 0
br i1 %36, label %46, label %37
37: ; preds = %34
%38 = load i8*, i8** %10
%39 = icmp eq i8* %38, null
br i1 %39, label %46, label %40
40: ; preds = %37
%41 = load i8*, i8** %11
%42 = icmp eq i8* %41, null
br i1 %42, label %46, label %43
43: ; preds = %40
%44 = load i8*, i8** %12
%45 = icmp eq i8* %44, null
br i1 %45, label %46, label %47
46: ; preds = %43, %40, %37, %34
br label %15
47: ; preds = %43
%48 = load i8*, i8** %12
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%50 = call i64 @strcmp(i8* %48, i8* %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %75
52: ; preds = %47
%53 = load i8*, i8** %10
%54 = call i64 @sscanf(i8* %53, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %9)
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %52
%57 = load i32, i32* @stderr
%58 = load i8*, i8** %10
%59 = call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %56, %52
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%62 = load i8, i8* %61
%63 = icmp ne i8 %62, 0
br i1 %63, label %64, label %70
64: ; preds = %60
%65 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%66 = load i32, i32* %9
%67 = load i32, i32* %8
%68 = sub i32 %66, %67
%69 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %65, i32 %68)
br label %70
70: ; preds = %64, %60
%71 = load i32, i32* %9
store i32 %71, i32* %8
%72 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%73 = load i8*, i8** %12
%74 = call i32 @strcpy(i8* %72, i8* %73)
br label %75
75: ; preds = %70, %47
br label %15
76: ; preds = %15
%77 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [4 x i8] c" \09\0A\00"
@.str.1 = [9 x i8] c" 000\00"
@.str.2 = [3 x i8] c"%x\00"
@stderr = global i32 0
@.str.3 = [18 x i8] c"Bad address '%s'\0A\00"
@.str.4 = [11 x i8] c"%-24s: %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [512 x i8]
%4 = alloca [100 x i8]
%5 = alloca i32
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%8 = bitcast i32* %5 to i8*
store i8 0, i8* %7
%9 = load i32, i32* @stdin
%10 = call i64 @fgets(i8* %6, i32 511, i32 %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %53, label %12
12: ; preds = %2, %48
%13 = phi i8* [ %21, %48 ], [ undef, %2 ]
%14 = phi i32 [ %49, %48 ], [ undef, %2 ]
%15 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @memcmp(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 8)
%17 = icmp eq i8* %15, null
br i1 %17, label %20, label %18
18: ; preds = %12
%19 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %12
%21 = phi i8* [ %19, %18 ], [ %13, %12 ]
%22 = icmp eq i8* %21, null
br i1 %22, label %48, label %23
23: ; preds = %20
%24 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%25 = icmp ne i32 %16, 0
%26 = select i1 %25, i1 true, i1 %17
%27 = icmp eq i8* %24, null
%28 = select i1 %26, i1 true, i1 %27
br i1 %28, label %48, label %29
29: ; preds = %23
%30 = call i64 @strcmp(i8* %24, i8* %7)
%31 = icmp eq i64 %30, 0
br i1 %31, label %48, label %32
32: ; preds = %29
%33 = call i64 @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* @stderr
%37 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %15)
br label %38
38: ; preds = %35, %32
%39 = load i8, i8* %7
%40 = icmp eq i8 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %38
%42 = load i32, i32* %5
%43 = sub i32 %42, %14
%44 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %7, i32 %43)
br label %45
45: ; preds = %41, %38
%46 = load i32, i32* %5
%47 = call i32 @strcpy(i8* %7, i8* %24)
br label %48
48: ; preds = %20, %29, %45, %23
%49 = phi i32 [ %14, %23 ], [ %46, %45 ], [ %14, %29 ], [ %14, %20 ]
%50 = load i32, i32* @stdin
%51 = call i64 @fgets(i8* %6, i32 511, i32 %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %12
53: ; preds = %48, %2
%54 = call i32 @exit(i32 0)
unreachable
}