struct logrec {
  int date;
  int time;
  int code;
} main() {
  int back();
  printf("return struct!\n");
  int color = 2;
  {
    switch (color) {
    case 1:
      printf("red");
    case 2:
      printf("yellow");
    case 3:
      printf("blue");
    }
  }
  printf("\n%x,%x", back, back());
  int x = 1, y = 1, z;
  {
    if (x == 0) {
      {
        if (y == 0) {
          exit(0);
        }
      }
    } else {
      z = x + y;
      printf("\nz=%d\n", z);
    }
  }
  int m = 0;
  printf("\nm=%d\n", m);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movl   $0x2,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x3c(%rbp)
sub    $0x1,%eax
je     1173 <main+0x53>
jmp    1151 <main+0x31>
mov    -0x3c(%rbp),%eax
sub    $0x2,%eax
je     1181 <main+0x61>
jmp    1162 <main+0x42>
mov    -0x3c(%rbp),%eax
sub    $0x3,%eax
je     118f <main+0x6f>
jmp    119d <main+0x7d>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <back@plt>
mov    %eax,%edx
lea    0xe73(%rip),%rdi
mov    0x2e24(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11e9 <main+0xc9>
cmpl   $0x0,-0x1c(%rbp)
jne    11e4 <main+0xc4>
xor    %edi,%edi
call   1040 <exit@plt>
jmp    1203 <main+0xe3>
mov    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe1a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%edx
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <back@plt>
mov    0x2e81(%rip),%rsi
lea    0xeae(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe99(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
pop    %rcx
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.logrec = type { i32, i32, i32 }
@.str = [16 x i8] c"return struct!\0A\00"
@.str.1 = [4 x i8] c"red\00"
@.str.2 = [7 x i8] c"yellow\00"
@.str.3 = [5 x i8] c"blue\00"
@.str.4 = [7 x i8] c"\0A%x,%x\00"
@.str.5 = [7 x i8] c"\0Az=%d\0A\00"
@.str.6 = [7 x i8] c"\0Am=%d\0A\00"
define { i64, i32 } @main() {
%1 = alloca %struct.logrec
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca { i64, i32 }
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %2
%9 = load i32, i32* %2
switch i32 %9, label %16 [
i32 1, label %10
i32 2, label %12
i32 3, label %14
]
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %0, %10
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %14
14: ; preds = %0, %12
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %0
%17 = call i32 (...) @back()
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 (...)* @back, i32 %17)
store i32 1, i32* %3
store i32 1, i32* %4
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load i32, i32* %4
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %21
unreachable
25: ; preds = %21
br label %32
26: ; preds = %16
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = add nsw i32 %27, %28
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %26, %25
store i32 0, i32* %6
%33 = load i32, i32* %6
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %33)
%35 = bitcast { i64, i32 }* %7 to i8*
%36 = bitcast %struct.logrec* %1 to i8*
%37 = load { i64, i32 }, { i64, i32 }* %7
ret { i64, i32 } %37
}

LLVM IR (-O2):
@.str.2 = [7 x i8] c"yellow\00"
@.str.3 = [5 x i8] c"blue\00"
@.str.4 = [7 x i8] c"\0A%x,%x\00"
@.str.5 = [7 x i8] c"\0Az=%d\0A\00"
@.str.6 = [7 x i8] c"\0Am=%d\0A\00"
@str = [15 x i8] c"return struct!\00"
define { i64, i32 } @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 (...) @back()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 (...)* @back, i32 %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 2)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 0)
ret { i64, i32 } undef
}