#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*/ bputc(int);
int /*<<< orphan*/ mwseek(int);
int mwtell();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ swbytealign();
void WriteJfif() {
  static char RoutineName[] = "WriteJfif";
  int Start, End;
  swbytealign();
  bputc(0xff);
  bputc(0xe0);
  Start = mwtell();
  {
    bputc((0 >> 8) & 0xff);
    bputc(0 & 0xff);
  };
  bputc(0x4a);
  bputc(0x46);
  bputc(0x49);
  bputc(0x46);
  bputc(0x00);
  bputc(0x01);
  bputc(0x02);
  bputc(0x00);
  {
    bputc((1 >> 8) & 0xff);
    bputc(1 & 0xff);
  };
  {
    bputc((1 >> 8) & 0xff);
    bputc(1 & 0xff);
  };
  bputc(0x00);
  bputc(0x00);
  End = mwtell();
  mwseek(Start);
  {
    bputc(((End - Start) >> 3 >> 8) & 0xff);
    bputc((End - Start) >> 3 & 0xff);
  };
  if ((Start - End) & 0x7) {
    printf("F>%s:R>%s:L>%d: ",
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/aaalgo/ljpeg/refs/heads/master/jpegdir/"
           "marker.c",
           RoutineName, 132);
    printf("Bad frame marker, not byte flush.\n");
  }
  mwseek(End);
}


x86 assembly (clang, -O0):
<WriteJfif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <swbytealign@plt>
mov    $0xff,%edi
call   1030 <bputc@plt>
mov    $0xe0,%edi
call   1030 <bputc@plt>
mov    $0x0,%al
call   1070 <mwtell@plt>
mov    %eax,-0x4(%rbp)
xor    %edi,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x4a,%edi
call   1030 <bputc@plt>
mov    $0x46,%edi
call   1030 <bputc@plt>
mov    $0x49,%edi
call   1030 <bputc@plt>
mov    $0x46,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x1,%edi
call   1030 <bputc@plt>
mov    $0x2,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x1,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x1,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x0,%al
call   1070 <mwtell@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <mwseek@plt>
mov    -0x8(%rbp),%edi
sub    -0x4(%rbp),%edi
sar    $0x3,%edi
sar    $0x8,%edi
and    $0xff,%edi
call   1030 <bputc@plt>
mov    -0x8(%rbp),%edi
sub    -0x4(%rbp),%edi
sar    $0x3,%edi
and    $0xff,%edi
call   1030 <bputc@plt>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
and    $0x7,%eax
cmp    $0x0,%eax
je     1283 <WriteJfif+0x133>
lea    0xda5(%rip),%rdi
lea    0xdaf(%rip),%rsi
lea    0x2ddf(%rip),%rdx
mov    $0x84,%ecx
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe1f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <mwseek@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteJfif>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1070 <swbytealign@plt>
mov    $0xff,%edi
call   1030 <bputc@plt>
mov    $0xe0,%edi
call   1030 <bputc@plt>
xor    %eax,%eax
call   1080 <mwtell@plt>
mov    %eax,%r14d
xor    %edi,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x4a,%edi
call   1030 <bputc@plt>
mov    $0x46,%edi
call   1030 <bputc@plt>
mov    $0x49,%edi
call   1030 <bputc@plt>
mov    $0x46,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x1,%edi
call   1030 <bputc@plt>
mov    $0x2,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x1,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
mov    $0x1,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
xor    %edi,%edi
call   1030 <bputc@plt>
xor    %eax,%eax
call   1080 <mwtell@plt>
mov    %eax,%ebp
mov    %r14d,%edi
call   1050 <mwseek@plt>
mov    %ebp,%eax
sub    %r14d,%eax
mov    %eax,%ebx
shr    $0x3,%ebx
shr    $0xb,%eax
movzbl %al,%edi
call   1030 <bputc@plt>
movzbl %bl,%edi
call   1030 <bputc@plt>
sub    %ebp,%r14d
test   $0x7,%r14b
je     1275 <WriteJfif+0x115>
lea    0xdb1(%rip),%rdi
lea    0xdbb(%rip),%rsi
lea    0x2df3(%rip),%rdx
mov    $0x84,%ecx
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe2b(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <mwseek@plt>

LLVM IR (-O0):
@WriteJfif.RoutineName = internal global [10 x i8] c"WriteJfif\00"
@.str = [17 x i8] c"F>%s:R>%s:L>%d: \00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aaalgo/ljpeg/refs/heads/master/jpegdir/marker.c\00"
@.str.2 = [35 x i8] c"Bad frame marker, not byte flush.\0A\00"
define void @WriteJfif() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @swbytealign()
%4 = call i32 @bputc(i32 255)
%5 = call i32 @bputc(i32 224)
%6 = call i32 (...) @mwtell()
store i32 %6, i32* %1
%7 = call i32 @bputc(i32 0)
%8 = call i32 @bputc(i32 0)
%9 = call i32 @bputc(i32 74)
%10 = call i32 @bputc(i32 70)
%11 = call i32 @bputc(i32 73)
%12 = call i32 @bputc(i32 70)
%13 = call i32 @bputc(i32 0)
%14 = call i32 @bputc(i32 1)
%15 = call i32 @bputc(i32 2)
%16 = call i32 @bputc(i32 0)
%17 = call i32 @bputc(i32 0)
%18 = call i32 @bputc(i32 1)
%19 = call i32 @bputc(i32 0)
%20 = call i32 @bputc(i32 1)
%21 = call i32 @bputc(i32 0)
%22 = call i32 @bputc(i32 0)
%23 = call i32 (...) @mwtell()
store i32 %23, i32* %2
%24 = load i32, i32* %1
%25 = call i32 @mwseek(i32 %24)
%26 = load i32, i32* %2
%27 = load i32, i32* %1
%28 = sub nsw i32 %26, %27
%29 = ashr i32 %28, 3
%30 = ashr i32 %29, 8
%31 = and i32 %30, 255
%32 = call i32 @bputc(i32 %31)
%33 = load i32, i32* %2
%34 = load i32, i32* %1
%35 = sub nsw i32 %33, %34
%36 = ashr i32 %35, 3
%37 = and i32 %36, 255
%38 = call i32 @bputc(i32 %37)
%39 = load i32, i32* %1
%40 = load i32, i32* %2
%41 = sub nsw i32 %39, %40
%42 = and i32 %41, 7
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @WriteJfif.RoutineName, i64 0, i64 0), i32 132)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %44, %0
%48 = load i32, i32* %2
%49 = call i32 @mwseek(i32 %48)
ret void
}

