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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xee7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed7(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    116c <main+0x4c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1178 <main+0x58>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    0xe9e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    11c8 <main+0xa8>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11b7 <main+0x97>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11c3 <main+0xa3>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11ce <main+0xae>
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    0xe48(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    120c <main+0xec>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1201 <main+0xe1>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1207 <main+0xe7>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    120c <main+0xec>
mov    -0x1c(%rbp),%esi
lea    0xdea(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeea(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%r15d
mov    0x8(%rsp),%eax
cmp    %eax,%r15d
mov    %eax,%ebx
cmovg  %r15d,%ebx
cmovg  %eax,%r15d
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
mov    %eax,%r12d
cmovg  %ebx,%r12d
mov    %ebx,%ebp
cmovg  %eax,%ebp
cmp    %r15d,%eax
cmovle %ebx,%ebp
cmovle %r15d,%r12d
mov    %rsp,%rsi
mov    %r14,%rdi
call   1040 <scanf@plt>
mov    (%rsp),%eax
cmp    %ebp,%eax
cmovle %eax,%ebp
cmp    %r12d,%eax
cmovle %r12d,%ebp
lea    0xe53(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%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
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = load i32, i32* %2
store i32 %15, i32* %6
%16 = load i32, i32* %3
store i32 %16, i32* %7
br label %20
17: ; preds = %0
%18 = load i32, i32* %3
store i32 %18, i32* %6
%19 = load i32, i32* %2
store i32 %19, i32* %7
br label %20
20: ; preds = %17, %14
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %4
%23 = load i32, i32* %7
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %37
25: ; preds = %20
%26 = load i32, i32* %4
%27 = load i32, i32* %6
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = load i32, i32* %7
store i32 %30, i32* %8
%31 = load i32, i32* %6
store i32 %31, i32* %7
%32 = load i32, i32* %4
store i32 %32, i32* %6
br label %36
33: ; preds = %25
%34 = load i32, i32* %7
store i32 %34, i32* %8
%35 = load i32, i32* %4
store i32 %35, i32* %7
br label %36
36: ; preds = %33, %29
br label %39
37: ; preds = %20
%38 = load i32, i32* %4
store i32 %38, i32* %8
br label %39
39: ; preds = %37, %36
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%41 = load i32, i32* %5
%42 = load i32, i32* %7
%43 = icmp sgt i32 %41, %42
br i1 %43, label %44, label %53
44: ; preds = %39
%45 = load i32, i32* %5
%46 = load i32, i32* %6
%47 = icmp sgt i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = load i32, i32* %6
store i32 %49, i32* %7
br label %52
50: ; preds = %44
%51 = load i32, i32* %5
store i32 %51, i32* %7
br label %52
52: ; preds = %50, %48
br label %53
53: ; preds = %52, %39
%54 = load i32, i32* %7
%55 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %54)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = icmp sgt i32 %11, %12
%14 = select i1 %13, i32 %11, i32 %12
%15 = select i1 %13, i32 %12, i32 %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, %15
%19 = icmp sgt i32 %17, %14
%20 = select i1 %19, i32 %14, i32 %17
%21 = select i1 %18, i1 %19, i1 false
%22 = select i1 %21, i32 %17, i32 %14
%23 = select i1 %18, i32 %20, i32 %15
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, %23
%27 = icmp sgt i32 %25, %22
%28 = select i1 %27, i32 %22, i32 %25
%29 = select i1 %26, i32 %28, i32 %23
%30 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %29)
ret i32 0
}