#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*/ __builtin_safe_p(int);
int /*<<< orphan*/ __builtin_warning(int, char *);
int g(int);
int h(int);
int i(int);
int foo(int x, int y) {
  do {
    __builtin_warning(!__builtin_safe_p(x++),
                      "Macro argument with side effects: "
                      "x++");
    x++;
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p(x += 1),
                      "Macro argument with side effects: "
                      "x+=1");
    x += 1;
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p(x = x + 1),
                      "Macro argument with side effects: "
                      "x=x+1");
    x = x + 1;
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p(x %= y),
                      "Macro argument with side effects: "
                      "x%=y");
    x %= y;
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p(x = y),
                      "Macro argument with side effects: "
                      "x=y");
    x = y;
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p(g(x)),
                      "Macro argument with side effects: "
                      "g(x)");
    g(x);
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p((y, g(x))),
                      "Macro argument with side effects: "
                      "(y,g(x))");
    (y, g(x));
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p(x + 1),
                      "Macro argument with side effects: "
                      "x+1");
    x + 1;
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p(h(x)),
                      "Macro argument with side effects: "
                      "h(x)");
    h(x);
  } while (0);
  do {
    __builtin_warning(!__builtin_safe_p(i(x)),
                      "Macro argument with side effects: "
                      "i(x)");
    i(x);
  } while (0);
  return x;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe7e(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1195 <foo+0x45>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x4(%rbp)
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe6f(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11ca <foo+0x7a>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x4(%rbp)
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe61(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11ff <foo+0xaf>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,%edi
mov    %edi,-0x4(%rbp)
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe4f(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
jmp    123c <foo+0xec>
mov    -0x8(%rbp),%edi
mov    %edi,-0x4(%rbp)
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe41(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    126b <foo+0x11b>
mov    -0x4(%rbp),%edi
call   1040 <g@plt>
mov    %eax,%edi
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe34(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x4(%rbp),%edi
call   1040 <g@plt>
jmp    12a0 <foo+0x150>
mov    -0x4(%rbp),%edi
call   1040 <g@plt>
mov    %eax,%edi
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe26(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x4(%rbp),%edi
call   1040 <g@plt>
jmp    12d5 <foo+0x185>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe20(%rip),%rsi
call   1070 <__builtin_warning@plt>
jmp    12fe <foo+0x1ae>
mov    -0x4(%rbp),%edi
call   1030 <h@plt>
mov    %eax,%edi
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe19(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x4(%rbp),%edi
call   1030 <h@plt>
jmp    1333 <foo+0x1e3>
mov    -0x4(%rbp),%edi
call   1050 <i@plt>
mov    %eax,%edi
call   1060 <__builtin_safe_p@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%edi
lea    0xe0b(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    -0x4(%rbp),%edi
call   1050 <i@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebx
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xe93(%rip),%rsi
call   1070 <__builtin_warning@plt>
lea    0x3(%rbx),%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xe9d(%rip),%rsi
call   1070 <__builtin_warning@plt>
lea    0x5(%rbx),%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xea8(%rip),%rsi
call   1070 <__builtin_warning@plt>
add    $0x6,%ebx
mov    %ebx,%eax
cltd
idiv   %r14d
mov    %edx,%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xeac(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    %r14d,%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xeb7(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    %r14d,%edi
call   1040 <g@plt>
mov    %eax,%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xeba(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    %r14d,%edi
call   1040 <g@plt>
mov    %r14d,%edi
call   1040 <g@plt>
mov    %eax,%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xeb6(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    %r14d,%edi
call   1040 <g@plt>
lea    0x1(%r14),%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xebc(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    %r14d,%edi
call   1030 <h@plt>
mov    %eax,%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xebf(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    %r14d,%edi
call   1030 <h@plt>
mov    %r14d,%edi
call   1050 <i@plt>
mov    %eax,%edi
call   1060 <__builtin_safe_p@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
lea    0xebb(%rip),%rsi
call   1070 <__builtin_warning@plt>
mov    %r14d,%edi
call   1050 <i@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Macro argument with side effects: x++\00"
@.str.1 = [39 x i8] c"Macro argument with side effects: x+=1\00"
@.str.2 = [40 x i8] c"Macro argument with side effects: x=x+1\00"
@.str.3 = [39 x i8] c"Macro argument with side effects: x%=y\00"
@.str.4 = [38 x i8] c"Macro argument with side effects: x=y\00"
@.str.5 = [39 x i8] c"Macro argument with side effects: g(x)\00"
@.str.6 = [43 x i8] c"Macro argument with side effects: (y,g(x))\00"
@.str.7 = [38 x i8] c"Macro argument with side effects: x+1\00"
@.str.8 = [39 x i8] c"Macro argument with side effects: h(x)\00"
@.str.9 = [39 x i8] c"Macro argument with side effects: i(x)\00"
define i32 @foo(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %5
5: ; preds = %2
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1
store i32 %7, i32* %3
%8 = call i32 @__builtin_safe_p(i32 %6)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
%12 = call i32 @__builtin_warning(i32 %11, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %15
15: ; preds = %5
br label %16
16: ; preds = %15
%17 = load i32, i32* %3
%18 = add nsw i32 %17, 1
store i32 %18, i32* %3
%19 = call i32 @__builtin_safe_p(i32 %18)
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
%23 = call i32 @__builtin_warning(i32 %22, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %26
26: ; preds = %16
br label %27
27: ; preds = %26
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
%30 = call i32 @__builtin_safe_p(i32 %29)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
%33 = zext i1 %32 to i32
%34 = call i32 @__builtin_warning(i32 %33, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %37
37: ; preds = %27
br label %38
38: ; preds = %37
%39 = load i32, i32* %4
%40 = load i32, i32* %3
%41 = srem i32 %40, %39
store i32 %41, i32* %3
%42 = call i32 @__builtin_safe_p(i32 %41)
%43 = icmp ne i32 %42, 0
%44 = xor i1 %43, true
%45 = zext i1 %44 to i32
%46 = call i32 @__builtin_warning(i32 %45, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32, i32* %4
%48 = load i32, i32* %3
%49 = srem i32 %48, %47
store i32 %49, i32* %3
br label %50
50: ; preds = %38
br label %51
51: ; preds = %50
%52 = load i32, i32* %4
store i32 %52, i32* %3
%53 = call i32 @__builtin_safe_p(i32 %52)
%54 = icmp ne i32 %53, 0
%55 = xor i1 %54, true
%56 = zext i1 %55 to i32
%57 = call i32 @__builtin_warning(i32 %56, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%58 = load i32, i32* %4
store i32 %58, i32* %3
br label %59
59: ; preds = %51
br label %60
60: ; preds = %59
%61 = load i32, i32* %3
%62 = call i32 @g(i32 %61)
%63 = call i32 @__builtin_safe_p(i32 %62)
%64 = icmp ne i32 %63, 0
%65 = xor i1 %64, true
%66 = zext i1 %65 to i32
%67 = call i32 @__builtin_warning(i32 %66, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%68 = load i32, i32* %3
%69 = call i32 @g(i32 %68)
br label %70
70: ; preds = %60
br label %71
71: ; preds = %70
%72 = load i32, i32* %4
%73 = load i32, i32* %3
%74 = call i32 @g(i32 %73)
%75 = call i32 @__builtin_safe_p(i32 %74)
%76 = icmp ne i32 %75, 0
%77 = xor i1 %76, true
%78 = zext i1 %77 to i32
%79 = call i32 @__builtin_warning(i32 %78, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%80 = load i32, i32* %4
%81 = load i32, i32* %3
%82 = call i32 @g(i32 %81)
br label %83
83: ; preds = %71
br label %84
84: ; preds = %83
%85 = load i32, i32* %3
%86 = add nsw i32 %85, 1
%87 = call i32 @__builtin_safe_p(i32 %86)
%88 = icmp ne i32 %87, 0
%89 = xor i1 %88, true
%90 = zext i1 %89 to i32
%91 = call i32 @__builtin_warning(i32 %90, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%92 = load i32, i32* %3
%93 = add nsw i32 %92, 1
br label %94
94: ; preds = %84
br label %95
95: ; preds = %94
%96 = load i32, i32* %3
%97 = call i32 @h(i32 %96)
%98 = call i32 @__builtin_safe_p(i32 %97)
%99 = icmp ne i32 %98, 0
%100 = xor i1 %99, true
%101 = zext i1 %100 to i32
%102 = call i32 @__builtin_warning(i32 %101, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
%103 = load i32, i32* %3
%104 = call i32 @h(i32 %103)
br label %105
105: ; preds = %95
br label %106
106: ; preds = %105
%107 = load i32, i32* %3
%108 = call i32 @i(i32 %107)
%109 = call i32 @__builtin_safe_p(i32 %108)
%110 = icmp ne i32 %109, 0
%111 = xor i1 %110, true
%112 = zext i1 %111 to i32
%113 = call i32 @__builtin_warning(i32 %112, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
%114 = load i32, i32* %3
%115 = call i32 @i(i32 %114)
br label %116
116: ; preds = %106
%117 = load i32, i32* %3
ret i32 %117
}

LLVM IR (-O2):
@.str = [38 x i8] c"Macro argument with side effects: x++\00"
@.str.1 = [39 x i8] c"Macro argument with side effects: x+=1\00"
@.str.2 = [40 x i8] c"Macro argument with side effects: x=x+1\00"
@.str.3 = [39 x i8] c"Macro argument with side effects: x%=y\00"
@.str.4 = [38 x i8] c"Macro argument with side effects: x=y\00"
@.str.5 = [39 x i8] c"Macro argument with side effects: g(x)\00"
@.str.6 = [43 x i8] c"Macro argument with side effects: (y,g(x))\00"
@.str.7 = [38 x i8] c"Macro argument with side effects: x+1\00"
@.str.8 = [39 x i8] c"Macro argument with side effects: h(x)\00"
@.str.9 = [39 x i8] c"Macro argument with side effects: i(x)\00"
define i32 @foo(i32 %0, i32 returned %1) {
%3 = tail call i32 @__builtin_safe_p(i32 %0)
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @__builtin_warning(i32 %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%7 = add nsw i32 %0, 3
%8 = tail call i32 @__builtin_safe_p(i32 %7)
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
%11 = tail call i32 @__builtin_warning(i32 %10, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%12 = add nsw i32 %0, 5
%13 = tail call i32 @__builtin_safe_p(i32 %12)
%14 = icmp eq i32 %13, 0
%15 = zext i1 %14 to i32
%16 = tail call i32 @__builtin_warning(i32 %15, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0))
%17 = add nsw i32 %0, 6
%18 = srem i32 %17, %1
%19 = tail call i32 @__builtin_safe_p(i32 %18)
%20 = icmp eq i32 %19, 0
%21 = zext i1 %20 to i32
%22 = tail call i32 @__builtin_warning(i32 %21, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%23 = tail call i32 @__builtin_safe_p(i32 %1)
%24 = icmp eq i32 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @__builtin_warning(i32 %25, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%27 = tail call i32 @g(i32 %1)
%28 = tail call i32 @__builtin_safe_p(i32 %27)
%29 = icmp eq i32 %28, 0
%30 = zext i1 %29 to i32
%31 = tail call i32 @__builtin_warning(i32 %30, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%32 = tail call i32 @g(i32 %1)
%33 = tail call i32 @g(i32 %1)
%34 = tail call i32 @__builtin_safe_p(i32 %33)
%35 = icmp eq i32 %34, 0
%36 = zext i1 %35 to i32
%37 = tail call i32 @__builtin_warning(i32 %36, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.6, i64 0, i64 0))
%38 = tail call i32 @g(i32 %1)
%39 = add nsw i32 %1, 1
%40 = tail call i32 @__builtin_safe_p(i32 %39)
%41 = icmp eq i32 %40, 0
%42 = zext i1 %41 to i32
%43 = tail call i32 @__builtin_warning(i32 %42, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0))
%44 = tail call i32 @h(i32 %1)
%45 = tail call i32 @__builtin_safe_p(i32 %44)
%46 = icmp eq i32 %45, 0
%47 = zext i1 %46 to i32
%48 = tail call i32 @__builtin_warning(i32 %47, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
%49 = tail call i32 @h(i32 %1)
%50 = tail call i32 @i(i32 %1)
%51 = tail call i32 @__builtin_safe_p(i32 %50)
%52 = icmp eq i32 %51, 0
%53 = zext i1 %52 to i32
%54 = tail call i32 @__builtin_warning(i32 %53, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.9, i64 0, i64 0))
%55 = tail call i32 @i(i32 %1)
ret i32 %1
}