#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 */
int set_terminalname(char *);
int /*<<< orphan*/ systemlog(int, char *);
int put_default_terminalname() {
  int success = 0;
  systemlog(3, "put_default_terminalname");
  success = set_terminalname("xterm");
  if (success > 0)
    systemlog(93, "\t[DONE]");
  else
    systemlog(93, "\t[FAILD]");
  return success;
}


x86 assembly (clang, -O0):
<put_default_terminalname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x3,%edi
lea    0xec5(%rip),%rsi
call   1030 <systemlog@plt>
lea    0xed2(%rip),%rdi
call   1040 <set_terminalname@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    116f <put_default_terminalname+0x4f>
mov    $0x5d,%edi
lea    0xeba(%rip),%rsi
call   1030 <systemlog@plt>
jmp    1180 <put_default_terminalname+0x60>
mov    $0x5d,%edi
lea    0xeac(%rip),%rsi
call   1030 <systemlog@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_default_terminalname>:
push   %rbx
lea    0xed8(%rip),%rsi
mov    $0x3,%edi
call   1030 <systemlog@plt>
lea    0xee0(%rip),%rdi
call   1040 <set_terminalname@plt>
mov    %eax,%ebx
test   %eax,%eax
lea    0xed6(%rip),%rax
lea    0xed7(%rip),%rsi
cmovg  %rax,%rsi
mov    $0x5d,%edi
call   1030 <systemlog@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"put_default_terminalname\00"
@.str.1 = [6 x i8] c"xterm\00"
@.str.2 = [8 x i8] c"\09[DONE]\00"
@.str.3 = [9 x i8] c"\09[FAILD]\00"
define i32 @put_default_terminalname() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @systemlog(i32 3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @set_terminalname(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @systemlog(i32 93, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %10
8: ; preds = %0
%9 = call i32 @systemlog(i32 93, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %10
10: ; preds = %8, %6
%11 = load i32, i32* %1
ret i32 %11
}

LLVM IR (-O2):
@.str = [25 x i8] c"put_default_terminalname\00"
@.str.1 = [6 x i8] c"xterm\00"
@.str.2 = [8 x i8] c"\09[DONE]\00"
@.str.3 = [9 x i8] c"\09[FAILD]\00"
define i32 @put_default_terminalname() {
%1 = tail call i32 @systemlog(i32 3, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @set_terminalname(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp sgt i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%5 = tail call i32 @systemlog(i32 93, i8* %4)
ret i32 %2
}