#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 /*<<< orphan*/ STDERR_FILENO;
int strlen(char const *);
int /*<<< orphan*/ write(int /*<<< orphan*/, char const *, int);
void error(const char *s, const char *f) {
  write(STDERR_FILENO, "sum: ", 5);
  write(STDERR_FILENO, s, strlen(s));
  if (f)
    write(STDERR_FILENO, f, strlen(f));
  write(STDERR_FILENO, "\n", 1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
cmpq   $0x0,-0x10(%rbp)
je     11ab <error+0x8b>
mov    0x2e59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    0xe4b(%rip),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2eac(%rip),%r15
mov    (%r15),%edi
lea    0xec2(%rip),%rsi
mov    $0x5,%edx
call   1030 <write@plt>
mov    (%r15),%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
test   %r14,%r14
je     117b <error+0x5b>
mov    (%r15),%ebx
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    (%r15),%edi
lea    0xe81(%rip),%rsi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <write@plt>

LLVM IR (-O0):
@STDERR_FILENO = global i32 0
@.str = [6 x i8] c"sum: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @STDERR_FILENO
%6 = call i32 @write(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%7 = load i32, i32* @STDERR_FILENO
%8 = load i8*, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = call i32 @write(i32 %7, i8* %8, i32 %10)
%12 = load i8*, i8** %4
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i32, i32* @STDERR_FILENO
%16 = load i8*, i8** %4
%17 = load i8*, i8** %4
%18 = call i32 @strlen(i8* %17)
%19 = call i32 @write(i32 %15, i8* %16, i32 %18)
br label %20
20: ; preds = %14, %2
%21 = load i32, i32* @STDERR_FILENO
%22 = call i32 @write(i32 %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@STDERR_FILENO = global i32 0
@.str = [6 x i8] c"sum: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @error(i8* %0, i8* %1) {
%3 = load i32, i32* @STDERR_FILENO
%4 = tail call i32 @write(i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%5 = load i32, i32* @STDERR_FILENO
%6 = tail call i32 @strlen(i8* %0)
%7 = tail call i32 @write(i32 %5, i8* %0, i32 %6)
%8 = icmp eq i8* %1, null
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i32, i32* @STDERR_FILENO
%11 = tail call i32 @strlen(i8* %1)
%12 = tail call i32 @write(i32 %10, i8* %1, i32 %11)
br label %13
13: ; preds = %9, %2
%14 = load i32, i32* @STDERR_FILENO
%15 = tail call i32 @write(i32 %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 1)
ret void
}