#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 /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int cisize_(char *i1p, char *i2p) {
  int isize_val = 0;
  FILE *f = fopen("conftestval", "w");
  if (!f)
    return 1;
  isize_val = (int)(i2p - i1p);
  fprintf(f, "%d\n", isize_val);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<cisize_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xeb2(%rip),%rdi
lea    0xeb7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1175 <cisize_+0x45>
movl   $0x1,-0x4(%rbp)
jmp    11a6 <cisize_+0x76>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xe7d(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x28(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cisize_>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xebe(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1050 <fopen@plt>
test   %rax,%rax
je     1177 <cisize_+0x47>
mov    %rax,%rbx
sub    %r15d,%r14d
lea    0xeae(%rip),%rsi
mov    %rax,%rdi
mov    %r14d,%edx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
jmp    117c <cisize_+0x4c>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"conftestval\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @cisize_(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
%8 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %7
%9 = load i32*, i32** %7
%10 = icmp ne i32* %9, null
br i1 %10, label %12, label %11
11: ; preds = %2
store i32 1, i32* %3
br label %24
12: ; preds = %2
%13 = load i8*, i8** %5
%14 = load i8*, i8** %4
%15 = ptrtoint i8* %13 to i64
%16 = ptrtoint i8* %14 to i64
%17 = sub i64 %15, %16
%18 = trunc i64 %17 to i32
store i32 %18, i32* %6
%19 = load i32*, i32** %7
%20 = load i32, i32* %6
%21 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = load i32*, i32** %7
%23 = call i32 @fclose(i32* %22)
store i32 0, i32* %3
br label %24
24: ; preds = %12, %11
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [12 x i8] c"conftestval\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @cisize_(i8* %0, i8* %1) {
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %12, label %5
5: ; preds = %2
%6 = ptrtoint i8* %1 to i64
%7 = ptrtoint i8* %0 to i64
%8 = sub i64 %6, %7
%9 = trunc i64 %8 to i32
%10 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = tail call i32 @fclose(i32* %3)
br label %12
12: ; preds = %2, %5
%13 = phi i32 [ 0, %5 ], [ 1, %2 ]
ret i32 %13
}