#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 EXIT_FAILURE;
int EXIT_SUCCESS;
float atof(int /*<<< orphan*/);
int atoi(int /*<<< orphan*/);
int extrapolate(int, int, float, float, char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ usage(int /*<<< orphan*/, char const *);
int main(int argc, char *argv[]) {
  const char *pname = argv[0];
  if (argc <= 1) {
    usage(stderr, pname);
    return EXIT_FAILURE;
  }
  bool wb, hb;
  int w, h, opt;
  float sx, sy;
  wb = hb = false;
  w = h = 0;
  sx = sy = -1.0;
  while ((opt = getopt(argc, argv, "Hw:h:x:y:")) != -1) {
    switch (opt) {
    case 'H':
      usage(stdout, pname);
      return EXIT_SUCCESS;
    case 'h':
      h = atoi(optarg);
      hb = true;
      break;
    case 'w':
      w = atoi(optarg);
      wb = true;
      break;
    case 'x':
      sx = atof(optarg);
      break;
    case 'y':
      sy = atof(optarg);
      break;
    default:
      fprintf(stderr, "Unknown argument '%c'\n", opt);
      usage(stderr, pname);
      return EXIT_FAILURE;
    }
  }
  if (!wb || !hb) {
    fprintf(stderr, "Missing argument for width or height\n");
    return EXIT_FAILURE;
  }
  if (argc - optind != 2) {
    fprintf(
        stderr,
        "Expected two arguments (input file, output file) after options.\n");
    return EXIT_FAILURE;
  }
  return extrapolate(w, h, sx, sy, argv[optind], argv[optind + 1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     11ae <main+0x4e>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
call   1060 <usage@plt>
mov    0x2e24(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13b5 <main+0x255>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
movss  0xe2e(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  0xe21(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xeda(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x2c(%rbp)
cmp    $0xffffffff,%eax
je     12fb <main+0x19b>
mov    -0x2c(%rbp),%eax
add    $0xffffffb8,%eax
mov    %eax,%ecx
mov    %rcx,-0x40(%rbp)
sub    $0x31,%eax
ja     12b9 <main+0x159>
mov    -0x40(%rbp),%rax
lea    0xde1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
call   1060 <usage@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13b5 <main+0x255>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x20(%rbp)
jmp    12f6 <main+0x196>
mov    0x2d85(%rip),%rax
mov    (%rax),%edi
call   1080 <atoi@plt>
mov    %eax,-0x24(%rbp)
movl   $0x1,-0x1c(%rbp)
jmp    12f6 <main+0x196>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
call   1030 <atof@plt>
movss  %xmm0,-0x30(%rbp)
jmp    12f6 <main+0x196>
mov    0x2d50(%rip),%rax
mov    (%rax),%edi
call   1030 <atof@plt>
movss  %xmm0,-0x34(%rbp)
jmp    12f6 <main+0x196>
mov    0x2d10(%rip),%rax
mov    (%rax),%edi
mov    -0x2c(%rbp),%edx
lea    0xe0a(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2cf6(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
call   1060 <usage@plt>
mov    0x2cdc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13b5 <main+0x255>
jmp    11e4 <main+0x84>
cmpl   $0x0,-0x1c(%rbp)
je     130f <main+0x1af>
cmpl   $0x0,-0x20(%rbp)
jne    1337 <main+0x1d7>
mov    0x2cba(%rip),%rax
mov    (%rax),%edi
lea    0xdce(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2c9b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13b5 <main+0x255>
mov    -0x8(%rbp),%eax
mov    0x2c9f(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x2,%eax
je     1374 <main+0x214>
mov    0x2c7d(%rip),%rax
mov    (%rax),%edi
lea    0xdb7(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2c5e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    13b5 <main+0x255>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
movss  -0x30(%rbp),%xmm0
movss  -0x34(%rbp),%xmm1
mov    -0x10(%rbp),%rax
mov    0x2c51(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdx
mov    -0x10(%rbp),%rax
mov    0x2c3f(%rip),%rcx
mov    (%rcx),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rcx
call   1050 <extrapolate@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    (%rsi),%r14
cmp    $0x2,%edi
jge    1184 <main+0x24>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
jmp    12cc <main+0x16c>
mov    %rsi,%rbx
mov    %edi,%ebp
movss  0xe6f(%rip),%xmm0
movl   $0x0,0xc(%rsp)
lea    0xe64(%rip),%r13
mov    0x2e51(%rip),%r15
movl   $0x0,0x10(%rsp)
xor    %r12d,%r12d
movl   $0x0,0x4(%rsp)
movss  %xmm0,0x8(%rsp)
jmp    11d8 <main+0x78>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r15),%edi
call   1030 <atof@plt>
movss  %xmm0,0x14(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r13,%rdx
call   1070 <getopt@plt>
cmp    $0x79,%eax
je     11d0 <main+0x70>
cmp    $0x67,%eax
jle    1240 <main+0xe0>
cmp    $0x68,%eax
je     1218 <main+0xb8>
cmp    $0x77,%eax
je     122c <main+0xcc>
cmp    $0x78,%eax
jne    12b1 <main+0x151>
mov    (%r15),%edi
call   1030 <atof@plt>
movss  %xmm0,0x8(%rsp)
jmp    11de <main+0x7e>
mov    (%r15),%edi
call   1080 <atoi@plt>
mov    %eax,0x4(%rsp)
mov    $0x1,%r12d
jmp    11de <main+0x7e>
mov    (%r15),%edi
call   1080 <atoi@plt>
mov    %eax,0xc(%rsp)
mov    $0x1,%al
mov    %eax,0x10(%rsp)
jmp    11de <main+0x7e>
cmp    $0xffffffff,%eax
je     1264 <main+0x104>
cmp    $0x48,%eax
jne    12b1 <main+0x151>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   1060 <usage@plt>
mov    0x2d56(%rip),%rax
jmp    12db <main+0x17b>
test   %r12d,%r12d
setne  %al
test   %al,0x10(%rsp)
je     12ec <main+0x18c>
mov    0x2d69(%rip),%rax
movslq (%rax),%rax
sub    %eax,%ebp
cmp    $0x2,%ebp
jne    12fe <main+0x19e>
mov    (%rbx,%rax,8),%rdx
mov    0x8(%rbx,%rax,8),%rcx
mov    0xc(%rsp),%edi
mov    0x4(%rsp),%esi
movss  0x8(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <extrapolate@plt>
mov    0x2d18(%rip),%rbx
mov    (%rbx),%edi
lea    0xd4d(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
mov    %r14,%rsi
call   1060 <usage@plt>
mov    0x2ced(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2cdd(%rip),%rax
mov    (%rax),%edi
lea    0xd29(%rip),%rsi
jmp    130e <main+0x1ae>
mov    0x2ccb(%rip),%rax
mov    (%rax),%edi
lea    0xd3d(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
jmp    12d4 <main+0x174>

LLVM IR (-O0):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [10 x i8] c"Hw:h:x:y:\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
@optarg = global i32 0
@.str.1 = [23 x i8] c"Unknown argument '%c'\0A\00"
@.str.2 = [38 x i8] c"Missing argument for width or height\0A\00"
@optind = global i32 0
@.str.3 = [65 x i8] c"Expected two arguments (input file, output file) after options.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca float
%13 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i32, i32* %4
%18 = icmp sle i32 %17, 1
br i1 %18, label %19, label %24
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %6
%22 = call i32 @usage(i32 %20, i8* %21)
%23 = load i32, i32* @EXIT_FAILURE
store i32 %23, i32* %3
br label %94
24: ; preds = %2
store i32 0, i32* %8
store i32 0, i32* %7
store i32 0, i32* %10
store i32 0, i32* %9
store float -1.000000e+00, float* %13
store float -1.000000e+00, float* %12
br label %25
25: ; preds = %57, %24
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call i32 @getopt(i32 %26, i8** %27, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 %28, i32* %11
%29 = icmp ne i32 %28, -1
br i1 %29, label %30, label %58
30: ; preds = %25
%31 = load i32, i32* %11
switch i32 %31, label %49 [
i32 72, label %32
i32 104, label %37
i32 119, label %40
i32 120, label %43
i32 121, label %46
]
32: ; preds = %30
%33 = load i32, i32* @stdout
%34 = load i8*, i8** %6
%35 = call i32 @usage(i32 %33, i8* %34)
%36 = load i32, i32* @EXIT_SUCCESS
store i32 %36, i32* %3
br label %94
37: ; preds = %30
%38 = load i32, i32* @optarg
%39 = call i32 @atoi(i32 %38)
store i32 %39, i32* %10
store i32 1, i32* %8
br label %57
40: ; preds = %30
%41 = load i32, i32* @optarg
%42 = call i32 @atoi(i32 %41)
store i32 %42, i32* %9
store i32 1, i32* %7
br label %57
43: ; preds = %30
%44 = load i32, i32* @optarg
%45 = call float @atof(i32 %44)
store float %45, float* %12
br label %57
46: ; preds = %30
%47 = load i32, i32* @optarg
%48 = call float @atof(i32 %47)
store float %48, float* %13
br label %57
49: ; preds = %30
%50 = load i32, i32* @stderr
%51 = load i32, i32* %11
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = load i32, i32* @stderr
%54 = load i8*, i8** %6
%55 = call i32 @usage(i32 %53, i8* %54)
%56 = load i32, i32* @EXIT_FAILURE
store i32 %56, i32* %3
br label %94
57: ; preds = %46, %43, %40, %37
br label %25
58: ; preds = %25
%59 = load i32, i32* %7
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = load i32, i32* %8
%63 = icmp ne i32 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %61, %58
%65 = load i32, i32* @stderr
%66 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%67 = load i32, i32* @EXIT_FAILURE
store i32 %67, i32* %3
br label %94
68: ; preds = %61
%69 = load i32, i32* %4
%70 = load i32, i32* @optind
%71 = sub nsw i32 %69, %70
%72 = icmp ne i32 %71, 2
br i1 %72, label %73, label %77
73: ; preds = %68
%74 = load i32, i32* @stderr
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %74, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0))
%76 = load i32, i32* @EXIT_FAILURE
store i32 %76, i32* %3
br label %94
77: ; preds = %68
%78 = load i32, i32* %9
%79 = load i32, i32* %10
%80 = load float, float* %12
%81 = load float, float* %13
%82 = load i8**, i8*** %5
%83 = load i32, i32* @optind
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8*, i8** %82, i64 %84
%86 = load i8*, i8** %85
%87 = load i8**, i8*** %5
%88 = load i32, i32* @optind
%89 = add nsw i32 %88, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8*, i8** %87, i64 %90
%92 = load i8*, i8** %91
%93 = call i32 @extrapolate(i32 %78, i32 %79, float %80, float %81, i8* %86, i8* %92)
store i32 %93, i32* %3
br label %94
94: ; preds = %77, %73, %64, %49, %32, %19
%95 = load i32, i32* %3
ret i32 %95
}

LLVM IR (-O2):
@stderr = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [10 x i8] c"Hw:h:x:y:\00"
@stdout = global i32 0
@EXIT_SUCCESS = global i32 0
@optarg = global i32 0
@.str.1 = [23 x i8] c"Unknown argument '%c'\0A\00"
@.str.2 = [38 x i8] c"Missing argument for width or height\0A\00"
@optind = global i32 0
@.str.3 = [65 x i8] c"Expected two arguments (input file, output file) after options.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %22
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @usage(i32 %6, i8* %3)
%8 = load i32, i32* @EXIT_FAILURE
br label %73
9: ; preds = %37, %40
%10 = phi float [ %42, %40 ], [ %39, %37 ]
%11 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
switch i32 %11, label %43 [
i32 -1, label %49
i32 72, label %12
i32 104, label %16
i32 119, label %19
i32 120, label %34
i32 121, label %40
]
12: ; preds = %9
%13 = load i32, i32* @stdout
%14 = tail call i32 @usage(i32 %13, i8* %3)
%15 = load i32, i32* @EXIT_SUCCESS
br label %73
16: ; preds = %9
%17 = load i32, i32* @optarg
%18 = tail call i32 @atoi(i32 %17)
br label %29
19: ; preds = %9
%20 = load i32, i32* @optarg
%21 = tail call i32 @atoi(i32 %20)
br label %22
22: ; preds = %2, %19
%23 = phi i1 [ true, %19 ], [ false, %2 ]
%24 = phi i32 [ %30, %19 ], [ 0, %2 ]
%25 = phi i32 [ %21, %19 ], [ 0, %2 ]
%26 = phi i32 [ %31, %19 ], [ 0, %2 ]
%27 = phi float [ %38, %19 ], [ -1.000000e+00, %2 ]
%28 = phi float [ %10, %19 ], [ -1.000000e+00, %2 ]
br label %29
29: ; preds = %22, %16
%30 = phi i32 [ %24, %22 ], [ 1, %16 ]
%31 = phi i32 [ %26, %22 ], [ %18, %16 ]
%32 = phi float [ %27, %22 ], [ %38, %16 ]
%33 = phi float [ %28, %22 ], [ %10, %16 ]
br label %37
34: ; preds = %9
%35 = load i32, i32* @optarg
%36 = tail call float @atof(i32 %35)
br label %37
37: ; preds = %29, %34
%38 = phi float [ %32, %29 ], [ %36, %34 ]
%39 = phi float [ %33, %29 ], [ %10, %34 ]
br label %9
40: ; preds = %9
%41 = load i32, i32* @optarg
%42 = tail call float @atof(i32 %41)
br label %9
43: ; preds = %9
%44 = load i32, i32* @stderr
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%46 = load i32, i32* @stderr
%47 = tail call i32 @usage(i32 %46, i8* %3)
%48 = load i32, i32* @EXIT_FAILURE
br label %73
49: ; preds = %9
%50 = icmp ne i32 %30, 0
%51 = select i1 %23, i1 %50, i1 false
br i1 %51, label %56, label %52
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = tail call i32 (i32, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%55 = load i32, i32* @EXIT_FAILURE
br label %73
56: ; preds = %49
%57 = load i32, i32* @optind
%58 = sub nsw i32 %0, %57
%59 = icmp eq i32 %58, 2
br i1 %59, label %64, label %60
60: ; preds = %56
%61 = load i32, i32* @stderr
%62 = tail call i32 (i32, i8*, ...) @fprintf(i32 %61, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.3, i64 0, i64 0))
%63 = load i32, i32* @EXIT_FAILURE
br label %73
64: ; preds = %56
%65 = sext i32 %57 to i64
%66 = getelementptr inbounds i8*, i8** %1, i64 %65
%67 = load i8*, i8** %66
%68 = add nsw i32 %57, 1
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds i8*, i8** %1, i64 %69
%71 = load i8*, i8** %70
%72 = tail call i32 @extrapolate(i32 %25, i32 %31, float %38, float %10, i8* %67, i8* %71)
br label %73
73: ; preds = %12, %43, %52, %60, %64, %5
%74 = phi i32 [ %8, %5 ], [ %48, %43 ], [ %15, %12 ], [ %63, %60 ], [ %72, %64 ], [ %55, %52 ]
ret i32 %74
}