#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 ssize_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char **);
int getdelim(char **, size_t *, char, int /*<<< orphan*/ *);
int git_release_ssh_public_key_type(char **out, char *public_key_path) {
  FILE *file;
  file = fopen(public_key_path, "r");
  size_t len = 0;
  ssize_t bytes_read = getdelim(out, &len, ' ', file);
  if (bytes_read == -1) {
    fclose(file);
    free(out);
    return 1;
  }
  fclose(file);
  return 0;
}


x86 assembly (clang, -O0):
<git_release_ssh_public_key_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xea5(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rcx
lea    -0x28(%rbp),%rsi
mov    $0x20,%edx
call   1060 <getdelim@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    11ad <git_release_ssh_public_key_type+0x6d>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
jmp    11bd <git_release_ssh_public_key_type+0x7d>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<git_release_ssh_public_key_type>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rax
mov    %rdi,%r14
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
call   1050 <fopen@plt>
mov    %rax,%rbx
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
mov    $0x20,%edx
mov    %rax,%rcx
call   1060 <getdelim@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
cmp    $0xffffffff,%ebp
jne    119c <git_release_ssh_public_key_type+0x5c>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
define i32 @git_release_ssh_public_key_type(i8** %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
%9 = load i8*, i8** %5
%10 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %6
store i64 0, i64* %7
%11 = load i8**, i8*** %4
%12 = load i32*, i32** %6
%13 = call i32 @getdelim(i8** %11, i64* %7, i8 signext 32, i32* %12)
store i32 %13, i32* %8
%14 = load i32, i32* %8
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i32*, i32** %6
%18 = call i32 @fclose(i32* %17)
%19 = load i8**, i8*** %4
%20 = call i32 @free(i8** %19)
store i32 1, i32* %3
br label %24
21: ; preds = %2
%22 = load i32*, i32** %6
%23 = call i32 @fclose(i32* %22)
store i32 0, i32* %3
br label %24
24: ; preds = %21, %16
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @git_release_ssh_public_key_type(i8** %0, i8* nocapture %1) {
%3 = alloca i64
%4 = tail call i32* @fopen(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = bitcast i64* %3 to i8*
store i64 0, i64* %3
%6 = call i32 @getdelim(i8** %0, i64* %3, i8 signext 32, i32* %4)
%7 = icmp eq i32 %6, -1
%8 = call i32 @fclose(i32* %4)
br i1 %7, label %9, label %11
9: ; preds = %2
%10 = call i32 @free(i8** %0)
br label %11
11: ; preds = %2, %9
%12 = phi i32 [ 1, %9 ], [ 0, %2 ]
ret i32 %12
}