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

/* Variables and functions */
char *pipe2string(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ timlib_file_exists(char *);
char *timlib_sha256sum(char *input_filename) {
  char sys_string[1024];
  if (!timlib_file_exists(input_filename))
    return (char *)0;
  sprintf(sys_string,
          "cat \"%s\"			|"
          "sha256sum			|"
          "column.e 0			 ",
          input_filename);
  return pipe2string(sys_string);
}


x86 assembly (clang, -O0):
<timlib_sha256sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <timlib_file_exists@plt>
cmp    $0x0,%eax
jne    115e <timlib_sha256sum+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    1185 <timlib_sha256sum+0x55>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe90(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
call   1030 <pipe2string@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timlib_sha256sum>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
call   1040 <timlib_file_exists@plt>
test   %eax,%eax
je     1165 <timlib_sha256sum+0x35>
lea    0xeb3(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <pipe2string@plt>
jmp    1167 <timlib_sha256sum+0x37>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [40 x i8] c"cat \22%s\22\09\09\09|sha256sum\09\09\09|column.e 0\09\09\09 \00"
define i8* @timlib_sha256sum(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [1024 x i8]
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @timlib_file_exists(i8* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %1
store i8* null, i8** %2
br label %15
9: ; preds = %1
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = load i8*, i8** %3
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%14 = call i8* @pipe2string(i8* %13)
store i8* %14, i8** %2
br label %15
15: ; preds = %9, %8
%16 = load i8*, i8** %2
ret i8* %16
}

LLVM IR (-O2):
@.str = [40 x i8] c"cat \22%s\22\09\09\09|sha256sum\09\09\09|column.e 0\09\09\09 \00"
define i8* @timlib_sha256sum(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @timlib_file_exists(i8* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = call i8* @pipe2string(i8* %3)
br label %9
9: ; preds = %1, %6
%10 = phi i8* [ %8, %6 ], [ null, %1 ]
ret i8* %10
}