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

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  FILE *fp = fopen("input", "r");
  int a1, a2, a3, possible = 0;
  if (fp == NULL) {
    printf("could not open input file\n");
    return -1;
  }
  while (fscanf(fp, "%i %i %i", &a1, &a2, &a3) != EOF) {
    if (a1 + a2 > a3 && a2 + a3 > a1 && a3 + a1 > a2) {
      possible++;
    }
  }
  printf("Possible: %i\n", possible);
  fclose(fp);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xea9(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1192 <main+0x52>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    121f <main+0xdf>
jmp    1197 <main+0x57>
mov    -0x10(%rbp),%rdi
lea    0xe81(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
call   1050 <fscanf@plt>
mov    0x2e2e(%rip),%rcx
cmp    (%rcx),%rax
je     11fe <main+0xbe>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    11f9 <main+0xb9>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    11f9 <main+0xb9>
mov    -0x1c(%rbp),%eax
add    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11f9 <main+0xb9>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1197 <main+0x57>
mov    -0x20(%rbp),%esi
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe9b(%rip),%rdi
lea    0xe9a(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1228 <main+0xd8>
mov    %rax,%r15
lea    0xe84(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    %rax,%rdi
call   1060 <fscanf@plt>
mov    0x2e46(%rip),%r12
mov    $0x0,%ebp
cmp    (%r12),%rax
je     120c <main+0xbc>
xor    %ebp,%ebp
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%r14
nopl   0x0(%rax)
mov    0x14(%rsp),%eax
mov    0x10(%rsp),%ecx
lea    (%rcx,%rax,1),%edx
mov    0xc(%rsp),%esi
cmp    %esi,%edx
setg   %dl
lea    (%rsi,%rcx,1),%edi
cmp    %eax,%edi
setg   %bl
and    %dl,%bl
add    %eax,%esi
cmp    %ecx,%esi
setg   %al
and    %bl,%al
movzbl %al,%eax
add    %eax,%ebp
mov    %r15,%rdi
lea    0xe12(%rip),%rsi
lea    0x14(%rsp),%rdx
mov    %r13,%rcx
mov    %r14,%r8
call   1060 <fscanf@plt>
cmp    (%r12),%rax
jne    11c0 <main+0x70>
lea    0xdfe(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
jmp    1239 <main+0xe9>
lea    0xdf0(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"input\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [27 x i8] c"could not open input file\0A\00"
@.str.3 = [9 x i8] c"%i %i %i\00"
@EOF = global i64 0
@.str.4 = [14 x i8] c"Possible: %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %2
store i32 0, i32* %6
%8 = load i32*, i32** %2
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %45
12: ; preds = %0
br label %13
13: ; preds = %39, %12
%14 = load i32*, i32** %2
%15 = call i64 @fscanf(i32* %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4, i32* %5)
%16 = load i64, i64* @EOF
%17 = icmp ne i64 %15, %16
br i1 %17, label %18, label %40
18: ; preds = %13
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = add nsw i32 %19, %20
%22 = load i32, i32* %5
%23 = icmp sgt i32 %21, %22
br i1 %23, label %24, label %39
24: ; preds = %18
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = add nsw i32 %25, %26
%28 = load i32, i32* %3
%29 = icmp sgt i32 %27, %28
br i1 %29, label %30, label %39
30: ; preds = %24
%31 = load i32, i32* %5
%32 = load i32, i32* %3
%33 = add nsw i32 %31, %32
%34 = load i32, i32* %4
%35 = icmp sgt i32 %33, %34
br i1 %35, label %36, label %39
36: ; preds = %30
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
br label %39
39: ; preds = %36, %30, %24, %18
br label %13
40: ; preds = %13
%41 = load i32, i32* %6
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %41)
%43 = load i32*, i32** %2
%44 = call i32 @fclose(i32* %43)
store i32 0, i32* %1
br label %45
45: ; preds = %40, %10
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [6 x i8] c"input\00"
@.str.1 = [2 x i8] c"r\00"
@.str.3 = [9 x i8] c"%i %i %i\00"
@EOF = global i64 0
@.str.4 = [14 x i8] c"Possible: %i\0A\00"
@str = [26 x i8] c"could not open input file\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = icmp eq i32* %4, null
br i1 %8, label %13, label %9
9: ; preds = %0
%10 = call i64 @fscanf(i32* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%11 = load i64, i64* @EOF
%12 = icmp eq i64 %10, %11
br i1 %12, label %33, label %15
13: ; preds = %0
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %37
15: ; preds = %9, %15
%16 = phi i32 [ %29, %15 ], [ 0, %9 ]
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = add nsw i32 %18, %17
%20 = load i32, i32* %3
%21 = icmp sgt i32 %19, %20
%22 = add nsw i32 %20, %18
%23 = icmp sgt i32 %22, %17
%24 = select i1 %21, i1 %23, i1 false
%25 = add nsw i32 %20, %17
%26 = icmp sgt i32 %25, %18
%27 = select i1 %24, i1 %26, i1 false
%28 = zext i1 %27 to i32
%29 = add nuw nsw i32 %16, %28
%30 = call i64 @fscanf(i32* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%31 = load i64, i64* @EOF
%32 = icmp eq i64 %30, %31
br i1 %32, label %33, label %15
33: ; preds = %15, %9
%34 = phi i32 [ 0, %9 ], [ %29, %15 ]
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %34)
%36 = call i32 @fclose(i32* %4)
br label %37
37: ; preds = %33, %13
%38 = phi i32 [ -1, %13 ], [ 0, %33 ]
ret i32 %38
}