#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct TYPE_4__ {
  int min_width;
  int min_height;
  int max_width;
  int max_height;
  int step_width;
  int step_height;
};
struct TYPE_3__ {
  int width;
  int height;
};
struct v4l2_frmsizeenum {
  int type;
  TYPE_2__ stepwise;
  TYPE_1__ discrete;
};

/* Variables and functions */
#define V4L2_FRMSIZE_TYPE_CONTINUOUS 130
#define V4L2_FRMSIZE_TYPE_DISCRETE 129
#define V4L2_FRMSIZE_TYPE_STEPWISE 128
int enum_frame_size(int, int /*<<< orphan*/, struct v4l2_frmsizeenum **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(struct v4l2_frmsizeenum *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stdout;
void print_frame_sizes(int fd, uint32_t pixel_format) {
  struct v4l2_frmsizeenum *fsze = NULL;
  int frm_sz_cnt = enum_frame_size(fd, pixel_format, &fsze);
  if (frm_sz_cnt < 0) {
    perror("Error enumerating frame sizes for pixel format");
    return;
  }
  fprintf(stdout, "Not all/invalid frame sizes specified! Please select from "
                  "the following:\n");
  for (int i = 0; i < frm_sz_cnt; i++) {
    switch (fsze[i].type) {
    case V4L2_FRMSIZE_TYPE_DISCRETE:
      fprintf(stdout, "%dx%d\n", fsze[i].discrete.width,
              fsze[i].discrete.height);
      break;
    case V4L2_FRMSIZE_TYPE_STEPWISE:
      fprintf(stdout, "From %dx%d to %dx%d by %dx%d\n",
              fsze[i].stepwise.min_width, fsze[i].stepwise.min_height,
              fsze[i].stepwise.max_width, fsze[i].stepwise.max_height,
              fsze[i].stepwise.step_width, fsze[i].stepwise.step_height);
      break;
    case V4L2_FRMSIZE_TYPE_CONTINUOUS:
      fprintf(stdout, "Any dimension between %dx%d and %dx%d\n",
              fsze[i].stepwise.min_width, fsze[i].stepwise.min_height,
              fsze[i].stepwise.max_width, fsze[i].stepwise.max_height);
      break;
    default:
      fprintf(stdout,
              "Unable to show frame formats, this program does not know how to "
              "utilize this device. Got V4L2_FRMSIZE_TYPE: %d\n",
              fsze[i].type);
      break;
    }
  }
  free(fsze);
  fsze = NULL;
}


x86 assembly (clang, -O0):
<print_frame_sizes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
lea    -0x10(%rbp),%rdx
call   1030 <enum_frame_size@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1183 <print_frame_sizes+0x43>
lea    0xe87(%rip),%rdi
call   1060 <perror@plt>
jmp    137a <print_frame_sizes+0x23a>
mov    0x2e56(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1369 <print_frame_sizes+0x229>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
lea    (%rcx,%rcx,8),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x80,%eax
je     1235 <print_frame_sizes+0xf5>
jmp    11cf <print_frame_sizes+0x8f>
mov    -0x1c(%rbp),%eax
sub    $0x81,%eax
je     11f5 <print_frame_sizes+0xb5>
jmp    11e2 <print_frame_sizes+0xa2>
mov    -0x1c(%rbp),%eax
sub    $0x82,%eax
je     12c8 <print_frame_sizes+0x188>
jmp    132e <print_frame_sizes+0x1ee>
mov    0x2de4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    0x1c(%rax),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    0x20(%rax),%ecx
lea    0xe8e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1356 <print_frame_sizes+0x216>
mov    0x2da4(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
imul   $0x24,%rsi,%rsi
add    %rsi,%rax
mov    0xc(%rax),%r8d
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
imul   $0x24,%rsi,%rsi
add    %rsi,%rax
mov    0x10(%rax),%r9d
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
imul   $0x24,%rsi,%rsi
add    %rsi,%rax
mov    0x14(%rax),%r10d
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
imul   $0x24,%rsi,%rsi
add    %rsi,%rax
mov    0x18(%rax),%eax
lea    0xdc5(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1356 <print_frame_sizes+0x216>
mov    0x2d11(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    0x4(%rax),%edx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%ecx
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
imul   $0x24,%rsi,%rsi
add    %rsi,%rax
mov    0xc(%rax),%r8d
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rsi
imul   $0x24,%rsi,%rsi
add    %rsi,%rax
mov    0x10(%rax),%r9d
lea    0xd75(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1356 <print_frame_sizes+0x216>
mov    0x2cab(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
imul   $0x24,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%edx
lea    0xd6f(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    135b <print_frame_sizes+0x21b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11a1 <print_frame_sizes+0x61>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
movq   $0x0,-0x10(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_frame_sizes>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movq   $0x0,(%rsp)
mov    %rsp,%rdx
call   1030 <enum_frame_size@plt>
test   %eax,%eax
js     1283 <print_frame_sizes+0x143>
mov    %eax,%ebx
mov    0x2e74(%rip),%r13
mov    0x0(%r13),%edi
lea    0xeb8(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
test   %ebx,%ebx
je     126b <print_frame_sizes+0x12b>
mov    %ebx,%eax
shl    $0x2,%rax
lea    (%rax,%rax,8),%r12
lea    0xf27(%rip),%r15
xor    %r14d,%r14d
jmp    11bb <print_frame_sizes+0x7b>
nopl   0x0(%rax)
mov    0x0(%r13),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x24,%r14
cmp    %r14,%r12
je     126b <print_frame_sizes+0x12b>
mov    (%rsp),%rax
mov    (%rax,%r14,1),%edx
cmp    $0x80,%edx
je     1200 <print_frame_sizes+0xc0>
cmp    $0x82,%edx
je     1240 <print_frame_sizes+0x100>
cmp    $0x81,%edx
jne    11a0 <print_frame_sizes+0x60>
mov    0x0(%r13),%edi
mov    0x1c(%rax,%r14,1),%edx
mov    0x20(%rax,%r14,1),%ecx
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11ae <print_frame_sizes+0x6e>
nopl   0x0(%rax)
mov    0x0(%r13),%edi
mov    0x4(%rax,%r14,1),%edx
mov    0x8(%rax,%r14,1),%ecx
mov    0xc(%rax,%r14,1),%r8d
mov    0x10(%rax,%r14,1),%r9d
mov    0x14(%rax,%r14,1),%ebx
mov    0x18(%rax,%r14,1),%ebp
lea    0xe50(%rip),%rsi
xor    %eax,%eax
push   %rbp
push   %rbx
call   1050 <fprintf@plt>
add    $0x10,%rsp
jmp    11ae <print_frame_sizes+0x6e>
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13),%edi
mov    0x4(%rax,%r14,1),%edx
mov    0x8(%rax,%r14,1),%ecx
mov    0xc(%rax,%r14,1),%r8d
mov    0x10(%rax,%r14,1),%r9d
lea    0xe38(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    11ae <print_frame_sizes+0x6e>
mov    (%rsp),%rdi
call   1040 <free@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd76(%rip),%rdi
call   1060 <perror@plt>
jmp    1274 <print_frame_sizes+0x134>

LLVM IR (-O0):
%struct.v4l2_frmsizeenum = type { i32, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i32, i32, i32, i32, i32 }
%struct.TYPE_3__ = type { i32, i32 }
@.str = [47 x i8] c"Error enumerating frame sizes for pixel format\00"
@stdout = global i32 0
@.str.1 = [74 x i8] c"Not all/invalid frame sizes specified! Please select from the following:\0A\00"
@.str.2 = [7 x i8] c"%dx%d\0A\00"
@.str.3 = [30 x i8] c"From %dx%d to %dx%d by %dx%d\0A\00"
@.str.4 = [39 x i8] c"Any dimension between %dx%d and %dx%d\0A\00"
@.str.5 = [112 x i8] c"Unable to show frame formats, this program does not know how to utilize this device. Got V4L2_FRMSIZE_TYPE: %d\0A\00"
define void @print_frame_sizes(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.v4l2_frmsizeenum*
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store %struct.v4l2_frmsizeenum* null, %struct.v4l2_frmsizeenum** %5
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @enum_frame_size(i32 %8, i32 %9, %struct.v4l2_frmsizeenum** %5)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %138
15: ; preds = %2
%16 = load i32, i32* @stdout
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %7
br label %18
18: ; preds = %132, %15
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %135
22: ; preds = %18
%23 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %23, i64 %25
%27 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %26, i32 0, i32 0
%28 = load i32, i32* %27
switch i32 %28, label %122 [
i32 129, label %29
i32 128, label %46
i32 130, label %91
]
29: ; preds = %22
%30 = load i32, i32* @stdout
%31 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %31, i64 %33
%35 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %34, i32 0, i32 2
%36 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %35, i32 0, i32 0
%37 = load i32, i32* %36
%38 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %38, i64 %40
%42 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %41, i32 0, i32 2
%43 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %42, i32 0, i32 1
%44 = load i32, i32* %43
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %37, i32 %44)
br label %131
46: ; preds = %22
%47 = load i32, i32* @stdout
%48 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %48, i64 %50
%52 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %51, i32 0, i32 1
%53 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %52, i32 0, i32 0
%54 = load i32, i32* %53
%55 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %55, i64 %57
%59 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %58, i32 0, i32 1
%60 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %59, i32 0, i32 1
%61 = load i32, i32* %60
%62 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%63 = load i32, i32* %7
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %62, i64 %64
%66 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %65, i32 0, i32 1
%67 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %66, i32 0, i32 2
%68 = load i32, i32* %67
%69 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%70 = load i32, i32* %7
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %69, i64 %71
%73 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %72, i32 0, i32 1
%74 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %73, i32 0, i32 3
%75 = load i32, i32* %74
%76 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%77 = load i32, i32* %7
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %76, i64 %78
%80 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %79, i32 0, i32 1
%81 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %80, i32 0, i32 4
%82 = load i32, i32* %81
%83 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%84 = load i32, i32* %7
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %83, i64 %85
%87 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %86, i32 0, i32 1
%88 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %87, i32 0, i32 5
%89 = load i32, i32* %88
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %54, i32 %61, i32 %68, i32 %75, i32 %82, i32 %89)
br label %131
91: ; preds = %22
%92 = load i32, i32* @stdout
%93 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%94 = load i32, i32* %7
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %93, i64 %95
%97 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %96, i32 0, i32 1
%98 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %97, i32 0, i32 0
%99 = load i32, i32* %98
%100 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%101 = load i32, i32* %7
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %100, i64 %102
%104 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %103, i32 0, i32 1
%105 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %104, i32 0, i32 1
%106 = load i32, i32* %105
%107 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%108 = load i32, i32* %7
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %107, i64 %109
%111 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %110, i32 0, i32 1
%112 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %111, i32 0, i32 2
%113 = load i32, i32* %112
%114 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%115 = load i32, i32* %7
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %114, i64 %116
%118 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %117, i32 0, i32 1
%119 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %118, i32 0, i32 3
%120 = load i32, i32* %119
%121 = call i32 (i32, i8*, ...) @fprintf(i32 %92, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %99, i32 %106, i32 %113, i32 %120)
br label %131
122: ; preds = %22
%123 = load i32, i32* @stdout
%124 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%125 = load i32, i32* %7
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %124, i64 %126
%128 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %127, i32 0, i32 0
%129 = load i32, i32* %128
%130 = call i32 (i32, i8*, ...) @fprintf(i32 %123, i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str.5, i64 0, i64 0), i32 %129)
br label %131
131: ; preds = %122, %91, %46, %29
br label %132
132: ; preds = %131
%133 = load i32, i32* %7
%134 = add nsw i32 %133, 1
store i32 %134, i32* %7
br label %18
135: ; preds = %18
%136 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %5
%137 = call i32 @free(%struct.v4l2_frmsizeenum* %136)
store %struct.v4l2_frmsizeenum* null, %struct.v4l2_frmsizeenum** %5
br label %138
138: ; preds = %135, %13
ret void
}

LLVM IR (-O2):
%struct.v4l2_frmsizeenum = type { i32, %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i32, i32, i32, i32, i32, i32 }
%struct.TYPE_3__ = type { i32, i32 }
@.str = [47 x i8] c"Error enumerating frame sizes for pixel format\00"
@stdout = global i32 0
@.str.1 = [74 x i8] c"Not all/invalid frame sizes specified! Please select from the following:\0A\00"
@.str.2 = [7 x i8] c"%dx%d\0A\00"
@.str.3 = [30 x i8] c"From %dx%d to %dx%d by %dx%d\0A\00"
@.str.4 = [39 x i8] c"Any dimension between %dx%d and %dx%d\0A\00"
@.str.5 = [112 x i8] c"Unable to show frame formats, this program does not know how to utilize this device. Got V4L2_FRMSIZE_TYPE: %d\0A\00"
define void @print_frame_sizes(i32 %0, i32 %1) {
%3 = alloca %struct.v4l2_frmsizeenum*
%4 = bitcast %struct.v4l2_frmsizeenum** %3 to i8*
store %struct.v4l2_frmsizeenum* null, %struct.v4l2_frmsizeenum** %3
%5 = call i32 @enum_frame_size(i32 %0, i32 %1, %struct.v4l2_frmsizeenum** %3)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @perror(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %62
9: ; preds = %2
%10 = load i32, i32* @stdout
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %5, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = zext i32 %5 to i64
br label %18
15: ; preds = %59, %9
%16 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %3
%17 = call i32 @free(%struct.v4l2_frmsizeenum* %16)
br label %62
18: ; preds = %13, %59
%19 = phi i64 [ 0, %13 ], [ %60, %59 ]
%20 = load %struct.v4l2_frmsizeenum*, %struct.v4l2_frmsizeenum** %3
%21 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 0
%22 = load i32, i32* %21
switch i32 %22, label %56 [
i32 129, label %23
i32 128, label %30
i32 130, label %45
]
23: ; preds = %18
%24 = load i32, i32* @stdout
%25 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 2, i32 0
%26 = load i32, i32* %25
%27 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 2, i32 1
%28 = load i32, i32* %27
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %28)
br label %59
30: ; preds = %18
%31 = load i32, i32* @stdout
%32 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 0
%33 = load i32, i32* %32
%34 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 1
%35 = load i32, i32* %34
%36 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 2
%37 = load i32, i32* %36
%38 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 3
%39 = load i32, i32* %38
%40 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 4
%41 = load i32, i32* %40
%42 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 5
%43 = load i32, i32* %42
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %33, i32 %35, i32 %37, i32 %39, i32 %41, i32 %43)
br label %59
45: ; preds = %18
%46 = load i32, i32* @stdout
%47 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 0
%48 = load i32, i32* %47
%49 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 1
%50 = load i32, i32* %49
%51 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 2
%52 = load i32, i32* %51
%53 = getelementptr inbounds %struct.v4l2_frmsizeenum, %struct.v4l2_frmsizeenum* %20, i64 %19, i32 1, i32 3
%54 = load i32, i32* %53
%55 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i32 %48, i32 %50, i32 %52, i32 %54)
br label %59
56: ; preds = %18
%57 = load i32, i32* @stdout
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([112 x i8], [112 x i8]* @.str.5, i64 0, i64 0), i32 %22)
br label %59
59: ; preds = %23, %30, %45, %56
%60 = add nuw nsw i64 %19, 1
%61 = icmp eq i64 %60, %14
br i1 %61, label %15, label %18
62: ; preds = %15, %7
ret void
}