#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 pdf {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fscanf(int /*<<< orphan*/ *, char *, int *, int *);
int /*<<< orphan*/ pdf_insert(struct pdf *, int);
struct pdf *pdf_new();
int /*<<< orphan*/ pdf_print(struct pdf *);
int /*<<< orphan*/ *stdin;
int main(int argc, char *argv[]) {
  int done;
  FILE *infile = stdin;
  struct pdf *p;
  p = pdf_new();
  done = 0;
  while (!done) {
    int i, t, res;
    res = fscanf(infile, "%d %d\n", &i, &t);
    if (res == 2) {
      pdf_insert(p, t);
    } else {
      done = 1;
    }
  }
  pdf_print(p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e8b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1060 <pdf_new@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    118c <main+0x4c>
jmp    11ce <main+0x8e>
mov    -0x20(%rbp),%rdi
lea    0xe69(%rip),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1040 <fscanf@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x2,-0x34(%rbp)
jne    11c2 <main+0x82>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%esi
call   1030 <pdf_insert@plt>
jmp    11c9 <main+0x89>
movl   $0x1,-0x14(%rbp)
jmp    1176 <main+0x36>
mov    -0x28(%rbp),%rdi
call   1050 <pdf_print@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x2e94(%rip),%rax
mov    (%rax),%r14
xor    %eax,%eax
call   1060 <pdf_new@plt>
mov    %rax,%rbx
lea    0xe98(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %r14,%rdi
call   1040 <fscanf@plt>
cmp    $0x2,%eax
jne    11b2 <main+0x72>
lea    0xe7a(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
mov    0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <pdf_insert@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
call   1040 <fscanf@plt>
cmp    $0x2,%eax
je     1190 <main+0x50>
mov    %rbx,%rdi
call   1050 <pdf_print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.pdf = type { i32 }
@stdin = global i32* null
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
%8 = alloca %struct.pdf*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32*, i32** @stdin
store i32* %12, i32** %7
%13 = call %struct.pdf* (...) @pdf_new()
store %struct.pdf* %13, %struct.pdf** %8
store i32 0, i32* %6
br label %14
14: ; preds = %28, %2
%15 = load i32, i32* %6
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
br i1 %17, label %18, label %29
18: ; preds = %14
%19 = load i32*, i32** %7
%20 = call i32 @fscanf(i32* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %9, i32* %10)
store i32 %20, i32* %11
%21 = load i32, i32* %11
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %27
23: ; preds = %18
%24 = load %struct.pdf*, %struct.pdf** %8
%25 = load i32, i32* %10
%26 = call i32 @pdf_insert(%struct.pdf* %24, i32 %25)
br label %28
27: ; preds = %18
store i32 1, i32* %6
br label %28
28: ; preds = %27, %23
br label %14
29: ; preds = %14
%30 = load %struct.pdf*, %struct.pdf** %8
%31 = call i32 @pdf_print(%struct.pdf* %30)
ret i32 0
}

LLVM IR (-O2):
%struct.pdf = type { i32 }
@stdin = global i32* null
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = load i32*, i32** @stdin
%6 = tail call %struct.pdf* (...) @pdf_new()
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%10 = icmp eq i32 %9, 2
br i1 %10, label %11, label %16
11: ; preds = %2, %11
%12 = load i32, i32* %4
%13 = call i32 @pdf_insert(%struct.pdf* %6, i32 %12)
%14 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%15 = icmp eq i32 %14, 2
br i1 %15, label %11, label %16
16: ; preds = %11, %2
%17 = call i32 @pdf_print(%struct.pdf* %6)
ret i32 0
}