#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*/ printk(char *, char *);
void zf_show_action(int act) {
  char *str[4];
  {
    str[0] = (char *)"RESET";
    str[1] = (char *)"SMI";
    str[2] = (char *)"NMI";
    str[3] = (char *)"SCI";
    printk("<6>machzwd: Watchdog using action = %s\n", str[act]);
    return;
  }
}


x86 assembly (clang, -O0):
<zf_show_action>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xed9(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xed2(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xecb(%rip),%rax
mov    %rax,-0x18(%rbp)
movslq -0x4(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printk@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zf_show_action>:
lea    0xee9(%rip),%rax
mov    %rax,-0x28(%rsp)
lea    0xee3(%rip),%rax
mov    %rax,-0x20(%rsp)
lea    0xedb(%rip),%rax
mov    %rax,-0x18(%rsp)
lea    0xed3(%rip),%rax
mov    %rax,-0x10(%rsp)
movslq %edi,%rax
mov    -0x28(%rsp,%rax,8),%rsi
lea    0xec3(%rip),%rdi
jmp    1030 <printk@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"RESET\00"
@.str.1 = [4 x i8] c"SMI\00"
@.str.2 = [4 x i8] c"NMI\00"
@.str.3 = [4 x i8] c"SCI\00"
@.str.4 = [40 x i8] c"<6>machzwd: Watchdog using action = %s\0A\00"
define void @zf_show_action(i32 %0) {
%2 = alloca i32
%3 = alloca [4 x i8*]
store i32 %0, i32* %2
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %7
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [4 x i8*], [4 x i8*]* %3, i64 0, i64 %9
%11 = load i8*, i8** %10
%12 = call i32 @printk(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %11)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"RESET\00"
@.str.1 = [4 x i8] c"SMI\00"
@.str.2 = [4 x i8] c"NMI\00"
@.str.3 = [4 x i8] c"SCI\00"
@.str.4 = [40 x i8] c"<6>machzwd: Watchdog using action = %s\0A\00"
define void @zf_show_action(i32 %0) {
%2 = alloca [4 x i8*]
%3 = bitcast [4 x i8*]* %2 to i8*
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8** %7
%8 = sext i32 %0 to i64
%9 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @printk(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.4, i64 0, i64 0), i8* %10)
ret void
}