#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 */
int atoi(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int strlen(char *);
int xmol_snap_bytesize(FILE *fxmol) {
  int natoms;
  int bytelen = 0;
  char text[100000];
  rewind(fxmol);
  fgets(text, 100000, fxmol);
  bytelen += strlen(text);
  natoms = atoi(text);
  fgets(text, 100000, fxmol);
  bytelen += strlen(text);
  fgets(text, 100000, fxmol);
  bytelen += (natoms * strlen(text));
  return bytelen;
}


x86 assembly (clang, -O0):
<xmol_snap_bytesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186c0,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rewind@plt>
lea    -0x186b0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x186a0,%esi
call   1050 <fgets@plt>
lea    -0x186b0(%rbp),%rdi
call   1030 <strlen@plt>
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    -0x186b0(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0xc(%rbp)
lea    -0x186b0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x186a0,%esi
call   1050 <fgets@plt>
lea    -0x186b0(%rbp),%rdi
call   1030 <strlen@plt>
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
lea    -0x186b0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x186a0,%esi
call   1050 <fgets@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x186b4(%rbp)
lea    -0x186b0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x186b4(%rbp),%eax
imul   %ecx,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x186c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmol_snap_bytesize>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x186a0,%rsp
mov    %rdi,%rbx
call   1040 <rewind@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x186a0,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   1060 <atoi@plt>
mov    %eax,%r15d
mov    %r14,%rdi
mov    $0x186a0,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
add    %r12d,%ebp
mov    %r14,%rdi
mov    $0x186a0,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
mov    %r14,%rdi
call   1030 <strlen@plt>
imul   %r15d,%eax
add    %ebp,%eax
add    $0x186a0,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @xmol_snap_bytesize(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca [100000 x i8]
store i32* %0, i32** %2
store i32 0, i32* %4
%6 = load i32*, i32** %2
%7 = call i32 @rewind(i32* %6)
%8 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%9 = load i32*, i32** %2
%10 = call i32 @fgets(i8* %8, i32 100000, i32* %9)
%11 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = load i32, i32* %4
%14 = add nsw i32 %13, %12
store i32 %14, i32* %4
%15 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %3
%17 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%18 = load i32*, i32** %2
%19 = call i32 @fgets(i8* %17, i32 100000, i32* %18)
%20 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = load i32, i32* %4
%23 = add nsw i32 %22, %21
store i32 %23, i32* %4
%24 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%25 = load i32*, i32** %2
%26 = call i32 @fgets(i8* %24, i32 100000, i32* %25)
%27 = load i32, i32* %3
%28 = getelementptr inbounds [100000 x i8], [100000 x i8]* %5, i64 0, i64 0
%29 = call i32 @strlen(i8* %28)
%30 = mul nsw i32 %27, %29
%31 = load i32, i32* %4
%32 = add nsw i32 %31, %30
store i32 %32, i32* %4
%33 = load i32, i32* %4
ret i32 %33
}

LLVM IR (-O2):
define i32 @xmol_snap_bytesize(i32* nocapture %0) {
%2 = alloca [100000 x i8]
%3 = getelementptr inbounds [100000 x i8], [100000 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @rewind(i32* %0)
%5 = call i32 @fgets(i8* %3, i32 100000, i32* %0)
%6 = call i32 @strlen(i8* %3)
%7 = call i32 @atoi(i8* %3)
%8 = call i32 @fgets(i8* %3, i32 100000, i32* %0)
%9 = call i32 @strlen(i8* %3)
%10 = add nsw i32 %9, %6
%11 = call i32 @fgets(i8* %3, i32 100000, i32* %0)
%12 = call i32 @strlen(i8* %3)
%13 = mul nsw i32 %12, %7
%14 = add nsw i32 %10, %13
ret i32 %14
}