#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*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
void error(char *function, char *input) {
  int i;
  for (i = 0; i < 80; i++) {
    printf("*");
  }
  putchar('\n');
  perror(function);
  printf("%s\n", input);
  for (i = 0; i < 80; i++) {
    printf("*");
  }
  putchar('\n');
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x50,-0x14(%rbp)
jge    116d <error+0x3d>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <error+0x17>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rdi
call   1050 <perror@plt>
mov    -0x10(%rbp),%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x50,-0x14(%rbp)
jge    11bf <error+0x8f>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1199 <error+0x69>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x50,%ebp
nop
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1140 <error+0x10>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1050 <perror@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    $0x50,%ebx
xchg   %ax,%ax
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1170 <error+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"*\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
br label %6
6: ; preds = %11, %2
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 80
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
store i32 %13, i32* %5
br label %6
14: ; preds = %6
%15 = call i32 @putchar(i8 signext 10)
%16 = load i8*, i8** %3
%17 = call i32 @perror(i8* %16)
%18 = load i8*, i8** %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %18)
store i32 0, i32* %5
br label %20
20: ; preds = %25, %14
%21 = load i32, i32* %5
%22 = icmp slt i32 %21, 80
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %23
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %20
28: ; preds = %20
%29 = call i32 @putchar(i8 signext 10)
ret void
}

LLVM IR (-O2):
define void @error(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %6, %3 ]
%5 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 80
br i1 %7, label %8, label %3
8: ; preds = %3
%9 = tail call i32 @putchar(i8 signext 10)
%10 = tail call i32 @perror(i8* %0)
%11 = tail call i32 @puts(i8* dereferenceable(1) %1)
br label %12
12: ; preds = %8, %12
%13 = phi i32 [ 0, %8 ], [ %15, %12 ]
%14 = tail call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 42)
%15 = add nuw nsw i32 %13, 1
%16 = icmp eq i32 %15, 80
br i1 %16, label %17, label %12
17: ; preds = %12
%18 = tail call i32 @putchar(i8 signext 10)
ret void
}