#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 *appaserver_get_error_filename(char *);
int atoi(char *);
char *pipe2string(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int get_attribute_width(char *application, char *attribute_name) {
  char sys_string[1024];
  char *results;
  sprintf(sys_string, "width4attribute.sh %s %s 2>>%s", application,
          attribute_name, appaserver_get_error_filename(application));
  results = pipe2string(sys_string);
  if (!results)
    return 0;
  else
    return atoi(results);
}


x86 assembly (clang, -O0):
<get_attribute_width>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x440(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x438(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x430(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <appaserver_get_error_filename@plt>
mov    -0x440(%rbp),%rdi
mov    -0x438(%rbp),%rdx
mov    -0x430(%rbp),%rcx
mov    %rax,%r8
lea    0xe61(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x420(%rbp),%rdi
call   1030 <pipe2string@plt>
mov    %rax,-0x428(%rbp)
cmpq   $0x0,-0x428(%rbp)
jne    11d1 <get_attribute_width+0x91>
movl   $0x0,-0x4(%rbp)
jmp    11e0 <get_attribute_width+0xa0>
mov    -0x428(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_attribute_width>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <appaserver_get_error_filename@plt>
lea    0xea2(%rip),%rsi
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %rax,%r8
call   1060 <sprintf@plt>
mov    %r15,%rdi
call   1030 <pipe2string@plt>
test   %rax,%rax
je     1189 <get_attribute_width+0x49>
mov    %rax,%rdi
call   1050 <atoi@plt>
jmp    118b <get_attribute_width+0x4b>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"width4attribute.sh %s %s 2>>%s\00"
define i32 @get_attribute_width(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [1024 x i8]
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %4
%12 = call i8* @appaserver_get_error_filename(i8* %11)
%13 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i8* %12)
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%15 = call i8* @pipe2string(i8* %14)
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %19, label %18
18: ; preds = %2
store i32 0, i32* %3
br label %22
19: ; preds = %2
%20 = load i8*, i8** %7
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %3
br label %22
22: ; preds = %19, %18
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [31 x i8] c"width4attribute.sh %s %s 2>>%s\00"
define i32 @get_attribute_width(i8* %0, i8* %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = tail call i8* @appaserver_get_error_filename(i8* %0)
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %5)
%7 = call i8* @pipe2string(i8* %4)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %2
%10 = call i32 @atoi(i8* %7)
br label %11
11: ; preds = %2, %9
%12 = phi i32 [ %10, %9 ], [ 0, %2 ]
ret i32 %12
}