LLVM IR (-O2):
@WriteJfif.RoutineName = internal global [10 x i8] c"WriteJfif\00"
@.str = [17 x i8] c"F>%s:R>%s:L>%d: \00"
@.str.1 = [138 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/aaalgo/ljpeg/refs/heads/master/jpegdir/marker.c\00"
@str = [34 x i8] c"Bad frame marker, not byte flush.\00"
define void @WriteJfif() {
%1 = tail call i32 (...) @swbytealign()
%2 = tail call i32 @bputc(i32 255)
%3 = tail call i32 @bputc(i32 224)
%4 = tail call i32 (...) @mwtell()
%5 = tail call i32 @bputc(i32 0)
%6 = tail call i32 @bputc(i32 0)
%7 = tail call i32 @bputc(i32 74)
%8 = tail call i32 @bputc(i32 70)
%9 = tail call i32 @bputc(i32 73)
%10 = tail call i32 @bputc(i32 70)
%11 = tail call i32 @bputc(i32 0)
%12 = tail call i32 @bputc(i32 1)
%13 = tail call i32 @bputc(i32 2)
%14 = tail call i32 @bputc(i32 0)
%15 = tail call i32 @bputc(i32 0)
%16 = tail call i32 @bputc(i32 1)
%17 = tail call i32 @bputc(i32 0)
%18 = tail call i32 @bputc(i32 1)
%19 = tail call i32 @bputc(i32 0)
%20 = tail call i32 @bputc(i32 0)
%21 = tail call i32 (...) @mwtell()
%22 = tail call i32 @mwseek(i32 %4)
%23 = sub nsw i32 %21, %4
%24 = lshr i32 %23, 3
%25 = lshr i32 %23, 11
%26 = and i32 %25, 255
%27 = tail call i32 @bputc(i32 %26)
%28 = and i32 %24, 255
%29 = tail call i32 @bputc(i32 %28)
%30 = sub nsw i32 %4, %21
%31 = and i32 %30, 7
%32 = icmp eq i32 %31, 0
br i1 %32, label %36, label %33
33: ; preds = %0
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @WriteJfif.RoutineName, i64 0, i64 0), i32 132)
%35 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
br label %36
36: ; preds = %33, %0
%37 = tail call i32 @mwseek(i32 %21)
ret void
}