#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 errno;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ remove(char *);
char *strerror(int);
int main(int argc, char **argv) {
  printf("errno is: %d\n", errno);
  printf("Erasing file foo.bar\n");
  remove("foo.bar");
  printf("errno is: %d\n", errno);
  printf("the error message is: %s\n", strerror(errno));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xeb2(%rip),%rdi
call   1030 <remove@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %rax,%rsi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e95(%rip),%rbx
mov    (%rbx),%esi
lea    0xeac(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xec3(%rip),%rdi
call   1040 <puts@plt>
lea    0xec4(%rip),%rdi
call   1030 <remove@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%edi
call   1060 <strerror@plt>
lea    0xe7e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"errno is: %d\0A\00"
@errno = global i32 0
@.str.1 = [22 x i8] c"Erasing file foo.bar\0A\00"
@.str.2 = [8 x i8] c"foo.bar\00"
@.str.3 = [26 x i8] c"the error message is: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* @errno
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @remove(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%10 = load i32, i32* @errno
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* @errno
%13 = call i8* @strerror(i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"errno is: %d\0A\00"
@errno = global i32 0
@.str.2 = [8 x i8] c"foo.bar\00"
@.str.3 = [26 x i8] c"the error message is: %s\0A\00"
@str = [21 x i8] c"Erasing file foo.bar\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @errno
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @remove(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* @errno
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @errno
%10 = tail call i8* @strerror(i32 %9)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i8* %10)
ret i32 0
}