#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main() {
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  int largest = -1;
  int second_largest = -1;
  if (a > largest)
    largest = a;
  else if (a > second_largest)
    second_largest = a;
  if (b > largest) {
    second_largest = largest;
    largest = b;
  } else if (b > second_largest)
    second_largest = b;
  if (c > largest) {
    second_largest = largest;
    largest = c;
  } else if (c > second_largest)
    second_largest = c;
  if (d > largest) {
    second_largest = largest;
    largest = d;
  } else if (d > second_largest)
    second_largest = d;
  printf("The second largest number is %d", second_largest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
movl   $0xffffffff,-0x18(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1170 <main+0x50>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1187 <main+0x67>
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1182 <main+0x62>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1187 <main+0x67>
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11a4 <main+0x84>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11bb <main+0x9b>
mov    -0xc(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    11b6 <main+0x96>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11bb <main+0x9b>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11d8 <main+0xb8>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11ef <main+0xcf>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    11ea <main+0xca>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11ef <main+0xcf>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    120c <main+0xec>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1223 <main+0x103>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    121e <main+0xfe>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1223 <main+0x103>
mov    -0x1c(%rbp),%esi
lea    0xddc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
test   %eax,%eax
mov    $0xffffffff,%esi
cmovs  %esi,%eax
mov    0x10(%rsp),%ecx
test   %ecx,%ecx
cmovns %ecx,%esi
cmp    %eax,%ecx
cmovle %eax,%ecx
cmovg  %eax,%esi
mov    0xc(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ecx,%eax
cmovle %ecx,%eax
cmovg  %ecx,%esi
mov    0x8(%rsp),%ecx
cmp    %esi,%ecx
cmovg  %ecx,%esi
cmp    %eax,%ecx
cmovg  %eax,%esi
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d%d%d%d\00"
@.str.1 = [32 x i8] c"The second largest number is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
store i32 -1, i32* %6
store i32 -1, i32* %7
%9 = load i32, i32* %2
%10 = load i32, i32* %6
%11 = icmp sgt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = load i32, i32* %2
store i32 %13, i32* %6
br label %21
14: ; preds = %0
%15 = load i32, i32* %2
%16 = load i32, i32* %7
%17 = icmp sgt i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load i32, i32* %2
store i32 %19, i32* %7
br label %20
20: ; preds = %18, %14
br label %21
21: ; preds = %20, %12
%22 = load i32, i32* %3
%23 = load i32, i32* %6
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %6
store i32 %26, i32* %7
%27 = load i32, i32* %3
store i32 %27, i32* %6
br label %35
28: ; preds = %21
%29 = load i32, i32* %3
%30 = load i32, i32* %7
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = load i32, i32* %3
store i32 %33, i32* %7
br label %34
34: ; preds = %32, %28
br label %35
35: ; preds = %34, %25
%36 = load i32, i32* %4
%37 = load i32, i32* %6
%38 = icmp sgt i32 %36, %37
br i1 %38, label %39, label %42
39: ; preds = %35
%40 = load i32, i32* %6
store i32 %40, i32* %7
%41 = load i32, i32* %4
store i32 %41, i32* %6
br label %49
42: ; preds = %35
%43 = load i32, i32* %4
%44 = load i32, i32* %7
%45 = icmp sgt i32 %43, %44
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = load i32, i32* %4
store i32 %47, i32* %7
br label %48
48: ; preds = %46, %42
br label %49
49: ; preds = %48, %39
%50 = load i32, i32* %5
%51 = load i32, i32* %6
%52 = icmp sgt i32 %50, %51
br i1 %52, label %53, label %56
53: ; preds = %49
%54 = load i32, i32* %6
store i32 %54, i32* %7
%55 = load i32, i32* %5
store i32 %55, i32* %6
br label %63
56: ; preds = %49
%57 = load i32, i32* %5
%58 = load i32, i32* %7
%59 = icmp sgt i32 %57, %58
br i1 %59, label %60, label %62
60: ; preds = %56
%61 = load i32, i32* %5
store i32 %61, i32* %7
br label %62
62: ; preds = %60, %56
br label %63
63: ; preds = %62, %53
%64 = load i32, i32* %7
%65 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %64)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d%d%d%d\00"
@.str.1 = [32 x i8] c"The second largest number is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %1
%11 = icmp sgt i32 %10, -1
%12 = select i1 %11, i32 %10, i32 -1
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, %12
%15 = icmp sgt i32 %13, -1
%16 = select i1 %15, i32 %13, i32 -1
%17 = select i1 %14, i32 %13, i32 %12
%18 = select i1 %14, i32 %12, i32 %16
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, %17
%21 = icmp sgt i32 %19, %18
%22 = select i1 %21, i32 %19, i32 %18
%23 = select i1 %20, i32 %19, i32 %17
%24 = select i1 %20, i32 %17, i32 %22
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, %23
%27 = icmp sgt i32 %25, %24
%28 = select i1 %27, i32 %25, i32 %24
%29 = select i1 %26, i32 %23, i32 %28
%30 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %29)
ret i32 0
}