void seq(int fd, int last) {
  int i;
  char buf[1024];
  for (i = 1; i <= last; ++i) {
    snprintf(buf, sizeof(buf), "%d\n", i);
    if (!(write(fd, buf, strlen(buf)) > 0)) {
      do {
        char message[1024];
        snprintf(message, sizeof(message), "$failure @%s() (%s:%u)", __func__,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/redcap97/cyanurus/refs/"
                 "heads/master/src/test-user/unistd_pipe.c",
                 29);
        puts("\n"
             "--a94e2gfwdd--");
        puts(message);
        puts("$shudown");
        while (1)
          ;
      } while (0);
      ;
    };
  }
}


x86 assembly (clang, -O0):
<seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x820,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1239 <seq+0xf9>
lea    -0x410(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x400,%esi
lea    0xe86(%rip),%rdx
mov    $0x0,%al
call   1060 <snprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x81c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x818(%rbp)
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x81c(%rbp),%edi
mov    -0x818(%rbp),%rsi
mov    %rax,%rdx
mov    $0x0,%al
call   1040 <write@plt>
cmp    $0x0,%eax
jg     1226 <seq+0xe6>
jmp    11c9 <seq+0x89>
lea    -0x810(%rbp),%rdi
mov    $0x400,%esi
lea    0xe28(%rip),%rdx
lea    0xe38(%rip),%rcx
lea    0xe35(%rip),%r8
mov    $0x1d,%r9d
mov    $0x0,%al
call   1060 <snprintf@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    -0x810(%rbp),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
jmp    1221 <seq+0xe1>
jmp    122b <seq+0xeb>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1158 <seq+0x18>
add    $0x820,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seq>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x800,%rsp
test   %esi,%esi
jle    11b3 <seq+0x73>
mov    %esi,%r12d
mov    %edi,%r15d
neg    %r12d
mov    $0x1,%ebp
lea    0xe98(%rip),%r14
lea    0x400(%rsp),%rbx
mov    $0x400,%esi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1060 <snprintf@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <write@plt>
test   %eax,%eax
jle    11c3 <seq+0x83>
lea    (%r12,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1170 <seq+0x30>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe3a(%rip),%rdx
lea    0xe4a(%rip),%rcx
lea    0xe47(%rip),%r8
mov    %rsp,%rbx
mov    $0x400,%esi
mov    %rbx,%rdi
mov    $0x1d,%r9d
xor    %eax,%eax
call   1060 <snprintf@plt>
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
cs nopw 0x0(%rax,%rax,1)
jmp    1220 <seq+0xe0>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [23 x i8] c"$failure @%s() (%s:%u)\00"
@__func__.seq = [4 x i8] c"seq\00"
@.str.2 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/redcap97/cyanurus/refs/heads/master/src/test-user/unistd_pipe.c\00"
@.str.3 = [16 x i8] c"\0A--a94e2gfwdd--\00"
@.str.4 = [9 x i8] c"$shudown\00"
define void @seq(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %5
br label %8
8: ; preds = %33, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %36
12: ; preds = %8
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%14 = load i32, i32* %5
%15 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %13, i64 1024, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %3
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%19 = call i64 @strlen(i8* %18)
%20 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %16, i8* %17, i64 %19)
%21 = icmp sgt i32 %20, 0
br i1 %21, label %32, label %22
22: ; preds = %12
br label %23
23: ; preds = %22
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%25 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %24, i64 1024, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__func__.seq, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.2, i64 0, i64 0), i32 29)
%26 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%28 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %27)
%29 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %23, %30
br label %30
31: ; No predecessors!
br label %32
32: ; preds = %31, %12
br label %33
33: ; preds = %32
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %8
36: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [23 x i8] c"$failure @%s() (%s:%u)\00"
@__func__.seq = [4 x i8] c"seq\00"
@.str.2 = [154 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/redcap97/cyanurus/refs/heads/master/src/test-user/unistd_pipe.c\00"
@.str.3 = [16 x i8] c"\0A--a94e2gfwdd--\00"
@.str.4 = [9 x i8] c"$shudown\00"
define void @seq(i32 %0, i32 %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = icmp slt i32 %1, 1
br i1 %6, label %23, label %10
7: ; preds = %10
%8 = add nuw i32 %11, 1
%9 = icmp eq i32 %11, %1
br i1 %9, label %23, label %10
10: ; preds = %2, %7
%11 = phi i32 [ %8, %7 ], [ 1, %2 ]
%12 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %5, i64 1024, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i64 @strlen(i8* %5)
%14 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 %0, i8* %5, i64 %13)
%15 = icmp sgt i32 %14, 0
br i1 %15, label %7, label %16
16: ; preds = %10
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%18 = call i32 (i8*, i64, i8*, ...) @snprintf(i8* %17, i64 1024, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__func__.seq, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.2, i64 0, i64 0), i32 29)
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* %17)
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %22
22: ; preds = %22, %16
br label %22
23: ; preds = %7, %2
ret void
}