#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*/ FS460_get_tv_active_lines(int *);
int FS460_set_brightness(int);
int FS460_set_color(int);
int FS460_set_contrast(int);
int FS460_set_flicker_filter(int);
int FS460_set_sharpness(int);
int FS460_set_vga_position(int, int, int, int);
int /*<<< orphan*/ printf(char *);
void reset_defaults(void) {
  int err;
  int lines;
  FS460_get_tv_active_lines(&lines);
  err = FS460_set_vga_position(20, 20, 680, lines - 40);
  err |= FS460_set_flicker_filter(1000);
  err |= FS460_set_sharpness(200);
  err |= FS460_set_color(50);
  err |= FS460_set_brightness(50);
  err |= FS460_set_contrast(60);
  if (err)
    printf("Error writing defaults.\n");
}


x86 assembly (clang, -O0):
<reset_defaults>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
call   1030 <FS460_get_tv_active_lines@plt>
mov    -0x8(%rbp),%ecx
sub    $0x28,%ecx
mov    $0x14,%esi
mov    $0x2a8,%edx
mov    %esi,%edi
call   1080 <FS460_set_vga_position@plt>
mov    %eax,-0x4(%rbp)
mov    $0x3e8,%edi
call   1090 <FS460_set_flicker_filter@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0xc8,%edi
call   1050 <FS460_set_sharpness@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x32,%edi
call   1070 <FS460_set_color@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x32,%edi
call   10a0 <FS460_set_brightness@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x3c,%edi
call   1060 <FS460_set_contrast@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1211 <reset_defaults+0x91>
lea    0xdf4(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_defaults>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rdi
call   1040 <FS460_get_tv_active_lines@plt>
mov    0xc(%rsp),%ecx
add    $0xffffffd8,%ecx
mov    $0x14,%edi
mov    $0x14,%esi
mov    $0x2a8,%edx
call   1080 <FS460_set_vga_position@plt>
mov    %eax,%r14d
mov    $0x3e8,%edi
call   1090 <FS460_set_flicker_filter@plt>
mov    %eax,%ebp
mov    $0xc8,%edi
call   1050 <FS460_set_sharpness@plt>
mov    %eax,%ebx
or     %ebp,%ebx
mov    $0x32,%edi
call   1070 <FS460_set_color@plt>
mov    %eax,%ebp
or     %ebx,%ebp
mov    $0x32,%edi
call   10a0 <FS460_set_brightness@plt>
mov    %eax,%ebx
or     %ebp,%ebx
or     %r14d,%ebx
mov    $0x3c,%edi
call   1060 <FS460_set_contrast@plt>
or     %ebx,%eax
je     1203 <reset_defaults+0x83>
lea    0xe02(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Error writing defaults.\0A\00"
define void @reset_defaults() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @FS460_get_tv_active_lines(i32* %2)
%4 = load i32, i32* %2
%5 = sub nsw i32 %4, 40
%6 = call i32 @FS460_set_vga_position(i32 20, i32 20, i32 680, i32 %5)
store i32 %6, i32* %1
%7 = call i32 @FS460_set_flicker_filter(i32 1000)
%8 = load i32, i32* %1
%9 = or i32 %8, %7
store i32 %9, i32* %1
%10 = call i32 @FS460_set_sharpness(i32 200)
%11 = load i32, i32* %1
%12 = or i32 %11, %10
store i32 %12, i32* %1
%13 = call i32 @FS460_set_color(i32 50)
%14 = load i32, i32* %1
%15 = or i32 %14, %13
store i32 %15, i32* %1
%16 = call i32 @FS460_set_brightness(i32 50)
%17 = load i32, i32* %1
%18 = or i32 %17, %16
store i32 %18, i32* %1
%19 = call i32 @FS460_set_contrast(i32 60)
%20 = load i32, i32* %1
%21 = or i32 %20, %19
store i32 %21, i32* %1
%22 = load i32, i32* %1
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %0
%25 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %24, %0
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"Error writing defaults.\00"
define void @reset_defaults() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @FS460_get_tv_active_lines(i32* %1)
%4 = load i32, i32* %1
%5 = add nsw i32 %4, -40
%6 = call i32 @FS460_set_vga_position(i32 20, i32 20, i32 680, i32 %5)
%7 = call i32 @FS460_set_flicker_filter(i32 1000)
%8 = or i32 %7, %6
%9 = call i32 @FS460_set_sharpness(i32 200)
%10 = or i32 %8, %9
%11 = call i32 @FS460_set_color(i32 50)
%12 = or i32 %10, %11
%13 = call i32 @FS460_set_brightness(i32 50)
%14 = or i32 %12, %13
%15 = call i32 @FS460_set_contrast(i32 60)
%16 = or i32 %14, %15
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %20
20: ; preds = %18, %0
ret void
}